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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/BLF_api.h17
-rw-r--r--source/blender/blenfont/intern/blf.c25
-rw-r--r--source/blender/blenfont/intern/blf_font.c36
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c33
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h10
-rw-r--r--source/blender/blenkernel/BKE_context.h1
-rw-r--r--source/blender/blenkernel/BKE_gpencil.h2
-rw-r--r--source/blender/blenkernel/BKE_material.h15
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c6
-rw-r--r--source/blender/blenkernel/intern/constraint.c8
-rw-r--r--source/blender/blenkernel/intern/context.c19
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/exotic.c1
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c2
-rw-r--r--source/blender/blenkernel/intern/gpencil.c2
-rw-r--r--source/blender/blenkernel/intern/idprop.c8
-rw-r--r--source/blender/blenkernel/intern/material.c4
-rw-r--r--source/blender/blenkernel/intern/particle_system.c12
-rw-r--r--source/blender/blenkernel/intern/pointcache.c4
-rw-r--r--source/blender/blenkernel/intern/scene.c7
-rw-r--r--source/blender/blenkernel/intern/sequence.c2
-rw-r--r--source/blender/blenlib/BLI_listbase.h4
-rw-r--r--source/blender/blenlib/BLI_noise.h2
-rw-r--r--source/blender/blenlib/BLI_rect.h2
-rw-r--r--source/blender/blenlib/BLI_storage.h7
-rw-r--r--source/blender/blenlib/BLI_string.h4
-rw-r--r--source/blender/blenlib/intern/dynamiclist.c2
-rw-r--r--source/blender/blenlib/intern/dynamiclist.h2
-rw-r--r--source/blender/blenlib/intern/listbase.c2
-rw-r--r--source/blender/blenlib/intern/psfont.c4
-rw-r--r--source/blender/blenlib/intern/string.c2
-rw-r--r--source/blender/blenloader/intern/readblenentry.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c94
-rw-r--r--source/blender/blenloader/intern/writefile.c2
-rw-r--r--source/blender/editors/animation/Makefile2
-rw-r--r--source/blender/editors/animation/anim_channels.c2
-rw-r--r--source/blender/editors/animation/keyframes_draw.c2
-rw-r--r--source/blender/editors/armature/Makefile2
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c105
-rw-r--r--source/blender/editors/curve/Makefile2
-rw-r--r--source/blender/editors/curve/curve_intern.h1
-rw-r--r--source/blender/editors/curve/curve_ops.c1
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/curve/editfont.c44
-rw-r--r--source/blender/editors/datafiles/Bfont.c2
-rw-r--r--source/blender/editors/datafiles/Makefile2
-rw-r--r--source/blender/editors/gpencil/Makefile2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c2
-rw-r--r--source/blender/editors/include/BIF_gl.h2
-rw-r--r--source/blender/editors/include/ED_curve.h3
-rw-r--r--source/blender/editors/include/ED_fluidsim.h2
-rw-r--r--source/blender/editors/include/ED_keyframes_draw.h2
-rw-r--r--source/blender/editors/include/ED_keyframing.h6
-rw-r--r--source/blender/editors/include/ED_mesh.h3
-rw-r--r--source/blender/editors/include/ED_particle.h2
-rw-r--r--source/blender/editors/include/ED_pointcache.h2
-rw-r--r--source/blender/editors/include/UI_icons.h4
-rw-r--r--source/blender/editors/include/UI_interface.h8
-rw-r--r--source/blender/editors/include/UI_resources.h2
-rw-r--r--source/blender/editors/interface/Makefile2
-rw-r--r--source/blender/editors/interface/interface.c54
-rw-r--r--source/blender/editors/interface/interface_draw.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c74
-rw-r--r--source/blender/editors/interface/interface_intern.h12
-rw-r--r--source/blender/editors/interface/interface_layout.c28
-rw-r--r--source/blender/editors/interface/interface_regions.c129
-rw-r--r--source/blender/editors/interface/interface_style.c38
-rw-r--r--source/blender/editors/interface/interface_templates.c186
-rw-r--r--source/blender/editors/interface/interface_utils.c79
-rw-r--r--source/blender/editors/interface/interface_widgets.c134
-rw-r--r--source/blender/editors/interface/resources.c2
-rw-r--r--source/blender/editors/mesh/Makefile2
-rw-r--r--source/blender/editors/mesh/editmesh.c4
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c6
-rw-r--r--source/blender/editors/object/Makefile2
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/physics/Makefile2
-rw-r--r--source/blender/editors/physics/ed_pointcache.c4
-rw-r--r--source/blender/editors/physics/editparticle.c32
-rw-r--r--source/blender/editors/preview/Makefile2
-rw-r--r--source/blender/editors/screen/Makefile2
-rw-r--r--source/blender/editors/screen/glutil.c2
-rw-r--r--source/blender/editors/sculpt_paint/Makefile2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h2
-rw-r--r--source/blender/editors/space_action/Makefile2
-rw-r--r--source/blender/editors/space_action/action_draw.c2
-rw-r--r--source/blender/editors/space_action/action_edit.c2
-rw-r--r--source/blender/editors/space_action/action_select.c2
-rw-r--r--source/blender/editors/space_api/Makefile2
-rw-r--r--source/blender/editors/space_buttons/Makefile2
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c9
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h6
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c261
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c12
-rw-r--r--source/blender/editors/space_file/Makefile2
-rw-r--r--source/blender/editors/space_file/file_draw.c71
-rw-r--r--source/blender/editors/space_file/file_ops.c2
-rw-r--r--source/blender/editors/space_file/filesel.c2
-rw-r--r--source/blender/editors/space_graph/Makefile2
-rw-r--r--source/blender/editors/space_graph/graph_draw.c2
-rw-r--r--source/blender/editors/space_graph/graph_edit.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c2
-rw-r--r--source/blender/editors/space_image/Makefile2
-rw-r--r--source/blender/editors/space_image/image_buttons.c44
-rw-r--r--source/blender/editors/space_image/image_draw.c28
-rw-r--r--source/blender/editors/space_image/image_header.c14
-rw-r--r--source/blender/editors/space_image/image_ops.c53
-rw-r--r--source/blender/editors/space_image/space_image.c8
-rw-r--r--source/blender/editors/space_info/Makefile2
-rw-r--r--source/blender/editors/space_info/info_header.c2
-rw-r--r--source/blender/editors/space_logic/Makefile2
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c2
-rw-r--r--source/blender/editors/space_logic/logic_window.c100
-rw-r--r--source/blender/editors/space_nla/Makefile2
-rw-r--r--source/blender/editors/space_node/Makefile2
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_outliner/Makefile2
-rw-r--r--source/blender/editors/space_outliner/outliner.c19
-rw-r--r--source/blender/editors/space_script/Makefile2
-rw-r--r--source/blender/editors/space_sequencer/Makefile2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c2
-rw-r--r--source/blender/editors/space_sound/Makefile2
-rw-r--r--source/blender/editors/space_text/Makefile2
-rw-r--r--source/blender/editors/space_text/text_header.c2
-rw-r--r--source/blender/editors/space_time/Makefile2
-rw-r--r--source/blender/editors/space_time/time_header.c4
-rw-r--r--source/blender/editors/space_view3d/Makefile2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c55
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c124
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c21
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c3
-rw-r--r--source/blender/editors/transform/Makefile2
-rw-r--r--source/blender/editors/transform/transform.c14
-rw-r--r--source/blender/editors/transform/transform.h1
-rw-r--r--source/blender/editors/transform/transform_conversions.c10
-rw-r--r--source/blender/editors/transform/transform_generics.c15
-rw-r--r--source/blender/editors/transform/transform_input.c2
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/editors/transform/transform_snap.c19
-rw-r--r--source/blender/editors/util/Makefile2
-rw-r--r--source/blender/editors/uvedit/Makefile2
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c22
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c112
-rw-r--r--source/blender/makesdna/DNA_particle_types.h5
-rw-r--r--source/blender/makesdna/DNA_scene_types.h61
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h10
-rw-r--r--source/blender/makesrna/RNA_access.h24
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/intern/Makefile2
-rw-r--r--source/blender/makesrna/intern/rna_access.c81
-rw-r--r--source/blender/makesrna/intern/rna_define.c2
-rw-r--r--source/blender/makesrna/intern/rna_image.c26
-rw-r--r--source/blender/makesrna/intern/rna_key.c2
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c10
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c58
-rw-r--r--source/blender/makesrna/intern/rna_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_packedfile.c2
-rw-r--r--source/blender/makesrna/intern/rna_particle.c11
-rw-r--r--source/blender/makesrna/intern/rna_scene.c98
-rw-r--r--source/blender/makesrna/intern/rna_space.c53
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c22
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c22
-rw-r--r--source/blender/makesrna/intern/rna_wm.c2
-rw-r--r--source/blender/python/BPY_extern.h4
-rw-r--r--source/blender/python/BPY_menus.c1118
-rw-r--r--source/blender/python/BPY_menus.h128
-rw-r--r--source/blender/python/Makefile2
-rw-r--r--source/blender/python/generic/BGL.c4
-rwxr-xr-xsource/blender/python/generic/BGL.h2
-rw-r--r--source/blender/python/generic/Geometry.c4
-rw-r--r--source/blender/python/generic/Geometry.h2
-rw-r--r--source/blender/python/generic/Makefile2
-rw-r--r--source/blender/python/generic/Mathutils.c225
-rw-r--r--source/blender/python/generic/Mathutils.h38
-rw-r--r--source/blender/python/generic/bpy_internal_import.c2
-rw-r--r--source/blender/python/generic/bpy_internal_import.h2
-rw-r--r--source/blender/python/generic/euler.c2
-rw-r--r--source/blender/python/generic/euler.h2
-rw-r--r--source/blender/python/generic/matrix.c266
-rw-r--r--source/blender/python/generic/matrix.h23
-rw-r--r--source/blender/python/generic/quat.c5
-rw-r--r--source/blender/python/generic/quat.h2
-rw-r--r--source/blender/python/generic/vector.c338
-rw-r--r--source/blender/python/generic/vector.h13
-rw-r--r--source/blender/python/intern/Makefile2
-rw-r--r--source/blender/python/intern/bpy_interface.c13
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c11
-rw-r--r--source/blender/python/intern/bpy_rna.c278
-rw-r--r--source/blender/windowmanager/intern/Makefile2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c19
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c2
-rw-r--r--source/blender/windowmanager/wm_cursors.h2
197 files changed, 2896 insertions, 2577 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index e871de490f3..2ee31a17fa6 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -91,6 +91,21 @@ void BLF_enable(int option);
void BLF_disable(int option);
/*
+ * Shadow options, level is the blur level, can be 3, 5 or 0 and
+ * the other argument are the rgba color.
+ * Take care that shadow need to be enable using BLF_enable!!.
+ */
+void BLF_shadow(int level, float r, float g, float b, float a);
+
+/*
+ * Set the offset for shadow text, this is the current cursor
+ * position plus this offset, don't need call BLF_position before
+ * this function, the current position is calculate only on
+ * BLF_draw, so it's safe call this whenever you like.
+ */
+void BLF_shadow_offset(int x, int y);
+
+/*
* Search the path directory to the locale files, this try all
* the case for Linux, Win and Mac.
*/
@@ -119,6 +134,8 @@ void BLF_dir_free(char **dirs, int count);
#define BLF_CLIPPING (1<<1)
#define BLF_FONT_KERNING (1<<2)
#define BLF_USER_KERNING (1<<3)
+#define BLF_SHADOW (1<<4)
+#define BLF_OVERLAP_CHAR (1<<5)
/* font->mode. */
#define BLF_MODE_TEXTURE 0
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index f06c7fb0d28..9dad5a4bfa0 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -500,3 +500,28 @@ void BLF_kerning(float space)
if (font)
font->kerning= space;
}
+
+void BLF_shadow(int level, float r, float g, float b, float a)
+{
+ FontBLF *font;
+
+ font= global_font[global_font_cur];
+ if (font) {
+ font->shadow= level;
+ font->shadow_col[0]= r;
+ font->shadow_col[1]= g;
+ font->shadow_col[2]= b;
+ font->shadow_col[3]= a;
+ }
+}
+
+void BLF_shadow_offset(int x, int y)
+{
+ FontBLF *font;
+
+ font= global_font[global_font_cur];
+ if (font) {
+ font->shadow_x= x;
+ font->shadow_y= y;
+ }
+}
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index ee4ba0ee71a..a3c5232cc76 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -146,20 +146,22 @@ void blf_font_draw(FontBLF *font, char *str)
if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) {
pen_x += delta.x >> 6;
-/*
- if (pen_x < old_pen_x)
- pen_x= old_pen_x;
-*/
+
+ if (font->flags & BLF_OVERLAP_CHAR) {
+ if (pen_x < old_pen_x)
+ pen_x= old_pen_x;
+ }
}
}
if (font->flags & BLF_USER_KERNING) {
old_pen_x= pen_x;
pen_x += font->kerning;
-/*
- if (pen_x < old_pen_x)
- pen_x= old_pen_x;
-*/
+
+ if (font->flags & BLF_OVERLAP_CHAR) {
+ if (pen_x < old_pen_x)
+ pen_x= old_pen_x;
+ }
}
/* do not return this loop if clipped, we want every character tested */
@@ -228,20 +230,22 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) {
pen_x += delta.x >> 6;
-/*
- if (pen_x < old_pen_x)
- old_pen_x= pen_x;
-*/
+
+ if (font->flags & BLF_OVERLAP_CHAR) {
+ if (pen_x < old_pen_x)
+ pen_x= old_pen_x;
+ }
}
}
if (font->flags & BLF_USER_KERNING) {
old_pen_x= pen_x;
pen_x += font->kerning;
-/*
- if (pen_x < old_pen_x)
- old_pen_x= pen_x;
-*/
+
+ if (font->flags & BLF_OVERLAP_CHAR) {
+ if (pen_x < old_pen_x)
+ pen_x= old_pen_x;
+ }
}
gbox.xmin= g->box.xmin + pen_x;
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 33a435cc5be..a637774d7bf 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -496,8 +496,20 @@ int blf_glyph_texture_render(FontBLF *font, GlyphBLF *g, float x, float y)
GLint cur_tex;
float dx, dx1;
float y1, y2;
+ float xo, yo;
+ float color[4];
gt= g->tex_data;
+ xo= 0.0f;
+ yo= 0.0f;
+
+ if (font->flags & BLF_SHADOW) {
+ xo= x;
+ yo= y;
+ x += font->shadow_x;
+ y += font->shadow_y;
+ }
+
dx= floor(x + gt->pos_x);
dx1= dx + gt->width;
y1= y + gt->pos_y;
@@ -518,6 +530,27 @@ int blf_glyph_texture_render(FontBLF *font, GlyphBLF *g, float x, float y)
if (cur_tex != gt->tex)
glBindTexture(GL_TEXTURE_2D, gt->tex);
+ if (font->flags & BLF_SHADOW) {
+ glGetFloatv(GL_CURRENT_COLOR, color);
+ glColor4fv(font->shadow_col);
+
+ if (font->shadow == 3)
+ blf_texture3_draw(gt->uv, dx, y1, dx1, y2);
+ else if (font->shadow == 5)
+ blf_texture5_draw(gt->uv, dx, y1, dx1, y2);
+ else
+ blf_texture_draw(gt->uv, dx, y1, dx1, y2);
+
+ glColor4fv(color);
+ x= xo;
+ y= yo;
+
+ dx= floor(x + gt->pos_x);
+ dx1= dx + gt->width;
+ y1= y + gt->pos_y;
+ y2= y + gt->pos_y - gt->height;
+ }
+
if (font->blur==3)
blf_texture3_draw(gt->uv, dx, y1, dx1, y2);
else if (font->blur==5)
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 60446aa93b2..5382ac19aae 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -154,6 +154,16 @@ typedef struct FontBLF {
/* blur: 3 or 5 large kernel */
int blur;
+
+ /* shadow level. */
+ int shadow;
+
+ /* and shadow offset. */
+ int shadow_x;
+ int shadow_y;
+
+ /* shadow color. */
+ float shadow_col[4];
/* this is the matrix that we load before rotate/scale/translate. */
float mat[4][4];
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 898b84ecdc3..f536e117b7b 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -131,6 +131,7 @@ void CTX_wm_menu_set(bContext *C, struct ARegion *menu);
- the dir listbase consits of LinkData items */
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member);
+PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type);
ListBase CTX_data_collection_get(const bContext *C, const char *member);
ListBase CTX_data_dir_get(const bContext *C);
void CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, ListBase *r_lb);
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 581285be21c..1892c8e71a4 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -1,5 +1,5 @@
/**
- * $Id: BDR_gpencil.h 19541 2009-04-05 06:54:47Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 38a1d9b13b7..382754ee2b2 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -39,6 +39,8 @@ struct Material;
struct ID;
struct Object;
+/* materials */
+
void init_def_material(void);
void free_material(struct Material *sc);
void test_object_materials(struct ID *id);
@@ -47,15 +49,22 @@ struct Material *add_material(char *name);
struct Material *copy_material(struct Material *ma);
void make_local_material(struct Material *ma);
+void automatname(struct Material *);
+
+/* material slots */
+
struct Material ***give_matarar(struct Object *ob);
short *give_totcolp(struct Object *ob);
struct Material *give_current_material(struct Object *ob, int act);
struct ID *material_from(struct Object *ob, int act);
void assign_material(struct Object *ob, struct Material *ma, int act);
-void new_material_to_objectdata(struct Object *ob);
int find_material_index(struct Object *ob, struct Material *ma);
+void object_add_material_slot(struct Object *ob);
+void object_remove_material_slot(struct Object *ob);
+
+/* rendering */
void init_render_material(struct Material *, int, float *);
void init_render_materials(int, float *);
@@ -64,12 +73,8 @@ void end_render_materials(void);
int material_in_material(struct Material *parmat, struct Material *mat);
-void automatname(struct Material *);
-void delete_material_index(struct Object *ob);
-
void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col);
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 877353a85e9..288867505be 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1,5 +1,5 @@
/**
- * $Id: anim_sys.c 21023 2009-06-20 04:02:49Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -73,6 +73,7 @@ static short id_has_animdata (ID *id)
case ID_OB:
case ID_CU:
case ID_KE:
+ case ID_PA:
case ID_MA: case ID_TE: case ID_NT:
case ID_LA: case ID_CA: case ID_WO:
case ID_SCE:
@@ -1265,6 +1266,9 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
/* meshes */
// TODO...
+ /* particles */
+ EVAL_ANIM_IDS(main->particle.first, ADT_RECALC_ANIM);
+
/* objects */
/* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets
* this tagged by Depsgraph on framechange
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index a43389a2ef6..88e73a00ba7 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3028,7 +3028,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
if (VALID_CONS_TARGET(ct)) {
float loc[3], eul[3], size[3];
float dvec[3], sval[3];
- short i;
+ int i;
/* obtain target effect */
switch (data->from) {
@@ -3075,7 +3075,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
switch (data->to) {
case 2: /* scaling */
for (i=0; i<3; i++)
- size[i]= data->to_min[i] + (sval[data->map[i]] * (data->to_max[i] - data->to_min[i]));
+ size[i]= data->to_min[i] + (sval[(int)data->map[i]] * (data->to_max[i] - data->to_min[i]));
break;
case 1: /* rotation */
for (i=0; i<3; i++) {
@@ -3085,7 +3085,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
tmax= data->to_max[i];
/* all values here should be in degrees */
- eul[i]= tmin + (sval[data->map[i]] * (tmax - tmin));
+ eul[i]= tmin + (sval[(int)data->map[i]] * (tmax - tmin));
/* now convert final value back to radians */
eul[i] = (float)(eul[i] / 180 * M_PI);
@@ -3094,7 +3094,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
default: /* location */
/* get new location */
for (i=0; i<3; i++)
- loc[i]= (data->to_min[i] + (sval[data->map[i]] * (data->to_max[i] - data->to_min[i])));
+ loc[i]= (data->to_min[i] + (sval[(int)data->map[i]] * (data->to_max[i] - data->to_min[i])));
/* add original location back on (so that it can still be moved) */
VecAddf(loc, cob->matrix[3], loc);
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 12deec838a8..90880e354ec 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -365,15 +365,20 @@ PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
{
bContextDataResult result;
- if(ctx_data_get((bContext*)C, member, &result)) {
+ if(ctx_data_get((bContext*)C, member, &result))
return result.ptr;
- }
- else {
- PointerRNA ptr;
- memset(&ptr, 0, sizeof(ptr));
- return ptr;
- }
+ else
+ return PointerRNA_NULL;
+}
+
+PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
+{
+ PointerRNA ptr = CTX_data_pointer_get(C, member);
+ if(ptr.data && ptr.type == type)
+ return ptr;
+
+ return PointerRNA_NULL;
}
ListBase CTX_data_collection_get(const bContext *C, const char *member)
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 9858025af5a..eaa2d541638 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
+
#include <math.h>
#include <stdlib.h>
diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c
index f15e1c24949..4e7e76dfae3 100644
--- a/source/blender/blenkernel/intern/exotic.c
+++ b/source/blender/blenkernel/intern/exotic.c
@@ -29,6 +29,7 @@
*
* ***** END GPL LICENSE BLOCK *****/
+#include "BLI_storage.h"
#include <ctype.h> /* isdigit, isspace */
#include <math.h>
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index 9eefd48cae4..54008185f72 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -28,6 +28,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
+
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 6086aa58d40..dd8f44c71d5 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1,5 +1,5 @@
/**
- * $Id: gpencil.c 19758 2009-04-16 13:10:08Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 3be47778674..54366aadd92 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -230,16 +230,16 @@ void IDP_ResizeArray(IDProperty *prop, int newlen)
*/
newsize = (newsize >> 3) + (newsize < 9 ? 3 : 6) + newsize;
- newarr = MEM_callocN(idp_size_table[prop->subtype]*newsize, "idproperty array resized");
+ newarr = MEM_callocN(idp_size_table[(int)prop->subtype]*newsize, "idproperty array resized");
if (newlen >= prop->len) {
/* newlen is bigger*/
- memcpy(newarr, prop->data.pointer, prop->len*idp_size_table[prop->subtype]);
+ memcpy(newarr, prop->data.pointer, prop->len*idp_size_table[(int)prop->subtype]);
idp_resize_group_array(prop, newlen, newarr);
}
else {
/* newlen is smaller*/
idp_resize_group_array(prop, newlen, newarr);
- memcpy(newarr, prop->data.pointer, newlen*prop->len*idp_size_table[prop->subtype]);
+ memcpy(newarr, prop->data.pointer, newlen*prop->len*idp_size_table[(int)prop->subtype]);
}
MEM_freeN(prop->data.pointer);
@@ -546,7 +546,7 @@ int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2)
return BSTR_EQ(IDP_String(prop1), IDP_String(prop2));
else if(prop1->type == IDP_ARRAY) {
if(prop1->len == prop2->len && prop1->subtype == prop2->subtype)
- return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[prop1->subtype]*prop1->len);
+ return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[(int)prop1->subtype]*prop1->len);
else
return 0;
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index b410c521dea..57b88bb0b3f 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -615,7 +615,7 @@ int find_material_index(Object *ob, Material *ma)
return 0;
}
-void new_material_to_objectdata(Object *ob)
+void object_add_material_slot(Object *ob)
{
Material *ma;
@@ -854,7 +854,7 @@ void automatname(Material *ma)
}
-void delete_material_index(Object *ob)
+void object_remove_material_slot(Object *ob)
{
Material *mao, ***matarar;
Object *obt;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index fc6413849d1..97b1956bba9 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -29,6 +29,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
+
#include <stdlib.h>
#include <math.h>
#include <string.h>
@@ -2203,12 +2205,15 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra
*sfra = MAX2(1, (int)part->sta);
*efra = MIN2((int)(part->end + part->lifetime + 1.0), scene->r.efra);
}
-static float *particle_state_ptr(int index, ParticleSystem *psys)
+static float *particle_state_ptr(int index, void *psys_ptr)
{
+ ParticleSystem *psys= psys_ptr;
+
return (float *)(&(psys->particles+index)->state);
}
-static void particle_read_state(int index, ParticleSystem *psys, float *data)
+static void particle_read_state(int index, void *psys_ptr, float *data)
{
+ ParticleSystem *psys= psys_ptr;
ParticleData *pa = psys->particles + index;
ParticleKey *key = (ParticleKey *)data;
@@ -2217,8 +2222,9 @@ static void particle_read_state(int index, ParticleSystem *psys, float *data)
copy_particle_key(&pa->state, key, 1);
}
-static void particle_cache_interpolate(int index, ParticleSystem *psys, float frs_sec, float cfra, int cfra1, int cfra2, float *data1, float *data2)
+static void particle_cache_interpolate(int index, void *psys_ptr, float frs_sec, float cfra, int cfra1, int cfra2, float *data1, float *data2)
{
+ ParticleSystem *psys= psys_ptr;
ParticleData *pa = psys->particles + index;
ParticleKey keys[4];
float dfra;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index f59336518d7..b514ac026fb 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1050,7 +1050,6 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
int endframe = CFRA;
int bake = baker->bake;
int render = baker->render;
- int end = 0;
G.afbreek = 0;
@@ -1162,7 +1161,6 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) {
int totelem=0;
int float_count=0;
int tot;
- int write_error=0;
if (!G.relbase_valid){
cache->flag &= ~PTCACHE_DISK_CACHE;
@@ -1243,4 +1241,4 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) {
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
cache->flag &= ~PTCACHE_DISK_CACHE;
}
-} \ No newline at end of file
+}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 3b51af57e0b..23da5c66850 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -203,9 +203,6 @@ Scene *add_scene(char *name)
sce= alloc_libblock(&G.main->scene, ID_SCE, name);
sce->lay= 1;
- sce->selectmode= SCE_SELECT_VERTEX;
- sce->editbutsize= 0.1;
- sce->autokey_mode= U.autokey_mode;
sce->r.mode= R_GAMMA;
sce->r.cfra= 1;
@@ -275,6 +272,10 @@ Scene *add_scene(char *name)
sce->toolsettings->select_thresh= 0.01f;
sce->toolsettings->jointrilimit = 0.8f;
+ sce->toolsettings->selectmode= SCE_SELECT_VERTEX;
+ sce->toolsettings->normalsize= 0.1;
+ sce->toolsettings->autokey_mode= U.autokey_mode;
+
sce->toolsettings->skgen_resolution = 100;
sce->toolsettings->skgen_threshold_internal = 0.01f;
sce->toolsettings->skgen_threshold_external = 0.01f;
diff --git a/source/blender/blenkernel/intern/sequence.c b/source/blender/blenkernel/intern/sequence.c
index bb0665a5b0f..7fc262b4796 100644
--- a/source/blender/blenkernel/intern/sequence.c
+++ b/source/blender/blenkernel/intern/sequence.c
@@ -1,5 +1,5 @@
/**
-* $Id: sequence.c 17508 2008-11-20 00:34:24Z campbellbarton $
+* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index d2fb62141de..d0b106b59c3 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -1,5 +1,5 @@
/*
- * $Id: BLI_blenlib.h 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -26,7 +26,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*
- * $Id: $
+ * $Id$
*/
#ifndef BLI_LISTBASE_H
diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h
index 9f72c5e7b54..0886eb3a8a5 100644
--- a/source/blender/blenlib/BLI_noise.h
+++ b/source/blender/blenlib/BLI_noise.h
@@ -1,5 +1,5 @@
/*
- * $Id: BLI_blenlib.h 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index c7026b21494..c36a41af84b 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -1,5 +1,5 @@
/*
- * $Id: BLI_blenlib.h 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h
index d7bf3bd13f8..fa44bb36e15 100644
--- a/source/blender/blenlib/BLI_storage.h
+++ b/source/blender/blenlib/BLI_storage.h
@@ -25,15 +25,20 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
#ifndef BLI_STORAGE_H
#define BLI_STORAGE_H
+/* NOTE: these have to be defined before including unistd.h! */
#ifndef __APPLE__
#ifndef WIN32
-#define _LARGEFILE_SOURCE 1
+#ifndef _LARGEFILE_SOURCE
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#endif
#endif
+#endif
struct direntry;
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 4e5bf650196..bf93dc19cc5 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -1,5 +1,5 @@
/*
- * $Id: BLI_blenlib.h 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -26,7 +26,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*
- * $Id: $
+ * $Id$
*/
#ifndef BLI_STRING_H
diff --git a/source/blender/blenlib/intern/dynamiclist.c b/source/blender/blenlib/intern/dynamiclist.c
index fbb87124bba..4fe654cffb6 100644
--- a/source/blender/blenlib/intern/dynamiclist.c
+++ b/source/blender/blenlib/intern/dynamiclist.c
@@ -3,7 +3,7 @@
* various string, file, list operations.
*
*
- * $Id: util.c 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenlib/intern/dynamiclist.h b/source/blender/blenlib/intern/dynamiclist.h
index aba3eda0696..e8c93fbcf23 100644
--- a/source/blender/blenlib/intern/dynamiclist.h
+++ b/source/blender/blenlib/intern/dynamiclist.h
@@ -1,5 +1,5 @@
/**
- * $Id: BLI_dynamiclist.h 13161 2008-01-07 19:13:47Z hos $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index e0fd5c37494..1064c8ac1bf 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -3,7 +3,7 @@
* various string, file, list operations.
*
*
- * $Id: util.c 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenlib/intern/psfont.c b/source/blender/blenlib/intern/psfont.c
index 39d38e4cf3a..269e674a62f 100644
--- a/source/blender/blenlib/intern/psfont.c
+++ b/source/blender/blenlib/intern/psfont.c
@@ -837,7 +837,7 @@ static int decodetype1(PackedFile * pf, char *outname)
while(newfgets(oneline, LINELEN, pf)) {
hptr = (char *)oneline;
while(*hptr) {
- if(hextab[*hptr] != NOTHEX)
+ if(hextab[(int)*hptr] != NOTHEX)
hexdat[hexbytes++] = *hptr;
hptr++;
}
@@ -853,7 +853,7 @@ static int decodetype1(PackedFile * pf, char *outname)
bptr = bindat;
c = datbytes;
while(c--) {
- *bptr++ = (hextab[hptr[0]]<<4)+hextab[hptr[1]];
+ *bptr++ = (hextab[(int)hptr[0]]<<4)+hextab[(int)hptr[1]];
hptr += 2;
}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index fa4bcbc26bc..4cd04aa232c 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -3,7 +3,7 @@
* various string, file, list operations.
*
*
- * $Id: util.c 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 0c8b8a6b31d..1f276913ea8 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include "BLI_storage.h" /* _LARGEFILE_SOURCE */
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d7f60e1928b..b9cbb863022 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2957,7 +2957,9 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
part= main->particle.first;
while(part) {
if(part->id.flag & LIB_NEEDLINK) {
+ if (part->adt) lib_link_animdata(fd, &part->id, part->adt);
part->ipo= newlibadr_us(fd, part->id.lib, part->ipo); // XXX depreceated - old animation system
+
part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob);
part->dup_group = newlibadr(fd, part->id.lib, part->dup_group);
part->eff_group = newlibadr(fd, part->id.lib, part->eff_group);
@@ -2970,6 +2972,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
{
+ part->adt= newdataadr(fd, part->adt);
part->pd= newdataadr(fd, part->pd);
part->pd2= newdataadr(fd, part->pd2);
}
@@ -7165,22 +7168,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(main->versionfile <= 234) {
- Scene *sce;
World *wo;
bScreen *sc;
- int set_zbuf_sel=0;
// force sumo engine to be active
for (wo = main->world.first; wo; wo= wo->id.next) {
if(wo->physicsEngine==0) wo->physicsEngine = 2;
}
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if(sce->selectmode==0) {
- sce->selectmode= SCE_SELECT_VERTEX;
- set_zbuf_sel= 1;
- }
- }
for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
for (sa= sc->areabase.first; sa; sa= sa->next) {
@@ -7188,7 +7183,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
- if(set_zbuf_sel) v3d->flag |= V3D_ZBUF_SELECT;
+ v3d->flag |= V3D_ZBUF_SELECT;
}
else if(sl->spacetype==SPACE_TEXT) {
SpaceText *st= (SpaceText *)sl;
@@ -7223,16 +7218,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if(main->versionfile <= 236) {
Object *ob;
- Scene *sce= main->scene.first;
Camera *cam= main->camera.first;
Material *ma;
bScreen *sc;
- while(sce) {
- if(sce->editbutsize==0.0) sce->editbutsize= 0.1f;
-
- sce= sce->id.next;
- }
while(cam) {
if(cam->ortho_scale==0.0) {
cam->ortho_scale= 256.0f/cam->lens;
@@ -8858,15 +8847,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
- /* autokey mode settings now used from scene, but need to be initialised off userprefs */
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 8)) {
- Scene *sce;
-
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->autokey_mode == 0)
- sce->autokey_mode= U.autokey_mode;
- }
- }
if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) {
Lamp *la= main->lamp.first;
@@ -9059,6 +9039,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
+ if (main->versionfile < 249 && main->subversionfile < 2) {
+ Scene *sce= main->scene.first;
+ Sequence *seq;
+ Editing *ed;
+
+ while(sce) {
+ ed= sce->ed;
+ if(ed) {
+ SEQP_BEGIN(ed, seq) {
+ if (seq->strip && seq->strip->proxy){
+ if (sce->r.size != 100.0) {
+ seq->strip->proxy->size
+ = sce->r.size;
+ } else {
+ seq->strip->proxy->size
+ = 25.0;
+ }
+ seq->strip->proxy->quality =90;
+ }
+ }
+ SEQ_END
+ }
+
+ sce= sce->id.next;
+ }
+
+ }
+
if (main->versionfile < 250) {
bScreen *screen;
Scene *scene;
@@ -9144,6 +9152,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
Object *ob;
Material *ma;
+ Scene *sce;
+ ToolSettings *ts;
int i;
for(ob = main->object.first; ob; ob = ob->id.next) {
@@ -9216,37 +9226,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma->mode &= ~MA_HALO;
}
}
- }
-
- if (main->versionfile < 249 && main->subversionfile < 2) {
- Scene *sce= main->scene.first;
- Sequence *seq;
- Editing *ed;
-
- while(sce) {
- ed= sce->ed;
- if(ed) {
- SEQP_BEGIN(ed, seq) {
- if (seq->strip && seq->strip->proxy){
- if (sce->r.size != 100.0) {
- seq->strip->proxy->size
- = sce->r.size;
- } else {
- seq->strip->proxy->size
- = 25.0;
- }
- seq->strip->proxy->quality =90;
- }
- }
- SEQ_END
+
+ for(sce = main->scene.first; sce; sce = sce->id.next) {
+ ts= sce->toolsettings;
+ if(ts->normalsize == 0.0) {
+ ts->normalsize= 0.1f;
+ ts->selectmode= SCE_SELECT_VERTEX;
+ ts->autokey_mode= U.autokey_mode;
}
-
- sce= sce->id.next;
}
-
}
-
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
@@ -9607,6 +9597,8 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
expand_doit(fd, mainvar, part->dup_group);
expand_doit(fd, mainvar, part->eff_group);
expand_doit(fd, mainvar, part->bb_ob);
+
+ expand_animdata(fd, mainvar, part->adt);
}
static void expand_group(FileData *fd, Main *mainvar, Group *group)
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 3f591c62dee..e6ca289e610 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -382,6 +382,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not
/*These functions are used by blender's .blend system for file saving/loading.*/
void IDP_WriteProperty_OnlyData(IDProperty *prop, void *wd);
void IDP_WriteProperty(IDProperty *prop, void *wd);
+static void write_animdata(WriteData *wd, AnimData *adt); // XXX code needs reshuffling, but not before NLA SoC is merged back into 2.5
static void IDP_WriteArray(IDProperty *prop, void *wd)
{
@@ -575,6 +576,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
/* write LibData */
writestruct(wd, ID_PA, "ParticleSettings", 1, part);
if (part->id.properties) IDP_WriteProperty(part->id.properties, wd);
+ if (part->adt) write_animdata(wd, part->adt);
writestruct(wd, DATA, "PartDeflect", 1, part->pd);
writestruct(wd, DATA, "PartDeflect", 1, part->pd2);
}
diff --git a/source/blender/editors/animation/Makefile b/source/blender/editors/animation/Makefile
index 19b62891b63..a7f36aa58ac 100644
--- a/source/blender/editors/animation/Makefile
+++ b/source/blender/editors/animation/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c
index 9230cdfc9a2..4ac1648361e 100644
--- a/source/blender/editors/animation/anim_channels.c
+++ b/source/blender/editors/animation/anim_channels.c
@@ -1,5 +1,5 @@
/**
- * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 07db47c8fed..56b1c63db74 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -1,5 +1,5 @@
/**
- * $Id: drawaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/armature/Makefile b/source/blender/editors/armature/Makefile
index 6c7ce81a8a1..0291bcb1830 100644
--- a/source/blender/editors/armature/Makefile
+++ b/source/blender/editors/armature/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index f010abdb7e7..fb030b91ce1 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -243,6 +243,7 @@ void BIF_makeListTemplates(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
Base *base;
int index = 0;
@@ -263,7 +264,7 @@ void BIF_makeListTemplates(bContext *C)
index++;
BLI_ghash_insert(TEMPLATES_HASH, SET_INT_IN_POINTER(index), ob);
- if (ob == scene->toolsettings->skgen_template)
+ if (ob == ts->skgen_template)
{
TEMPLATES_CURRENT = index;
}
@@ -305,8 +306,9 @@ char *BIF_listTemplates(bContext *C)
int BIF_currentTemplate(bContext *C)
{
- Scene *scene = CTX_data_scene(C);
- if (TEMPLATES_CURRENT == 0 && scene->toolsettings->skgen_template != NULL)
+ ToolSettings *ts = CTX_data_tool_settings(C);
+
+ if (TEMPLATES_CURRENT == 0 && ts->skgen_template != NULL)
{
GHashIterator ghi;
BLI_ghashIterator_init(&ghi, TEMPLATES_HASH);
@@ -316,7 +318,7 @@ int BIF_currentTemplate(bContext *C)
Object *ob = BLI_ghashIterator_getValue(&ghi);
int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
- if (ob == scene->toolsettings->skgen_template)
+ if (ob == ts->skgen_template)
{
TEMPLATES_CURRENT = key;
break;
@@ -360,8 +362,8 @@ RigGraph* sk_makeTemplateGraph(bContext *C, Object *ob)
int BIF_nbJointsTemplate(bContext *C)
{
- Scene *scene = CTX_data_scene(C);
- RigGraph *rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ RigGraph *rg = sk_makeTemplateGraph(C, ts->skgen_template);
if (rg)
{
@@ -375,7 +377,7 @@ int BIF_nbJointsTemplate(bContext *C)
char * BIF_nameBoneTemplate(bContext *C)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
SK_Sketch *stk = GLOBAL_sketch;
RigGraph *rg;
int index = 0;
@@ -385,7 +387,7 @@ char * BIF_nameBoneTemplate(bContext *C)
index = stk->active_stroke->nb_points;
}
- rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template);
+ rg = sk_makeTemplateGraph(C, ts->skgen_template);
if (rg == NULL)
{
@@ -418,14 +420,14 @@ void BIF_freeTemplates(bContext *C)
void BIF_setTemplate(bContext *C, int index)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
if (index > 0)
{
- scene->toolsettings->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index));
+ ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index));
}
else
{
- scene->toolsettings->skgen_template = NULL;
+ ts->skgen_template = NULL;
if (TEMPLATE_RIGG != NULL)
{
@@ -439,19 +441,19 @@ void BIF_setTemplate(bContext *C, int index)
void sk_autoname(bContext *C, ReebArc *arc)
{
- Scene *scene = CTX_data_scene(C);
- if (scene->toolsettings->skgen_retarget_options & SK_RETARGET_AUTONAME)
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ if (ts->skgen_retarget_options & SK_RETARGET_AUTONAME)
{
if (arc == NULL)
{
- char *num = scene->toolsettings->skgen_num_string;
+ char *num = ts->skgen_num_string;
int i = atoi(num);
i++;
BLI_snprintf(num, 8, "%i", i);
}
else
{
- char *side = scene->toolsettings->skgen_side_string;
+ char *side = ts->skgen_side_string;
int valid = 0;
int caps = 0;
@@ -525,7 +527,7 @@ ReebArc *sk_strokeToArc(SK_Stroke *stk, float imat[][4], float tmat[][3])
void sk_retargetStroke(bContext *C, SK_Stroke *stk)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
float imat[4][4];
float tmat[3][3];
@@ -541,7 +543,7 @@ void sk_retargetStroke(bContext *C, SK_Stroke *stk)
sk_autoname(C, arc);
- rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template);
+ rg = sk_makeTemplateGraph(C, ts->skgen_template);
BIF_retargetArc(C, arc, rg);
@@ -1408,10 +1410,10 @@ void sk_startStroke(SK_Sketch *sketch)
void sk_endStroke(bContext *C, SK_Sketch *sketch)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
sk_shrinkStrokeBuffer(sketch->active_stroke);
- if (scene->toolsettings->bone_sketching & BONE_SKETCHING_ADJUST)
+ if (ts->bone_sketching & BONE_SKETCHING_ADJUST)
{
sk_endOverdraw(sketch);
}
@@ -1521,10 +1523,10 @@ int sk_addStrokeDrawPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_Dra
int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
int point_added = 0;
- if (scene->snap_mode == SCE_SNAP_MODE_VOLUME)
+ if (ts->snap_mode == SCE_SNAP_MODE_VOLUME)
{
ListBase depth_peels;
DepthPeel *p1, *p2;
@@ -1557,7 +1559,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
p1->flag = 1;
/* if peeling objects, take the first and last from each object */
- if (scene->snap_flag & SCE_SNAP_PEEL_OBJECT)
+ if (ts->snap_flag & SCE_SNAP_PEEL_OBJECT)
{
DepthPeel *peel;
for (peel = p1->next; peel; peel = peel->next)
@@ -1627,7 +1629,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok
int dist = SNAP_MIN_DISTANCE; // Use a user defined value here
/* snap to strokes */
- // if (scene->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */
+ // if (ts->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */
for (snap_stk = sketch->strokes.first; snap_stk; snap_stk = snap_stk->next)
{
SK_Point *spt = NULL;
@@ -1713,7 +1715,7 @@ int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_Dra
void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
int point_added = 0;
if (snap)
@@ -1726,7 +1728,7 @@ void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawDa
point_added = sk_addStrokeDrawPoint(C, sketch, stk, dd);
}
- if (stk == sketch->active_stroke && scene->toolsettings->bone_sketching & BONE_SKETCHING_ADJUST)
+ if (stk == sketch->active_stroke && ts->bone_sketching & BONE_SKETCHING_ADJUST)
{
sk_updateOverdraw(C, sketch, stk, dd);
}
@@ -1951,7 +1953,7 @@ static int iteratorStopped(void *arg)
void sk_convertStroke(bContext *C, SK_Stroke *stk)
{
Object *obedit = CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
bArmature *arm = obedit->data;
SK_Point *head;
EditBone *parent = NULL;
@@ -1990,17 +1992,17 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
initStrokeIterator(iter, stk, head_index, i);
- if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
+ if (ts->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
{
- bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision);
+ bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision);
}
- else if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
+ else if (ts->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
{
- bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision);
+ bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision);
}
- else if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
+ else if (ts->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
{
- bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision);
+ bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision);
}
}
@@ -2042,14 +2044,14 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
void sk_convert(bContext *C, SK_Sketch *sketch)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
SK_Stroke *stk;
for (stk = sketch->strokes.first; stk; stk = stk->next)
{
if (stk->selected == 1)
{
- if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET)
+ if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
{
sk_retargetStroke(C, stk);
}
@@ -2693,7 +2695,7 @@ void sk_selectStroke(bContext *C, SK_Sketch *sketch, short mval[2], int extend)
rect.ymin= mval[1]-5;
rect.ymax= mval[1]+5;
- hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
+ hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
if (hits>0)
{
@@ -2743,6 +2745,7 @@ void sk_queueRedrawSketch(SK_Sketch *sketch)
void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
{
+ ToolSettings *ts= scene->toolsettings;
SK_Stroke *stk;
glDisable(GL_DEPTH_TEST);
@@ -2779,7 +2782,7 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
if (stk->selected == 1)
{
- sk_drawStrokeSubdivision(scene->toolsettings, stk);
+ sk_drawStrokeSubdivision(ts, stk);
}
}
@@ -2794,9 +2797,9 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
{
SK_Point *last = sk_lastStrokePoint(sketch->active_stroke);
- if (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK)
+ if (ts->bone_sketching & BONE_SKETCHING_QUICK)
{
- sk_drawStrokeSubdivision(scene->toolsettings, sketch->active_stroke);
+ sk_drawStrokeSubdivision(ts, sketch->active_stroke);
}
if (last != NULL)
@@ -2839,7 +2842,7 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names)
int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
if (sketch->active_stroke != NULL)
{
@@ -2847,9 +2850,9 @@ int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
sk_endStroke(C, sketch);
- if (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK)
+ if (ts->bone_sketching & BONE_SKETCHING_QUICK)
{
- if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET)
+ if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
{
sk_retargetStroke(C, stk);
}
@@ -3196,11 +3199,11 @@ static int sketch_draw_preview(bContext *C, wmOperator *op, wmEvent *event)
int ED_operator_sketch_mode_active_stroke(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
if (obedit &&
obedit->type == OB_ARMATURE &&
- scene->toolsettings->bone_sketching & BONE_SKETCHING &&
+ ts->bone_sketching & BONE_SKETCHING &&
GLOBAL_sketch != NULL &&
GLOBAL_sketch->active_stroke != NULL)
{
@@ -3215,12 +3218,12 @@ int ED_operator_sketch_mode_active_stroke(bContext *C)
int ED_operator_sketch_mode_gesture(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
if (obedit &&
obedit->type == OB_ARMATURE &&
- scene->toolsettings->bone_sketching & BONE_SKETCHING &&
- (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) == 0 &&
+ ts->bone_sketching & BONE_SKETCHING &&
+ (ts->bone_sketching & BONE_SKETCHING_QUICK) == 0 &&
GLOBAL_sketch != NULL &&
GLOBAL_sketch->active_stroke == NULL)
{
@@ -3235,12 +3238,12 @@ int ED_operator_sketch_mode_gesture(bContext *C)
int ED_operator_sketch_full_mode(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
if (obedit &&
obedit->type == OB_ARMATURE &&
- scene->toolsettings->bone_sketching & BONE_SKETCHING &&
- (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) == 0)
+ ts->bone_sketching & BONE_SKETCHING &&
+ (ts->bone_sketching & BONE_SKETCHING_QUICK) == 0)
{
return 1;
}
@@ -3253,11 +3256,11 @@ int ED_operator_sketch_full_mode(bContext *C)
int ED_operator_sketch_mode(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
if (obedit &&
obedit->type == OB_ARMATURE &&
- scene->toolsettings->bone_sketching & BONE_SKETCHING)
+ ts->bone_sketching & BONE_SKETCHING)
{
return 1;
}
diff --git a/source/blender/editors/curve/Makefile b/source/blender/editors/curve/Makefile
index 6b1f628f231..6449700e50b 100644
--- a/source/blender/editors/curve/Makefile
+++ b/source/blender/editors/curve/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index a73a54323ee..2146855a75e 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -49,7 +49,6 @@ void FONT_OT_case_toggle(struct wmOperatorType *ot);
void FONT_OT_case_set(struct wmOperatorType *ot);
void FONT_OT_style_toggle(struct wmOperatorType *ot);
void FONT_OT_style_set(struct wmOperatorType *ot);
-void FONT_OT_material_set(struct wmOperatorType *ot);
void FONT_OT_text_copy(struct wmOperatorType *ot);
void FONT_OT_text_cut(struct wmOperatorType *ot);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index 5292d86d3c9..66cde772f3e 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -106,7 +106,6 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(FONT_OT_case_set);
WM_operatortype_append(FONT_OT_style_toggle);
WM_operatortype_append(FONT_OT_style_set);
- WM_operatortype_append(FONT_OT_material_set);
WM_operatortype_append(FONT_OT_text_copy);
WM_operatortype_append(FONT_OT_text_cut);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 466908c562c..5283aacf39e 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -189,7 +189,7 @@ static short swap_selection_bpoint(BPoint *bp)
return select_bpoint(bp, SELECT, 1, VISIBLE);
}
-short isNurbsel(Nurb *nu)
+int isNurbsel(Nurb *nu)
{
BezTriple *bezt;
BPoint *bp;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 5389db9e2ee..9f2bd6f26f9 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -700,50 +700,6 @@ void FONT_OT_style_toggle(wmOperatorType *ot)
RNA_def_enum(ot->srna, "style", style_items, CU_BOLD, "Style", "Style to set selection to.");
}
-/******************* set material operator ********************/
-
-static int set_material_exec(bContext *C, wmOperator *op)
-{
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
- Curve *cu= obedit->data;
- EditFont *ef= cu->editfont;
- int i, mat_nr, selstart, selend;
-
- if(!BKE_font_getselection(obedit, &selstart, &selend))
- return OPERATOR_CANCELLED;
-
- if(RNA_property_is_set(op->ptr, "index"))
- mat_nr= RNA_int_get(op->ptr, "index");
- else
- mat_nr= obedit->actcol;
-
- for(i=selstart; i<=selend; i++)
- ef->textbufinfo[i].mat_nr = mat_nr;
-
- DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-
- return OPERATOR_FINISHED;
-}
-
-void FONT_OT_material_set(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Set Material";
- ot->idname= "FONT_OT_material_set";
-
- /* api callbacks */
- ot->exec= set_material_exec;
- ot->poll= ED_operator_editfont;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* properties */
- RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Material Index", "Material slot index.", 0, INT_MAX);
-}
-
/******************* copy text operator ********************/
static void copy_selection(Object *obedit)
diff --git a/source/blender/editors/datafiles/Bfont.c b/source/blender/editors/datafiles/Bfont.c
index 4080a0d369f..cd45debcbe4 100644
--- a/source/blender/editors/datafiles/Bfont.c
+++ b/source/blender/editors/datafiles/Bfont.c
@@ -1,6 +1,6 @@
/* DataToC output of file <Bfont> */
/*
- * $Id: Bfont.c 125 2002-11-25 12:02:15Z mein $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/datafiles/Makefile b/source/blender/editors/datafiles/Makefile
index 4162125623e..d7bb4e7222f 100644
--- a/source/blender/editors/datafiles/Makefile
+++ b/source/blender/editors/datafiles/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/gpencil/Makefile b/source/blender/editors/gpencil/Makefile
index f4c1cd246f4..9bc5f491a83 100644
--- a/source/blender/editors/gpencil/Makefile
+++ b/source/blender/editors/gpencil/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index bad86c170ab..c0c1cbc7ac6 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1,5 +1,5 @@
/**
- * $Id: gpencil.c 19758 2009-04-16 13:10:08Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index 014201648c9..c1b3b056d62 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -1,5 +1,5 @@
/**
- * $Id: BIF_gl.h 10455 2007-04-04 13:18:41Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index c619ee80f70..2cebc6a572a 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -30,6 +30,7 @@
struct Base;
struct bContext;
+struct Nurb;
struct Object;
struct Scene;
struct Text;
@@ -52,6 +53,8 @@ void mouse_nurb (struct bContext *C, short mval[2], int extend);
struct Nurb *add_nurbs_primitive(struct bContext *C, int type, int newname);
+int isNurbsel (struct Nurb *nu);;
+
/* editfont.h */
void undo_push_font (struct bContext *C, char *name);
void make_editText (struct Object *obedit);
diff --git a/source/blender/editors/include/ED_fluidsim.h b/source/blender/editors/include/ED_fluidsim.h
index bda879173c3..586f16f42aa 100644
--- a/source/blender/editors/include/ED_fluidsim.h
+++ b/source/blender/editors/include/ED_fluidsim.h
@@ -1,7 +1,7 @@
/**
* BKE_fluidsim.h
*
- * $Id: LBM_fluidsim.h 17433 2008-11-12 21:16:53Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 153b10cf832..d2269300d24 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -1,5 +1,5 @@
/**
- * $Id: BDR_drawaction.h 17579 2008-11-26 11:01:56Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index fbb469f8d43..9d063910aa9 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -1,5 +1,5 @@
/**
- * $Id: BIF_keyframing.h 17216 2008-10-29 11:20:02Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -178,9 +178,9 @@ void ANIM_OT_remove_driver_button(struct wmOperatorType *ot);
/* Auto-Keying macros for use by various tools */
/* check if auto-keyframing is enabled (per scene takes presidence) */
-#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
+#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
/* check the mode for auto-keyframing (per scene takes presidence) */
-#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
+#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
/* check if a flag is set for auto-keyframing (as userprefs only!) */
#define IS_AUTOKEY_FLAG(flag) (U.autokey_flag & AUTOKEY_FLAG_##flag)
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 6dff4ee6ca4..937f6384f6a 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -147,6 +147,9 @@ int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short r
void EM_hide_mesh(struct EditMesh *em, int swap);
void EM_reveal_mesh(struct EditMesh *em);
+void EM_select_by_material(struct EditMesh *em, int index);
+void EM_deselect_by_material(struct EditMesh *em, int index);
+
/* editface.c */
struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index 0e5d7302837..43cb5053f48 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -1,5 +1,5 @@
/*
- * $Id: ED_editparticle.h $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/include/ED_pointcache.h b/source/blender/editors/include/ED_pointcache.h
index 7bf51d9d53d..dc50e274fa9 100644
--- a/source/blender/editors/include/ED_pointcache.h
+++ b/source/blender/editors/include/ED_pointcache.h
@@ -1,5 +1,5 @@
/*
- * $Id: ED_editparticle.h $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index a38dfd93c30..602e94838b7 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -74,8 +74,8 @@ DEF_ICON(ICON_CHECKBOX_DEHLT)
DEF_ICON(ICON_CHECKBOX_HLT)
DEF_ICON(ICON_UNLOCKED)
DEF_ICON(ICON_LOCKED)
-DEF_ICON(ICON_PINNED)
DEF_ICON(ICON_UNPINNED)
+DEF_ICON(ICON_PINNED)
DEF_ICON(ICON_BLANK015)
DEF_ICON(ICON_RIGHTARROW)
DEF_ICON(ICON_DOWNARROW_HLT)
@@ -658,12 +658,12 @@ DEF_ICON(ICON_SNAP_VERTEX)
DEF_ICON(ICON_SNAP_EDGE)
DEF_ICON(ICON_SNAP_FACE)
DEF_ICON(ICON_SNAP_VOLUME)
+DEF_ICON(ICON_UVS_FACE)
DEF_ICON(ICON_STICKY_UVS_LOC)
DEF_ICON(ICON_STICKY_UVS_DISABLE)
DEF_ICON(ICON_STICKY_UVS_VERT)
DEF_ICON(ICON_CLIPUV_DEHLT)
DEF_ICON(ICON_CLIPUV_HLT)
-DEF_ICON(ICON_BLANK219)
DEF_ICON(ICON_SNAP_PEEL_OBJECT)
DEF_ICON(ICON_BLANK221)
DEF_ICON(ICON_GRID)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 62469686e7f..f5e2b45d41e 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -53,6 +53,8 @@ struct uiStyle;
struct uiFontStyle;
struct ColorBand;
struct CurveMapping;
+struct Image;
+struct ImageUser;
typedef struct uiBut uiBut;
typedef struct uiBlock uiBlock;
@@ -415,7 +417,7 @@ void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *
void uiBlockColorbandButtons(struct uiBlock *block, struct ColorBand *coba, struct rctf *butr, int event);
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2);
-void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr);
+void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr, int columns);
/* Links
*
@@ -452,7 +454,7 @@ typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, char *str,
typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
/* use inside searchfunc to add items */
-int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin);
+int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid);
/* bfunc gets search item *poin as arg2, or if NULL the old string */
void uiButSetSearchFunc (uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc);
/* height in pixels, it's using hardcoded values still */
@@ -614,6 +616,8 @@ void uiTemplatePreview(uiLayout *layout, struct ID *id);
void uiTemplateColorRamp(uiLayout *layout, struct ColorBand *coba, int expand);
void uiTemplateCurveMapping(uiLayout *layout, struct CurveMapping *cumap, int type);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname);
+void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
+void uiTemplateList(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *activeprop, int items);
/* items */
void uiItemO(uiLayout *layout, char *name, int icon, char *opname);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 7168e593a8a..1ae3634c73b 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -1,5 +1,5 @@
/**
- * $Id: UI_resources.h 13057 2007-12-30 12:08:28Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/interface/Makefile b/source/blender/editors/interface/Makefile
index dfc8187de49..a3d0692f1e1 100644
--- a/source/blender/editors/interface/Makefile
+++ b/source/blender/editors/interface/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 5ffc6440dc4..73425eac0e1 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1,5 +1,5 @@
/**
- * $Id: interface.c 16882 2008-10-02 12:29:45Z ton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -671,7 +671,8 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
/* widgets */
for(but= block->buttons.first; but; but= but->next) {
ui_but_to_pixelrect(&rect, ar, block, but);
- ui_draw_but(C, ar, &style, but, &rect);
+ if(!(but->flag & UI_HIDDEN))
+ ui_draw_but(C, ar, &style, but, &rect);
}
/* restore matrix */
@@ -1281,17 +1282,13 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
else if(type == PROP_POINTER) {
/* RNA pointer */
PointerRNA ptr= RNA_property_pointer_get(&but->rnapoin, but->rnaprop);
- PropertyRNA *nameprop;
-
- if(ptr.data && (nameprop = RNA_struct_name_property(ptr.type)))
- buf= RNA_property_string_get_alloc(&ptr, nameprop, str, maxlen);
- else
- BLI_strncpy(str, "", maxlen);
+ buf= RNA_struct_name_get_alloc(&ptr, str, maxlen);
}
- else
- BLI_strncpy(str, "", maxlen);
- if(buf && buf != str) {
+ if(!buf) {
+ BLI_strncpy(str, "", maxlen);
+ }
+ else if(buf && buf != str) {
/* string was too long, we have to truncate */
BLI_strncpy(str, buf, maxlen);
MEM_freeN(buf);
@@ -1339,20 +1336,14 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
static void ui_rna_ID_collection(bContext *C, uiBut *but, PointerRNA *ptr, PropertyRNA **prop)
{
- CollectionPropertyIterator iter;
- PropertyRNA *iterprop, *iprop;
StructRNA *srna;
/* look for collection property in Main */
RNA_pointer_create(NULL, &RNA_Main, CTX_data_main(C), ptr);
- iterprop= RNA_struct_iterator_property(ptr->type);
- RNA_property_collection_begin(ptr, iterprop, &iter);
*prop= NULL;
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- iprop= iter.ptr.data;
-
+ RNA_STRUCT_BEGIN(ptr, iprop) {
/* if it's a collection and has same pointer type, we've got it */
if(RNA_property_type(iprop) == PROP_COLLECTION) {
srna= RNA_property_pointer_type(ptr, iprop);
@@ -1363,8 +1354,7 @@ static void ui_rna_ID_collection(bContext *C, uiBut *but, PointerRNA *ptr, Prope
}
}
}
-
- RNA_property_collection_end(&iter);
+ RNA_STRUCT_END;
}
/* autocomplete callback for RNA pointers */
@@ -1372,9 +1362,8 @@ static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but)
{
uiBut *but= arg_but;
AutoComplete *autocpl;
- CollectionPropertyIterator iter;
PointerRNA ptr;
- PropertyRNA *prop, *nameprop;
+ PropertyRNA *prop;
char *name;
if(str[0]==0) return;
@@ -1384,22 +1373,19 @@ static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but)
if(prop==NULL) return;
autocpl= autocomplete_begin(str, ui_get_but_string_max_length(but));
- RNA_property_collection_begin(&ptr, prop, &iter);
/* loop over items in collection */
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- if(iter.ptr.data && (nameprop = RNA_struct_name_property(iter.ptr.type))) {
- name= RNA_property_string_get_alloc(&iter.ptr, nameprop, NULL, 0);
-
- if(name) {
- /* test item name */
- autocomplete_do_name(autocpl, name);
- MEM_freeN(name);
- }
+ RNA_PROP_BEGIN(&ptr, itemptr, prop) {
+ name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
+
+ /* test item name */
+ if(name) {
+ autocomplete_do_name(autocpl, name);
+ MEM_freeN(name);
}
}
+ RNA_PROP_END;
- RNA_property_collection_end(&iter);
autocomplete_end(autocpl, str);
}
@@ -2753,7 +2739,7 @@ void uiBlockFlipOrder(uiBlock *block)
uiBut *but, *next;
float centy, miny=10000, maxy= -10000;
- if(!(U.uiflag & USER_DIRECTIONALORDER))
+ if(U.uiflag & USER_MENUFIXEDORDER)
return;
for(but= block->buttons.first; but; but= but->next) {
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 6d6d4ab9299..8400fee0c55 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1,5 +1,5 @@
/**
- * $Id: interface_draw.c 15733 2008-07-24 09:23:13Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index fb5afbf5e36..2382af53a11 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -404,7 +404,15 @@ static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
{
+ uiBut *bt;
+
ui_set_but_val(but, but->hardmax);
+
+ /* states of other row buttons */
+ for(bt= block->buttons.first; bt; bt= bt->next)
+ if(bt!=but && bt->poin==but->poin && bt->type==ROW)
+ ui_check_but(bt);
+
ui_apply_but_func(C, but);
data->retval= but->retval;
@@ -738,11 +746,8 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
ui_apply_but_ROW(C, block, but, data);
break;
case SCROLL:
- break;
case NUM:
case NUMABS:
- ui_apply_but_NUM(C, but, data);
- break;
case SLI:
case NUMSLI:
ui_apply_but_NUM(C, but, data);
@@ -1433,7 +1438,6 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
}
else if(inbox) {
- printf("release inside \n");
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
}
@@ -2053,6 +2057,11 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
if(but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0*but->aspect);
else if(but->type==HSVSLI) deler= ((but->x2-but->x1)/2 - 5.0*but->aspect);
+ else if(but->type==SCROLL) {
+ int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
+ float size= (horizontal)? (but->x2-but->x1): -(but->y2-but->y1);
+ deler= size*(but->softmax - but->softmin)/(but->softmax - but->softmin + but->a1);
+ }
else deler= (but->x2-but->x1- 5.0*but->aspect);
f= (float)(mx-data->dragstartx)/deler + data->dragfstart;
@@ -2223,6 +2232,54 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
return retval;
}
+static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+{
+ int mx, my, click= 0;
+ int retval= WM_UI_HANDLER_CONTINUE;
+ int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
+
+ mx= event->x;
+ my= event->y;
+ ui_window_to_block(data->region, block, &mx, &my);
+
+ if(data->state == BUTTON_STATE_HIGHLIGHT) {
+ if(event->val==KM_PRESS) {
+ if(event->type == LEFTMOUSE) {
+ if(horizontal) {
+ data->dragstartx= mx;
+ data->draglastx= mx;
+ }
+ else {
+ data->dragstartx= my;
+ data->draglastx= my;
+ }
+ button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
+ retval= WM_UI_HANDLER_BREAK;
+ }
+ else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ click= 1;
+ }
+ }
+ else if(data->state == BUTTON_STATE_NUM_EDITING) {
+ if(event->type == ESCKEY) {
+ data->cancel= 1;
+ data->escapecancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ }
+ else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ }
+ else if(event->type == MOUSEMOVE) {
+ if(ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my))
+ ui_numedit_apply(C, block, but, data);
+ }
+
+ retval= WM_UI_HANDLER_BREAK;
+ }
+
+ return retval;
+}
+
static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
@@ -3065,13 +3122,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
case OPTIONN:
retval= ui_do_but_TOG(C, but, data, event);
break;
-#if 0
case SCROLL:
- /* DrawBut(b, 1); */
- /* do_scrollbut(b); */
- /* DrawBut(b,0); */
+ retval= ui_do_but_SCROLL(C, block, but, data, event);
break;
-#endif
case NUM:
case NUMABS:
retval= ui_do_but_NUM(C, block, but, data, event);
@@ -3232,7 +3285,8 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
for(but=block->buttons.first; but; but= but->next) {
if(ELEM3(but->type, LABEL, ROUNDBOX, SEPR))
continue;
-
+ if(but->flag & UI_HIDDEN)
+ continue;
if(ui_but_contains_pt(but, mx, my))
/* give precedence to already activated buttons */
if(!butover || (!butover->active && but->active))
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 3aed2a7c299..379c11a6f31 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -1,5 +1,5 @@
/**
- * $Id: interface.h 14444 2008-04-16 22:40:48Z hos $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -50,6 +50,9 @@ struct bContextStore;
/* visual types for drawing */
/* for time being separated from functional types */
typedef enum {
+ /* default */
+ UI_WTYPE_REGULAR,
+
/* standard set */
UI_WTYPE_LABEL,
UI_WTYPE_TOGGLE,
@@ -78,7 +81,8 @@ typedef enum {
UI_WTYPE_SWATCH,
UI_WTYPE_RGB_PICKER,
UI_WTYPE_NORMAL,
- UI_WTYPE_BOX
+ UI_WTYPE_BOX,
+ UI_WTYPE_SCROLL
} uiWidgetTypeEnum;
@@ -98,7 +102,7 @@ typedef enum {
#define UI_ACTIVE 4
#define UI_HAS_ICON 8
#define UI_TEXTINPUT 16
-
+#define UI_HIDDEN 32
/* warn: rest of uiBut->flag in UI_interface.h */
/* internal panel drawing defines */
@@ -416,7 +420,7 @@ extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *s
struct ThemeUI;
void ui_widget_color_init(struct ThemeUI *tui);
-void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int state);
+void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state);
/* interface_style.c */
void uiStyleInit(void);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 81c49105870..03da6861974 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -601,7 +601,7 @@ void uiItemsEnumO(uiLayout *layout, char *opname, char *propname)
RNA_property_enum_items(&ptr, prop, &item, &totitem);
for(i=0; i<totitem; i++)
- uiItemEnumO(layout, NULL, 0, opname, propname, item[i].value);
+ uiItemEnumO(layout, (char*)item[i].name, item[i].icon, opname, propname, item[i].value);
}
}
@@ -716,6 +716,8 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA
else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
if(type == PROP_BOOLEAN && strcmp(name, "") != 0)
w += UI_UNIT_X;
+ else if(type == PROP_ENUM)
+ w += UI_UNIT_X/2;
}
*r_w= w;
@@ -745,9 +747,11 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
if(!icon)
icon= RNA_property_ui_icon(prop);
- if(ELEM5(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_ENUM, PROP_POINTER))
+ if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
name= ui_item_name_add_colon(name, namestr);
- if(type == PROP_BOOLEAN && len)
+ else if(type == PROP_BOOLEAN && len)
+ name= ui_item_name_add_colon(name, namestr);
+ else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
name= ui_item_name_add_colon(name, namestr);
if(layout->root->type == UI_LAYOUT_MENU) {
@@ -1267,7 +1271,6 @@ static void ui_litem_layout_box(uiLayout *litem)
h= litem->h;
litem->x += style->boxspace;
- litem->y -= style->boxspace;
if(w != 0) litem->w -= 2*style->boxspace;
if(h != 0) litem->h -= 2*style->boxspace;
@@ -1348,6 +1351,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
}
}
+ litem->w= x;
litem->h= litem->y - miny;
}
@@ -1453,9 +1457,9 @@ static void ui_litem_layout_free(uiLayout *litem)
totw -= minx;
toth -= miny;
- if(litem->w && totw > litem->w)
+ if(litem->w && totw > 0)
scalex= (float)litem->w/(float)totw;
- if(litem->h && toth > litem->h)
+ if(litem->h && toth > 0)
scaley= (float)litem->h/(float)toth;
x= litem->x;
@@ -1466,15 +1470,15 @@ static void ui_litem_layout_free(uiLayout *litem)
ui_item_size(item, &itemw, &itemh);
if(scalex != 1.0f) {
- newx= itemx*scalex;
- itemw= (itemx + itemw)*scalex - newx;
- itemx= newx;
+ newx= (itemx - minx)*scalex;
+ itemw= (itemx - minx + itemw)*scalex - newx;
+ itemx= minx + newx;
}
if(scaley != 1.0f) {
- newy= itemy*scaley;
- itemh= (itemy + itemh)*scaley - newy;
- itemy= newy;
+ newy= (itemy - miny)*scaley;
+ itemh= (itemy - miny + itemh)*scaley - newy;
+ itemy= miny + newy;
}
ui_item_position(item, x+itemx-minx, y+itemy-miny, itemw, itemh);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 32bcae77e6b..a1dae39d687 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -40,6 +40,7 @@
#include "BLI_dynstr.h"
#include "BKE_context.h"
+#include "BKE_icons.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_texture.h"
@@ -181,7 +182,7 @@ MenuData *decompose_menu_string(char *str)
*s= '\0';
s++;
}
- } else if (c=='|' || c=='\0') {
+ } else if (c=='|' || c == '\n' || c=='\0') {
if (nitem) {
*s= '\0';
@@ -433,7 +434,7 @@ struct uiSearchItems {
char **names;
void **pointers;
-
+ int *icons;
};
typedef struct uiSearchboxData {
@@ -448,7 +449,7 @@ typedef struct uiSearchboxData {
/* exported for use by search callbacks */
/* returns zero if nothing to add */
-int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin)
+int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid)
{
if(items->totitem>=items->maxitem) {
@@ -464,6 +465,7 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin)
BLI_strncpy(items->names[items->totitem], name, items->maxstrlen);
items->pointers[items->totitem]= poin;
+ items->icons[items->totitem]= iconid;
items->totitem++;
@@ -639,7 +641,8 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
for(a=0; a<data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
- ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], (a+1)==data->active?UI_ACTIVE:0);
+ /* widget itself */
+ ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a+1)==data->active?UI_ACTIVE:0);
}
/* indicate more */
@@ -666,6 +669,7 @@ static void ui_searchbox_region_free(ARegion *ar)
MEM_freeN(data->items.names[a]);
MEM_freeN(data->items.names);
MEM_freeN(data->items.pointers);
+ MEM_freeN(data->items.icons);
MEM_freeN(data);
ar->regiondata= NULL;
@@ -794,6 +798,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
data->items.totitem= 0;
data->items.names= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search names");
data->items.pointers= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search pointers");
+ data->items.icons= MEM_callocN(SEARCH_ITEMS*sizeof(int), "search icons");
for(x1=0; x1<SEARCH_ITEMS; x1++)
data->items.names[x1]= MEM_callocN(but->hardmax+1, "search pointers");
@@ -1720,24 +1725,118 @@ static void do_picker_small_cb(bContext *C, void *bt1, void *hsv1)
popup->menuretval= UI_RETURN_UPDATE;
}
+/* picker sizes S hsize, F full size, D spacer, B button/pallette height */
+#define SPICK1 150.0
+#define DPICK1 6.0
-/* only the color, a circle, slider */
-void uiBlockPickerSmall(uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval)
+/* only the color, a HS circle and V slider */
+static void uiBlockPickerSmall(uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval)
{
uiBut *bt;
VECCOPY(old, col); // old color stored there, for palette_cb to work
/* HS circle */
- bt= uiDefButF(block, HSVCIRCLE, retval, "", 0, 0,SPICK,SPICK, col, 0.0, 0.0, 0, 0, "");
+ bt= uiDefButF(block, HSVCIRCLE, retval, "", 0, 0,SPICK1,SPICK1, col, 0.0, 0.0, 0, 0, "");
+ uiButSetFunc(bt, do_picker_small_cb, bt, hsv);
+
+ /* value */
+ bt= uiDefButF(block, HSVCUBE, retval, "", SPICK1+DPICK1,0,14,SPICK1, col, 0.0, 0.0, 4, 0, "");
uiButSetFunc(bt, do_picker_small_cb, bt, hsv);
+}
+
+
+static void picker_new_hide_reveal(uiBlock *block, short colormode)
+{
+ uiBut *bt;
+
+ /* tag buttons */
+ for(bt= block->buttons.first; bt; bt= bt->next) {
+
+ if(bt->type==NUMSLI || bt->type==TEX) {
+ if( bt->str[1]=='e') {
+ if(colormode==2) bt->flag &= ~UI_HIDDEN;
+ else bt->flag |= UI_HIDDEN;
+ }
+ else if( ELEM3(bt->str[0], 'R', 'G', 'B')) {
+ if(colormode==0) bt->flag &= ~UI_HIDDEN;
+ else bt->flag |= UI_HIDDEN;
+ }
+ else if( ELEM3(bt->str[0], 'H', 'S', 'V')) {
+ if(colormode==1) bt->flag &= ~UI_HIDDEN;
+ else bt->flag |= UI_HIDDEN;
+ }
+ }
+ }
+}
+
+static void do_picker_new_mode_cb(bContext *C, void *bt1, void *colv)
+{
+ uiBut *bt= bt1;
+ short colormode= ui_get_but_val(bt);
+
+ picker_new_hide_reveal(bt->block, colormode);
+}
+
+/* a HS circle, V slider, rgb/hsv/hex sliders */
+static void uiBlockPickerNew(uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval)
+{
+ static short colormode= 0; /* temp? 0=rgb, 1=hsv, 2=hex */
+ uiBut *bt;
+ int width;
+
+ VECCOPY(old, col); // old color stored there, for palette_cb to work
+
+ /* HS circle */
+ bt= uiDefButF(block, HSVCIRCLE, retval, "", 0, 0,SPICK1,SPICK1, col, 0.0, 0.0, 0, 0, "");
+ uiButSetFunc(bt, do_picker_small_cb, bt, hsv);
+
/* value */
- bt= uiDefButF(block, HSVCUBE, retval, "", SPICK+DPICK,0,14,SPICK, col, 0.0, 0.0, 4, 0, "");
+ bt= uiDefButF(block, HSVCUBE, retval, "", SPICK1+DPICK1,0,14,SPICK1, col, 0.0, 0.0, 4, 0, "");
uiButSetFunc(bt, do_picker_small_cb, bt, hsv);
+
+ /* mode */
+ width= (SPICK1+DPICK1+14)/3;
+ uiBlockBeginAlign(block);
+ bt= uiDefButS(block, ROW, retval, "RGB", 0, -30, width, 19, &colormode, 0.0, 0.0, 0, 0, "");
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, col);
+ bt= uiDefButS(block, ROW, retval, "HSV", width, -30, width, 19, &colormode, 0.0, 1.0, 0, 0, "");
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, hsv);
+ bt= uiDefButS(block, ROW, retval, "Hex", 2*width, -30, width, 19, &colormode, 0.0, 2.0, 0, 0, "");
+ uiButSetFunc(bt, do_picker_new_mode_cb, bt, hexcol);
+ uiBlockEndAlign(block);
+
+ /* sliders or hex */
+ width= (SPICK1+DPICK1+14);
+ rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
+ sprintf(hexcol, "%02X%02X%02X", (unsigned int)(col[0]*255.0), (unsigned int)(col[1]*255.0), (unsigned int)(col[2]*255.0));
+
+ uiBlockBeginAlign(block);
+ bt= uiDefButF(block, NUMSLI, 0, "R ", 0, -60, width, 19, col, 0.0, 1.0, 10, 3, "");
+ uiButSetFunc(bt, do_palette1_cb, bt, hsv);
+ bt= uiDefButF(block, NUMSLI, 0, "G ", 0, -80, width, 19, col+1, 0.0, 1.0, 10, 3, "");
+ uiButSetFunc(bt, do_palette1_cb, bt, hsv);
+ bt= uiDefButF(block, NUMSLI, 0, "B ", 0, -100, width, 19, col+2, 0.0, 1.0, 10, 3, "");
+ uiButSetFunc(bt, do_palette1_cb, bt, hsv);
+ uiBlockEndAlign(block);
+
+ uiBlockBeginAlign(block);
+ bt= uiDefButF(block, NUMSLI, 0, "H ", 0, -60, width, 19, hsv, 0.0, 1.0, 10, 3, "");
+ uiButSetFunc(bt, do_palette2_cb, bt, col);
+ bt= uiDefButF(block, NUMSLI, 0, "S ", 0, -80, width, 19, hsv+1, 0.0, 1.0, 10, 3, "");
+ uiButSetFunc(bt, do_palette2_cb, bt, col);
+ bt= uiDefButF(block, NUMSLI, 0, "V ", 0, -100, width, 19, hsv+2, 0.0, 1.0, 10, 3, "");
+ uiButSetFunc(bt, do_palette2_cb, bt, col);
+ uiBlockEndAlign(block);
+
+ bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -80, width, 19, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
+ uiButSetFunc(bt, do_palette_hex_cb, bt, hexcol);
+ picker_new_hide_reveal(block, colormode);
}
+
static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *event)
{
float add= 0.0f;
@@ -1790,13 +1889,22 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu
block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN;
uiBoundsBlock(block, 3);
}
- else {
+ else if(win->eventstate->alt) {
uiBlockPickerSmall(block, handle->retvec, hsvcol, oldcol, hexcol, 'p', 0);
block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_OUT_1;
uiBoundsBlock(block, 10);
block->block_event_func= ui_picker_small_wheel;
- }
+ }
+ else {
+ uiBlockPickerNew(block, handle->retvec, hsvcol, oldcol, hexcol, 'p', 0);
+ block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN;
+ uiBoundsBlock(block, 10);
+
+ block->block_event_func= ui_picker_small_wheel;
+ }
+
+
/* and lets go */
block->direction= UI_TOP;
@@ -2464,7 +2572,6 @@ static uiPopupBlockHandle *ui_pup_menu(bContext *C, int maxrow, uiMenuHandleFunc
return menu;
}
-
static void operator_name_cb(bContext *C, void *arg, int retval)
{
const char *opname= arg;
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 831a8a5bf6c..e8fba38f793 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -92,6 +92,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->paneltitle.uifont_id= UIFONT_DEFAULT;
style->paneltitle.points= 13;
style->paneltitle.kerning= 0.0;
+ style->paneltitle.overlap= 0;
style->paneltitle.shadow= 5;
style->paneltitle.shadx= 2;
style->paneltitle.shady= -2;
@@ -101,6 +102,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->grouplabel.uifont_id= UIFONT_DEFAULT;
style->grouplabel.points= 12;
style->grouplabel.kerning= 0.0;
+ style->grouplabel.overlap= 0;
style->grouplabel.shadow= 3;
style->grouplabel.shadx= 1;
style->grouplabel.shady= -1;
@@ -109,6 +111,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->widgetlabel.uifont_id= UIFONT_DEFAULT;
style->widgetlabel.points= 11;
style->widgetlabel.kerning= 0.0;
+ style->widgetlabel.overlap= 0;
style->widgetlabel.shadow= 3;
style->widgetlabel.shadx= 1;
style->widgetlabel.shady= -1;
@@ -145,22 +148,6 @@ static uiFont *uifont_to_blfont(int id)
/* *************** draw ************************ */
-static void ui_font_shadow_draw(uiFontStyle *fs, int x, int y, char *str)
-{
- float color[4];
-
- glGetFloatv(GL_CURRENT_COLOR, color);
-
- glColor4f(fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha);
-
- BLF_blur(fs->shadow);
- BLF_position(x+fs->shadx, y+fs->shady, 0.0f);
- BLF_draw(str);
- BLF_blur(0);
-
- glColor4fv(color);
-}
-
void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
{
float height;
@@ -179,14 +166,23 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
/* clip is very strict, so we give it some space */
BLF_clipping(rect->xmin-1, rect->ymin-4, rect->xmax+1, rect->ymax+4);
BLF_enable(BLF_CLIPPING);
-
- if(fs->shadow)
- ui_font_shadow_draw(fs, rect->xmin+xofs, rect->ymin+yofs, str);
-
BLF_position(rect->xmin+xofs, rect->ymin+yofs, 0.0f);
- BLF_draw(str);
+ if (fs->shadow) {
+ BLF_enable(BLF_SHADOW);
+ BLF_shadow(fs->shadow, fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha);
+ BLF_shadow_offset(fs->shadx, fs->shady);
+ }
+
+ if (fs->overlap)
+ BLF_enable(BLF_OVERLAP_CHAR);
+
+ BLF_draw(str);
BLF_disable(BLF_CLIPPING);
+ if (fs->shadow)
+ BLF_disable(BLF_SHADOW);
+ if (fs->overlap)
+ BLF_disable(BLF_OVERLAP_CHAR);
}
/* ************** helpers ************************ */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a0ee264cf01..dd87ee15474 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -27,9 +27,12 @@
#include "MEM_guardedalloc.h"
+#include "DNA_screen_types.h"
+
#include "BLI_string.h"
#include "BKE_context.h"
+#include "BKE_icons.h"
#include "BKE_library.h"
#include "BKE_utildefines.h"
@@ -146,9 +149,24 @@ static void id_search_cb(const struct bContext *C, void *arg_litem, char *str, u
ID *id;
for(id= lb->first; id; id= id->next) {
+ int iconid= 0;
+
+ /* icon */
+ switch(GS(id->name))
+ {
+ case ID_MA: /* fall through */
+ case ID_TE: /* fall through */
+ case ID_IM: /* fall through */
+ case ID_WO: /* fall through */
+ case ID_LA: /* fall through */
+ iconid= BKE_icon_getid(id);
+ break;
+ default:
+ break;
+ }
if(BLI_strcasestr(id->name+2, str)) {
- if(0==uiSearchItemAdd(items, id->name+2, id))
+ if(0==uiSearchItemAdd(items, id->name+2, id, iconid))
break;
}
}
@@ -362,6 +380,15 @@ static void modifiers_del(bContext *C, void *ob_v, void *md_v)
BKE_reports_clear(&reports);
}
+static void modifiers_activate(bContext *C, void *ob_v, void *md_v)
+{
+ Scene *scene= CTX_data_scene(C);
+ Object *ob= ob_v;
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+}
+
static void modifiers_moveUp(bContext *C, void *ob_v, void *md_v)
{
Scene *scene= CTX_data_scene(C);
@@ -555,7 +582,10 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
uiBlockSetEmboss(block, UI_EMBOSSN);
uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, 0, ICON_TRIA_RIGHT, 0, 0, UI_UNIT_X, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier");
}
-
+
+ /* modifier-type icon */
+ uiDefIconBut(block, BUT, 0, RNA_struct_ui_icon(ptr.type), 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Current Modifier Type");
+
uiBlockSetEmboss(block, UI_EMBOSS);
if (isVirtual) {
@@ -566,14 +596,16 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
uiButSetFunc(but, modifiers_convertToReal, ob, md);
} else {
uiBlockBeginAlign(block);
- uiDefBut(block, TEX, 0, "", 0, 0, buttonWidth-60, UI_UNIT_Y, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name");
+ uiDefBut(block, TEX, 0, "", 0, 0, buttonWidth-40, UI_UNIT_Y, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name");
/* Softbody not allowed in this situation, enforce! */
if (((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface)) {
uiDefIconButBitI(block, TOG, eModifierMode_Render, 0, ICON_SCENE, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering");
but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, 0, ICON_VIEW3D, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display");
+ uiButSetFunc(but, modifiers_activate, ob, md);
if (mti->flags&eModifierTypeFlag_SupportsEditmode) {
- uiDefIconButBitI(block, TOG, eModifierMode_Editmode, 0, ICON_EDITMODE_HLT, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)");
+ but= uiDefIconButBitI(block, TOG, eModifierMode_Editmode, 0, ICON_EDITMODE_HLT, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)");
+ uiButSetFunc(but, modifiers_activate, ob, md);
}
}
uiBlockEndAlign(block);
@@ -1490,3 +1522,149 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, char *propname)
}
}
}
+
+
+/************************* List Template **************************/
+
+typedef struct ListItem {
+ PointerRNA ptr;
+ PropertyRNA *prop;
+ PropertyRNA *activeprop;
+
+ PointerRNA activeptr;
+ int activei;
+
+ int selected;
+} ListItem;
+
+static void list_item_cb(bContext *C, void *arg_item, void *arg_unused)
+{
+ ListItem *item= (ListItem*)arg_item;
+ PropertyType activetype;
+ char *activename;
+
+ if(item->selected) {
+ activetype= RNA_property_type(item->activeprop);
+
+ if(activetype == PROP_POINTER)
+ RNA_property_pointer_set(&item->ptr, item->activeprop, item->activeptr);
+ else if(activetype == PROP_INT)
+ RNA_property_int_set(&item->ptr, item->activeprop, item->activei);
+ else if(activetype == PROP_STRING) {
+ activename= RNA_struct_name_get_alloc(&item->activeptr, NULL, 0);
+ RNA_property_string_set(&item->ptr, item->activeprop, activename);
+ MEM_freeN(activename);
+ }
+ }
+}
+
+void uiTemplateList(uiLayout *layout, PointerRNA *ptr, char *propname, char *activepropname, int items)
+{
+ PropertyRNA *prop, *activeprop;
+ PropertyType type, activetype;
+ PointerRNA activeptr;
+ uiLayout *box, *row, *col;
+ uiBlock *block;
+ uiBut *but;
+ char *name, *activename= NULL;
+ int i= 1, activei= 0, len;
+ static int scroll = 1;
+
+ /* validate arguments */
+ if(!ptr->data)
+ return;
+
+ prop= RNA_struct_find_property(ptr, propname);
+ if(!prop) {
+ printf("uiTemplateList: property not found: %s\n", propname);
+ return;
+ }
+
+ activeprop= RNA_struct_find_property(ptr, activepropname);
+ if(!activeprop) {
+ printf("uiTemplateList: property not found: %s\n", activepropname);
+ return;
+ }
+
+ type= RNA_property_type(prop);
+ if(type != PROP_COLLECTION) {
+ printf("uiTemplateList: expected collection property.\n");
+ return;
+ }
+
+ activetype= RNA_property_type(activeprop);
+ if(!ELEM3(activetype, PROP_POINTER, PROP_INT, PROP_STRING)) {
+ printf("uiTemplateList: expected pointer, integer or string property.\n");
+ return;
+ }
+
+ if(items == 0)
+ items= 5;
+
+ /* get active data */
+ if(activetype == PROP_POINTER)
+ activeptr= RNA_property_pointer_get(ptr, activeprop);
+ else if(activetype == PROP_INT)
+ activei= RNA_property_int_get(ptr, activeprop);
+ else if(activetype == PROP_STRING)
+ activename= RNA_property_string_get_alloc(ptr, activeprop, NULL, 0);
+
+ box= uiLayoutBox(layout);
+ row= uiLayoutRow(box, 0);
+ col = uiLayoutColumn(row, 1);
+
+ block= uiLayoutGetBlock(col);
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+
+ len= RNA_property_collection_length(ptr, prop);
+ scroll= MIN2(scroll, len-items+1);
+ scroll= MAX2(scroll, 1);
+
+ RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ if(i >= scroll && i<scroll+items) {
+ name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
+
+ if(name) {
+ ListItem *item= MEM_callocN(sizeof(ListItem), "uiTemplateList ListItem");
+
+ item->ptr= *ptr;
+ item->prop= prop;
+ item->activeprop= activeprop;
+ item->activeptr= itemptr;
+ item->activei= i;
+
+ if(activetype == PROP_POINTER)
+ item->selected= (activeptr.data == itemptr.data)? i: -1;
+ else if(activetype == PROP_INT)
+ item->selected= (activei == i)? i: -1;
+ else if(activetype == PROP_STRING)
+ item->selected= (strcmp(activename, name) == 0)? i: -1;
+
+ but= uiDefIconTextButI(block, ROW, 0, RNA_struct_ui_icon(itemptr.type), name, 0,0,UI_UNIT_X*10,UI_UNIT_Y, &item->selected, 0, i, 0, 0, "");
+ uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
+ uiButSetNFunc(but, list_item_cb, item, NULL);
+
+ MEM_freeN(name);
+ }
+ }
+
+ i++;
+ }
+ RNA_PROP_END;
+
+ while(i < scroll+items) {
+ if(i >= scroll)
+ uiItemL(col, "", 0);
+ i++;
+ }
+
+ uiBlockSetEmboss(block, UI_EMBOSS);
+
+ if(len > items) {
+ col= uiLayoutColumn(row, 0);
+ uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*0.75,UI_UNIT_Y*items, &scroll, 1, len-items+1, items, 0, "");
+ }
+
+ //uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*15,UI_UNIT_Y*0.75, &scroll, 1, 16-5, 5, 0, "");
+}
+
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index a75a3402774..e67e5b5a871 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -43,6 +43,7 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_idprop.h"
+#include "BKE_icons.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_texture.h"
@@ -120,6 +121,8 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
if(!pptr.type)
pptr.type= RNA_property_pointer_type(ptr, prop);
icon= RNA_struct_ui_icon(pptr.type);
+ if(icon == ICON_DOT)
+ icon= 0;
but= uiDefIconTextButR(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
break;
@@ -139,69 +142,39 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
return but;
}
-void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr)
+void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns)
{
- CollectionPropertyIterator iter;
- PropertyRNA *iterprop, *prop;
- uiLayout *split;
+ uiLayout *split, *col;
char *name;
uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0);
- iterprop= RNA_struct_iterator_property(ptr->type);
- RNA_property_collection_begin(ptr, iterprop, &iter);
-
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- prop= iter.ptr.data;
-
+ RNA_STRUCT_BEGIN(ptr, prop) {
if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
continue;
- split = uiLayoutSplit(layout, 0.5f);
-
name= (char*)RNA_property_ui_name(prop);
- uiItemL(uiLayoutColumn(split, 0), name, 0);
- uiItemFullR(uiLayoutColumn(split, 0), "", 0, ptr, prop, -1, 0, 0, 0, 0);
- }
+ if(columns == 1) {
+ col= uiLayoutColumn(layout, 1);
+ uiItemL(col, name, 0);
+ }
+ else if(columns == 2) {
+ split = uiLayoutSplit(layout, 0.5f);
- RNA_property_collection_end(&iter);
-}
+ uiItemL(uiLayoutColumn(split, 0), name, 0);
+ col= uiLayoutColumn(split, 0);
+ }
-/* temp call, single collumn, test for toolbar only */
-void uiDefAutoButsRNA_single(const bContext *C, uiLayout *layout, PointerRNA *ptr)
-{
- CollectionPropertyIterator iter;
- PropertyRNA *iterprop, *prop;
- uiLayout *col;
- char *name;
-
- uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0);
-
- iterprop= RNA_struct_iterator_property(ptr->type);
- RNA_property_collection_begin(ptr, iterprop, &iter);
-
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- prop= iter.ptr.data;
-
- if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
- continue;
-
- name= (char*)RNA_property_ui_name(prop);
- col= uiLayoutColumn(layout, 1);
- uiItemL(col, name, 0);
-
/* temp hack to show normal button for spin/screw */
if(strcmp(name, "Axis")==0) {
- uiDefButR(uiLayoutGetBlock(layout), BUT_NORMAL, 0, name, 0, 0, 100, 100, ptr, "axis", -1, 0, 0, -1, -1, NULL);
+ uiDefButR(uiLayoutGetBlock(col), BUT_NORMAL, 0, name, 0, 0, 100, 100, ptr, "axis", -1, 0, 0, -1, -1, NULL);
}
else uiItemFullR(col, "", 0, ptr, prop, -1, 0, 0, 0, 0);
}
-
- RNA_property_collection_end(&iter);
+ RNA_STRUCT_END;
}
-
/***************************** ID Utilities *******************************/
/* note, C code version, will be replaced with version in interface_templates.c */
@@ -304,9 +277,25 @@ static void id_search_cb(const struct bContext *C, void *arg_params, char *str,
ID *id;
for(id= params->lb->first; id; id= id->next) {
+ int iconid= 0;
+
+
+ /* icon */
+ switch(GS(id->name))
+ {
+ case ID_MA: /* fall through */
+ case ID_TE: /* fall through */
+ case ID_IM: /* fall through */
+ case ID_WO: /* fall through */
+ case ID_LA: /* fall through */
+ iconid= BKE_icon_getid(id);
+ break;
+ default:
+ break;
+ }
if(BLI_strcasestr(id->name+2, str)) {
- if(0==uiSearchItemAdd(items, id->name+2, id))
+ if(0==uiSearchItemAdd(items, id->name+2, id, iconid))
break;
}
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 14df9026078..735cfe742c6 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -102,6 +102,7 @@ typedef struct uiWidgetBase {
float inner_uv[64][2];
short inner, outline, emboss; /* set on/off */
+ short shadedir;
uiWidgetTrias tria1;
uiWidgetTrias tria2;
@@ -199,6 +200,7 @@ static void widget_init(uiWidgetBase *wtb)
wtb->inner= 1;
wtb->outline= 1;
wtb->emboss= 1;
+ wtb->shadedir= 1;
}
/* helper call, makes shadow rect, with 'sun' above menu, so only shadow to left/right/bottom */
@@ -583,7 +585,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glShadeModel(GL_SMOOTH);
glBegin(GL_POLYGON);
for(a=0; a<wtb->totvert; a++) {
- round_box_shade_col4(col1, col2, wtb->inner_uv[a][1]);
+ round_box_shade_col4(col1, col2, wtb->inner_uv[a][wtb->shadedir]);
glVertex2fv(wtb->inner_v[a]);
}
glEnd();
@@ -1088,6 +1090,32 @@ static struct uiWidgetColors wcol_box= {
0, 0
};
+static struct uiWidgetColors wcol_toggle= {
+ {25, 25, 25, 255},
+ {153, 153, 153, 255},
+ {100, 100, 100, 255},
+ {25, 25, 25, 255},
+
+ {0, 0, 0, 255},
+ {255, 255, 255, 255},
+
+ 0,
+ 0, 0
+};
+
+static struct uiWidgetColors wcol_scroll= {
+ {25, 25, 25, 255},
+ {180, 180, 180, 255},
+ {153, 153, 153, 255},
+ {90, 90, 90, 255},
+
+ {0, 0, 0, 255},
+ {255, 255, 255, 255},
+
+ 1,
+ 0, -20
+};
+
/* free wcol struct to play with */
static struct uiWidgetColors wcol_tmp= {
{0, 0, 0, 255},
@@ -1109,9 +1137,10 @@ void ui_widget_color_init(ThemeUI *tui)
tui->wcol_regular= wcol_regular;
tui->wcol_tool= wcol_tool;
- tui->wcol_radio= wcol_radio;
tui->wcol_text= wcol_text;
+ tui->wcol_radio= wcol_radio;
tui->wcol_option= wcol_option;
+ tui->wcol_toggle= wcol_toggle;
tui->wcol_num= wcol_num;
tui->wcol_numslider= wcol_numslider;
tui->wcol_menu= wcol_menu;
@@ -1119,6 +1148,7 @@ void ui_widget_color_init(ThemeUI *tui)
tui->wcol_menu_back= wcol_menu_back;
tui->wcol_menu_item= wcol_menu_item;
tui->wcol_box= wcol_box;
+ tui->wcol_scroll= wcol_scroll;
}
/* ************ button callbacks, state ***************** */
@@ -1602,6 +1632,75 @@ void ui_draw_link_bezier(rcti *rect)
}
}
+static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+{
+ uiWidgetBase wtb;
+ rcti rect1;
+ double value;
+ char inner[3];
+ float fac, size, rad;
+ int horizontal;
+
+ /* determine horizontal/vertical */
+ horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
+
+ if(horizontal)
+ rad= 0.5f*(rect->ymax - rect->ymin);
+ else
+ rad= 0.5f*(rect->xmax - rect->xmin);
+
+ widget_init(&wtb);
+ wtb.shadedir= (horizontal)? 1: 0;
+
+ /* draw back part, colors swapped and shading inverted */
+ VECCOPY(inner, wcol->inner);
+ VECCOPY(wcol->inner, wcol->item);
+ if(horizontal)
+ SWAP(short, wcol->shadetop, wcol->shadedown);
+ if(state & UI_SELECT)
+ SWAP(short, wcol->shadetop, wcol->shadedown);
+
+ round_box_edges(&wtb, roundboxalign, rect, rad); /* XXX vertical gradient is wrong */
+ widgetbase_draw(&wtb, wcol);
+
+ VECCOPY(wcol->inner, inner);
+ if(horizontal)
+ SWAP(short, wcol->shadetop, wcol->shadedown);
+ if(state & UI_SELECT)
+ SWAP(short, wcol->shadetop, wcol->shadedown);
+
+ /* front part */
+ value= ui_get_but_val(but);
+
+ size= (but->softmax + but->a1 - but->softmin);
+ size= MAX2(size, 2);
+
+ /* position */
+ rect1= *rect;
+
+ if(horizontal) {
+ fac= (rect->xmax - rect->xmin)/(size-1);
+ rect1.xmin= rect1.xmin + ceil(fac*(value - but->softmin));
+ rect1.xmax= rect1.xmin + ceil(fac*(but->a1 - but->softmin));
+ }
+ else {
+ fac= (rect->ymax - rect->ymin)/(size-1);
+ rect1.ymax= rect1.ymax - ceil(fac*(value - but->softmin));
+ rect1.ymin= rect1.ymax - ceil(fac*(but->a1 - but->softmin));
+ }
+
+ /* draw */
+ wtb.emboss= 0; /* only emboss once */
+
+ if(!horizontal)
+ SWAP(short, wcol->shadetop, wcol->shadedown);
+
+ round_box_edges(&wtb, roundboxalign, &rect1, rad); /* XXX vertical gradient is wrong */
+ widgetbase_draw(&wtb, wcol);
+
+ if(!horizontal)
+ SWAP(short, wcol->shadetop, wcol->shadedown);
+}
static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
@@ -1896,12 +1995,16 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
wt.text= widget_draw_text_icon;
switch(type) {
+ case UI_WTYPE_REGULAR:
+ break;
+
case UI_WTYPE_LABEL:
wt.draw= NULL;
wt.state= widget_state_label;
break;
case UI_WTYPE_TOGGLE:
+ wt.wcol_theme= &btheme->tui.wcol_toggle;
break;
case UI_WTYPE_OPTION:
@@ -1914,7 +2017,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
wt.wcol_theme= &btheme->tui.wcol_radio;
wt.draw= widget_radiobut;
break;
-
+
case UI_WTYPE_NUMBER:
wt.wcol_theme= &btheme->tui.wcol_num;
wt.draw= widget_numbut;
@@ -1995,6 +2098,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
case UI_WTYPE_NORMAL:
break;
+
+ case UI_WTYPE_SCROLL:
+ wt.wcol_theme= &btheme->tui.wcol_scroll;
+ wt.custom= widget_scroll;
+ break;
}
return &wt;
@@ -2089,6 +2197,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case BUT:
wt= widget_type(UI_WTYPE_EXEC);
break;
+
case NUM:
wt= widget_type(UI_WTYPE_NUMBER);
break;
@@ -2184,9 +2293,13 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case BUT_CURVE:
ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect);
break;
-
+
+ case SCROLL:
+ wt= widget_type(UI_WTYPE_SCROLL);
+ break;
+
default:
- wt= widget_type(UI_WTYPE_TOGGLE);
+ wt= widget_type(UI_WTYPE_REGULAR);
}
}
@@ -2195,6 +2308,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
int roundboxalign, state;
roundboxalign= widget_roundbox_set(but, rect);
+
state= but->flag;
if(but->editstr) state |= UI_TEXTINPUT;
@@ -2242,7 +2356,7 @@ void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect)
/* helper call to draw a menu item without button */
/* state: UI_ACTIVE or 0 */
-void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int state)
+void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state)
{
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
rcti _rect= *rect;
@@ -2256,6 +2370,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int state)
/* text location offset */
rect->xmin+=5;
+ if(iconid) rect->xmin+= ICON_HEIGHT;
/* cut string in 2 parts? */
cpoin= strchr(name, '|');
@@ -2278,5 +2393,12 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int state)
/* restore rect, was messed with */
*rect= _rect;
+ if(iconid) {
+ int xs= rect->xmin+4;
+ int ys= 1 + (rect->ymin+rect->ymax- ICON_HEIGHT)/2;
+ glEnable(GL_BLEND);
+ UI_icon_draw_aspect_blended(xs, ys, iconid, 1.2f, 0); /* XXX scale weak get from fstyle? */
+ glDisable(GL_BLEND);
+ }
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index af68c5e6b25..4b2d5af956d 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1,5 +1,5 @@
/**
- * $Id: resources.c 12755 2007-12-02 05:50:38Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/mesh/Makefile b/source/blender/editors/mesh/Makefile
index 650771519cd..8ae40e1b957 100644
--- a/source/blender/editors/mesh/Makefile
+++ b/source/blender/editors/mesh/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index dd003d103d5..7f5201f4704 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -841,7 +841,7 @@ void make_editMesh(Scene *scene, Object *ob)
em= me->edit_mesh;
- em->selectmode= scene->selectmode; // warning needs to be synced
+ em->selectmode= scene->toolsettings->selectmode; // warning needs to be synced
em->act_face = NULL;
em->totvert= tot= me->totvert;
em->totedge= me->totedge;
@@ -1556,7 +1556,7 @@ static int mesh_separate_material(Scene *scene, Base *editbase)
/* clear selection, we're going to use that to select material group */
EM_clear_flag_all(em, SELECT);
/* select the material */
- editmesh_select_by_material(em, curr_mat);
+ EM_select_by_material(em, curr_mat);
/* and now separate */
if(0==mesh_separate_selected(scene, editbase)) {
BKE_mesh_end_editmesh(me, em);
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index a1f8b3251c8..7e9fcb10984 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -3484,7 +3484,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f);
}
-void editmesh_select_by_material(EditMesh *em, int index)
+void EM_select_by_material(EditMesh *em, int index)
{
EditFace *efa;
@@ -3497,7 +3497,7 @@ void editmesh_select_by_material(EditMesh *em, int index)
EM_selectmode_flush(em);
}
-void editmesh_deselect_by_material(EditMesh *em, int index)
+void EM_deselect_by_material(EditMesh *em, int index)
{
EditFace *efa;
@@ -3531,7 +3531,7 @@ static void mesh_selection_type(Scene *scene, EditMesh *em, int val)
/* note, em stores selectmode to be able to pass it on everywhere without scene,
this is only until all select modes and toolsettings are settled more */
- scene->selectmode= em->selectmode;
+ scene->toolsettings->selectmode= em->selectmode;
// if (EM_texFaceCheck())
}
}
diff --git a/source/blender/editors/object/Makefile b/source/blender/editors/object/Makefile
index c0312023bfd..70ada46c80f 100644
--- a/source/blender/editors/object/Makefile
+++ b/source/blender/editors/object/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 74a1fc12631..7a75e3875ea 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -3661,7 +3661,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
if(!psys)
return;
- if(scene->selectmode & SCE_SELECT_POINT)
+ if(pset->selectmode & SCE_SELECT_POINT)
nr= pupmenu("Specials%t|Rekey%x1|Subdivide%x2|Select First%x3|Select Last%x4|Remove Doubles%x5");
else
nr= pupmenu("Specials%t|Rekey%x1|Remove Doubles%x5");
diff --git a/source/blender/editors/physics/Makefile b/source/blender/editors/physics/Makefile
index a71ea9e2083..63968fdd537 100644
--- a/source/blender/editors/physics/Makefile
+++ b/source/blender/editors/physics/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/physics/ed_pointcache.c b/source/blender/editors/physics/ed_pointcache.c
index e47f44c5c1a..3374e05883c 100644
--- a/source/blender/editors/physics/ed_pointcache.c
+++ b/source/blender/editors/physics/ed_pointcache.c
@@ -83,7 +83,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
baker.render = 0;
baker.break_test = cache_break_test;
baker.break_data = NULL;
- baker.progressbar = WM_timecursor;
+ baker.progressbar = (void (*)(void *, int))WM_timecursor;
baker.progresscontext = CTX_wm_window(C);
BKE_ptcache_make_cache(&baker);
@@ -170,7 +170,7 @@ static int ptcache_bake_particle_system_exec(bContext *C, wmOperator *op)
baker.render = 0;
baker.break_test = cache_break_test;
baker.break_data = NULL;
- baker.progressbar = WM_timecursor;
+ baker.progressbar = (void (*)(void *, int))WM_timecursor;
baker.progresscontext = CTX_wm_window(C);
BKE_ptcache_make_cache(&baker);
diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c
index a9fc65bdc37..1b6b5b43522 100644
--- a/source/blender/editors/physics/editparticle.c
+++ b/source/blender/editors/physics/editparticle.c
@@ -225,7 +225,7 @@ void PE_hide_keys_time(Scene *scene, ParticleSystem *psys, float cfra)
ParticleEditSettings *pset=PE_settings(scene);
int i, k, totpart= psys->totpart;
- if(pset->draw_timed && scene->selectmode==SCE_SELECT_POINT) {
+ if(pset->draw_timed && pset->selectmode==SCE_SELECT_POINT) {
LOOP_PARTICLES(i, pa) {
LOOP_KEYS(k, key) {
if(fabs(cfra-*key->time) < pset->draw_timed)
@@ -425,11 +425,12 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest)
ParticleEdit *edit= psys->edit;
ParticleData *pa;
ParticleEditKey *key;
+ ParticleEditSettings *pset= PE_settings(data->scene);
int i, k, totpart, nearest_pa, nearest_key;
float dist= data->rad;
/* in path select mode we have no keys */
- if(data->scene->selectmode==SCE_SELECT_PATH)
+ if(pset->selectmode==SCE_SELECT_PATH)
return;
totpart= psys->totpart;
@@ -439,7 +440,7 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest)
LOOP_PARTICLES(i, pa) {
if(pa->flag & PARS_HIDE) continue;
- if(data->scene->selectmode == SCE_SELECT_END) {
+ if(pset->selectmode == SCE_SELECT_END) {
/* only do end keys */
key= edit->keys[i] + pa->totkey-1;
@@ -481,18 +482,19 @@ static void foreach_mouse_hit_particle(PEData *data, ForParticleFunc func, int s
ParticleSystem *psys= data->psys;
ParticleData *pa;
ParticleEditKey *key;
+ ParticleEditSettings *pset= PE_settings(data->scene);
int i, k, totpart;
totpart= psys->totpart;
/* all is selected in path mode */
- if(data->scene->selectmode==SCE_SELECT_PATH)
+ if(pset->selectmode==SCE_SELECT_PATH)
selected=0;
LOOP_PARTICLES(i, pa) {
if(pa->flag & PARS_HIDE) continue;
- if(data->scene->selectmode==SCE_SELECT_END) {
+ if(pset->selectmode==SCE_SELECT_END) {
/* only do end keys */
key= psys->edit->keys[i] + pa->totkey-1;
@@ -522,6 +524,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
ParticleData *pa;
ParticleEditKey *key;
ParticleSystemModifierData *psmd=0;
+ ParticleEditSettings *pset= PE_settings(data->scene);
int i, k, totpart;
float mat[4][4], imat[4][4];
@@ -529,7 +532,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
totpart= psys->totpart;
/* all is selected in path mode */
- if(data->scene->selectmode==SCE_SELECT_PATH)
+ if(pset->selectmode==SCE_SELECT_PATH)
selected= 0;
Mat4One(imat);
@@ -541,7 +544,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, pa, mat);
Mat4Invert(imat,mat);
- if(data->scene->selectmode==SCE_SELECT_END) {
+ if(pset->selectmode==SCE_SELECT_END) {
/* only do end keys */
key= psys->edit->keys[i] + pa->totkey-1;
@@ -610,6 +613,7 @@ static int count_selected_keys(Scene *scene, ParticleSystem *psys)
{
ParticleData *pa;
ParticleEditKey *key;
+ ParticleEditSettings *pset= PE_settings(scene);
int i, k, totpart, sel= 0;
totpart= psys->totpart;
@@ -619,12 +623,12 @@ static int count_selected_keys(Scene *scene, ParticleSystem *psys)
key= psys->edit->keys[i];
- if(scene->selectmode==SCE_SELECT_POINT) {
+ if(pset->selectmode==SCE_SELECT_POINT) {
for(k=0; k<pa->totkey; k++,key++)
if(key->flag & PEK_SELECT)
sel++;
}
- else if(scene->selectmode==SCE_SELECT_END) {
+ else if(pset->selectmode==SCE_SELECT_END) {
key += pa->totkey-1;
if(key->flag & PEK_SELECT)
@@ -1454,6 +1458,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
ParticleEdit *edit;
ParticleData *pa;
ParticleEditKey *key;
+ ParticleEditSettings *pset= PE_settings(scene);
float co[3], mat[4][4];
short vertco[2];
int i, k, totpart;
@@ -1470,7 +1475,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, mat);
- if(scene->selectmode==SCE_SELECT_POINT) {
+ if(pset->selectmode==SCE_SELECT_POINT) {
LOOP_KEYS(k, key) {
VECCOPY(co, key->co);
Mat4MulVecfl(mat, co);
@@ -1487,7 +1492,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
}
}
}
- else if(scene->selectmode==SCE_SELECT_END) {
+ else if(pset->selectmode==SCE_SELECT_END) {
key= edit->keys[i] + pa->totkey - 1;
VECCOPY(co, key->co);
@@ -2349,7 +2354,7 @@ enum { DEL_PARTICLE, DEL_KEY };
static EnumPropertyItem delete_type_items[]= {
{DEL_PARTICLE, "PARTICLE", 0, "Particle", ""},
{DEL_KEY, "KEY", 0, "Key", ""},
- {0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}};
static void set_delete_particle(PEData *data, int pa_index)
{
@@ -3842,6 +3847,7 @@ void PE_change_act_psys(Scene *scene, Object *ob, ParticleSystem *psys)
static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Scene *scene= CTX_data_scene(C);
+ ParticleEditSettings *pset=PE_settings(scene);
uiPopupMenu *pup;
uiLayout *layout;
@@ -3849,7 +3855,7 @@ static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
layout= uiPupMenuLayout(pup);
uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey");
- if(scene->selectmode & SCE_SELECT_POINT) {
+ if(pset->selectmode & SCE_SELECT_POINT) {
uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide");
uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first");
uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last");
diff --git a/source/blender/editors/preview/Makefile b/source/blender/editors/preview/Makefile
index c44da6753f3..48e1dc64673 100644
--- a/source/blender/editors/preview/Makefile
+++ b/source/blender/editors/preview/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/screen/Makefile b/source/blender/editors/screen/Makefile
index cf6e692c304..923a020afcf 100644
--- a/source/blender/editors/screen/Makefile
+++ b/source/blender/editors/screen/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index a81a52fd544..a23487effa1 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -1,5 +1,5 @@
/**
- * $Id: glutil.c 11920 2007-09-02 17:25:03Z elubie $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/sculpt_paint/Makefile b/source/blender/editors/sculpt_paint/Makefile
index 9353116a4bc..012a39b8d25 100644
--- a/source/blender/editors/sculpt_paint/Makefile
+++ b/source/blender/editors/sculpt_paint/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index ac86e2ed962..f40880b901f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1,5 +1,5 @@
/*
- * $Id: sculptmode.c 18309 2009-01-04 07:47:11Z nicholasbishop $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 112da5b4f0f..febca301939 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1,5 +1,5 @@
/*
- * $Id: BDR_sculptmode.h 13396 2008-01-25 04:17:38Z nicholasbishop $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_action/Makefile b/source/blender/editors/space_action/Makefile
index 840f31b8a40..e856587acca 100644
--- a/source/blender/editors/space_action/Makefile
+++ b/source/blender/editors/space_action/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 61048598644..f3a0dda4ce7 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -1,5 +1,5 @@
/**
- * $Id: drawaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 70dbc42fe6e..61dbc41e7c8 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1,5 +1,5 @@
/**
- * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 3583d16fd8c..451d120ff9b 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -1,5 +1,5 @@
/**
- * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_api/Makefile b/source/blender/editors/space_api/Makefile
index 46f926afbc9..474fbe89053 100644
--- a/source/blender/editors/space_api/Makefile
+++ b/source/blender/editors/space_api/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_buttons/Makefile b/source/blender/editors/space_buttons/Makefile
index b96d1cc5495..a4894ede06b 100644
--- a/source/blender/editors/space_buttons/Makefile
+++ b/source/blender/editors/space_buttons/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index d97b4acdb96..01794d1bba8 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -552,7 +552,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
if(ptr) {
Object *ob= ptr->data;
- if(ob && ob->type && (ob->type<OB_LAMP))
+ if(ob && ob->type && (ob->type<OB_LAMP) && ob->totcol)
CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1);
}
@@ -668,7 +668,6 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
uiBlock *block;
uiBut *but;
PointerRNA *ptr;
- PropertyRNA *nameprop;
char namebuf[128], *name;
int a, icon;
@@ -688,7 +687,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
if(ptr->data) {
icon= RNA_struct_ui_icon(ptr->type);
- nameprop= RNA_struct_name_property(ptr->type);
+ name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf));
#if 0
if(sbuts->mainb != BCONTEXT_SCENE && ptr->type == &RNA_Scene) {
@@ -696,9 +695,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
}
else
#endif
- if(nameprop) {
- name= RNA_property_string_get_alloc(ptr, nameprop, namebuf, sizeof(namebuf));
-
+ if(name) {
uiItemL(row, name, icon);
if(name != namebuf)
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index 196647a3750..b213e4288be 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -61,6 +61,12 @@ void buttons_context_draw(const struct bContext *C, struct uiLayout *layout);
void buttons_context_register(struct ARegionType *art);
/* buttons_ops.c */
+void OBJECT_OT_material_slot_add(struct wmOperatorType *ot);
+void OBJECT_OT_material_slot_remove(struct wmOperatorType *ot);
+void OBJECT_OT_material_slot_assign(struct wmOperatorType *ot);
+void OBJECT_OT_material_slot_select(struct wmOperatorType *ot);
+void OBJECT_OT_material_slot_deselect(struct wmOperatorType *ot);
+
void MATERIAL_OT_new(struct wmOperatorType *ot);
void TEXTURE_OT_new(struct wmOperatorType *ot);
void WORLD_OT_new(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 63469a8294d..6755a2be1b7 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -30,6 +30,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
@@ -37,31 +38,250 @@
#include "DNA_world_types.h"
#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_font.h"
#include "BKE_library.h"
#include "BKE_material.h"
#include "BKE_texture.h"
+#include "BKE_utildefines.h"
#include "BKE_world.h"
+#include "BLI_editVert.h"
+
#include "RNA_access.h"
#include "WM_api.h"
#include "WM_types.h"
+#include "ED_curve.h"
+#include "ED_mesh.h"
+
#include "buttons_intern.h" // own include
+/********************** material slot operators *********************/
+
+static int material_slot_add_exec(bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+
+ if(!ob)
+ return OPERATOR_CANCELLED;
+
+ object_add_material_slot(ob);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_material_slot_add(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Add Material Slot";
+ ot->idname= "OBJECT_OT_material_slot_add";
+
+ /* api callbacks */
+ ot->exec= material_slot_add_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int material_slot_remove_exec(bContext *C, wmOperator *op)
+{
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+
+ if(!ob)
+ return OPERATOR_CANCELLED;
+
+ object_remove_material_slot(ob);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Remove Material Slot";
+ ot->idname= "OBJECT_OT_material_slot_remove";
+
+ /* api callbacks */
+ ot->exec= material_slot_remove_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int material_slot_assign_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+
+ if(!ob)
+ return OPERATOR_CANCELLED;
+
+ if(ob && ob->actcol>0) {
+ if(ob->type == OB_MESH) {
+ EditMesh *em= ((Mesh*)ob->data)->edit_mesh;
+ EditFace *efa;
+
+ if(em) {
+ for(efa= em->faces.first; efa; efa=efa->next)
+ if(efa->f & SELECT)
+ efa->mat_nr= ob->actcol-1;
+ }
+ }
+ else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ ListBase *editnurb= ((Curve*)ob->data)->editnurb;
+ Nurb *nu;
+
+ if(editnurb) {
+ for(nu= editnurb->first; nu; nu= nu->next)
+ if(isNurbsel(nu))
+ nu->mat_nr= nu->charidx= ob->actcol-1;
+ }
+ }
+ else if(ob->type == OB_FONT) {
+ EditFont *ef= ((Curve*)ob->data)->editfont;
+ int i, selstart, selend;
+
+ if(ef && BKE_font_getselection(ob, &selstart, &selend)) {
+ for(i=selstart; i<=selend; i++)
+ ef->textbufinfo[i].mat_nr = ob->actcol-1;
+ }
+ }
+ }
+
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_material_slot_assign(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Assign Material Slot";
+ ot->idname= "OBJECT_OT_material_slot_assign";
+
+ /* api callbacks */
+ ot->exec= material_slot_assign_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int material_slot_de_select(bContext *C, int select)
+{
+ Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+
+ if(!ob)
+ return OPERATOR_CANCELLED;
+
+ if(ob->type == OB_MESH) {
+ EditMesh *em= ((Mesh*)ob->data)->edit_mesh;
+
+ if(em) {
+ if(select)
+ EM_select_by_material(em, ob->actcol-1);
+ else
+ EM_deselect_by_material(em, ob->actcol-1);
+ }
+ }
+ else if ELEM(ob->type, OB_CURVE, OB_SURF) {
+ ListBase *editnurb= ((Curve*)ob->data)->editnurb;
+ Nurb *nu;
+ BPoint *bp;
+ BezTriple *bezt;
+ int a;
+
+ for(nu= editnurb->first; nu; nu=nu->next) {
+ if(nu->mat_nr==ob->actcol-1) {
+ if(nu->bezt) {
+ a= nu->pntsu;
+ bezt= nu->bezt;
+ while(a--) {
+ if(bezt->hide==0) {
+ if(select) {
+ bezt->f1 |= SELECT;
+ bezt->f2 |= SELECT;
+ bezt->f3 |= SELECT;
+ }
+ else {
+ bezt->f1 &= ~SELECT;
+ bezt->f2 &= ~SELECT;
+ bezt->f3 &= ~SELECT;
+ }
+ }
+ bezt++;
+ }
+ }
+ else if(nu->bp) {
+ a= nu->pntsu*nu->pntsv;
+ bp= nu->bp;
+ while(a--) {
+ if(bp->hide==0) {
+ if(select) bp->f1 |= SELECT;
+ else bp->f1 &= ~SELECT;
+ }
+ bp++;
+ }
+ }
+ }
+ }
+ }
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+static int material_slot_select_exec(bContext *C, wmOperator *op)
+{
+ return material_slot_de_select(C, 1);
+}
+
+void OBJECT_OT_material_slot_select(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Select Material Slot";
+ ot->idname= "OBJECT_OT_material_slot_select";
+
+ /* api callbacks */
+ ot->exec= material_slot_select_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int material_slot_deselect_exec(bContext *C, wmOperator *op)
+{
+ return material_slot_de_select(C, 0);
+}
+
+void OBJECT_OT_material_slot_deselect(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Deselect Material Slot";
+ ot->idname= "OBJECT_OT_material_slot_deselect";
+
+ /* api callbacks */
+ ot->exec= material_slot_deselect_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/********************** new material operator *********************/
static int new_material_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr;
- Material *ma;
+ Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
Object *ob;
+ PointerRNA ptr;
int index;
/* add or copy material */
- ptr= CTX_data_pointer_get(C, "material");
- ma= (RNA_struct_is_a(ptr.type, &RNA_Material))? ptr.data: NULL;
-
if(ma)
ma= copy_material(ma);
else
@@ -70,9 +290,9 @@ static int new_material_exec(bContext *C, wmOperator *op)
ma->id.us--; /* compensating for us++ in assign_material */
/* attempt to assign to material slot */
- ptr= CTX_data_pointer_get(C, "material_slot");
+ ptr= CTX_data_pointer_get_type(C, "material_slot", &RNA_MaterialSlot);
- if(RNA_struct_is_a(ptr.type, &RNA_MaterialSlot)) {
+ if(ptr.data) {
ob= ptr.id.data;
index= (Material**)ptr.data - ob->mat;
@@ -80,6 +300,8 @@ static int new_material_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
}
+
+ WM_event_add_notifier(C, NC_MATERIAL|NA_ADDED, ma);
return OPERATOR_FINISHED;
}
@@ -101,15 +323,12 @@ void MATERIAL_OT_new(wmOperatorType *ot)
static int new_texture_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr;
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
ID *id;
- Tex *tex;
MTex *mtex;
+ PointerRNA ptr;
/* add or copy texture */
- ptr= CTX_data_pointer_get(C, "texture");
- tex= (RNA_struct_is_a(ptr.type, &RNA_Texture))? ptr.data: NULL;
-
if(tex)
tex= copy_texture(tex);
else
@@ -118,9 +337,9 @@ static int new_texture_exec(bContext *C, wmOperator *op)
id_us_min(&tex->id);
/* attempt to assign to texture slot */
- ptr= CTX_data_pointer_get(C, "texture_slot");
+ ptr= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot);
- if(RNA_struct_is_a(ptr.type, &RNA_TextureSlot)) {
+ if(ptr.data) {
id= ptr.id.data;
mtex= ptr.data;
@@ -133,6 +352,8 @@ static int new_texture_exec(bContext *C, wmOperator *op)
/* XXX nodes, notifier .. */
}
+
+ WM_event_add_notifier(C, NC_TEXTURE|NA_ADDED, tex);
return OPERATOR_FINISHED;
}
@@ -154,27 +375,21 @@ void TEXTURE_OT_new(wmOperatorType *ot)
static int new_world_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr;
- Scene *scene;
- World *wo;
+ Scene *scene= CTX_data_scene(C);
+ World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
/* add or copy world */
- ptr= CTX_data_pointer_get(C, "world");
- wo= (RNA_struct_is_a(ptr.type, &RNA_World))? ptr.data: NULL;
-
if(wo)
wo= copy_world(wo);
else
wo= add_world("World");
/* assign to scene */
- scene= CTX_data_scene(C);
-
if(scene->world)
id_us_min(&scene->world->id);
scene->world= wo;
- // XXX notifier
+ WM_event_add_notifier(C, NC_WORLD|NA_ADDED, wo);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index e5d2215be29..483a1dc6100 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -210,6 +210,12 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
void buttons_operatortypes(void)
{
+ WM_operatortype_append(OBJECT_OT_material_slot_add);
+ WM_operatortype_append(OBJECT_OT_material_slot_remove);
+ WM_operatortype_append(OBJECT_OT_material_slot_assign);
+ WM_operatortype_append(OBJECT_OT_material_slot_select);
+ WM_operatortype_append(OBJECT_OT_material_slot_deselect);
+
WM_operatortype_append(MATERIAL_OT_new);
WM_operatortype_append(TEXTURE_OT_new);
WM_operatortype_append(WORLD_OT_new);
@@ -337,6 +343,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
case ND_GEOM_SELECT:
ED_area_tag_redraw(sa);
break;
+ case ND_SHADING:
+ case ND_SHADING_DRAW:
+ /* currently works by redraws... if preview is set, it (re)starts job */
+ sbuts->preview= 1;
+ break;
}
break;
case NC_MATERIAL:
@@ -347,7 +358,6 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
case ND_SHADING_DRAW:
/* currently works by redraws... if preview is set, it (re)starts job */
sbuts->preview= 1;
- printf("shader notifier \n");
break;
}
break;
diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile
index 8f48217473c..2f4180448e5 100644
--- a/source/blender/editors/space_file/Makefile
+++ b/source/blender/editors/space_file/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 6ed8f87d987..bb47d3458fe 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -550,7 +550,24 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
}
-static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, const char* category_name, short *starty)
+static void file_draw_fsmenu_category_name(ARegion *ar, const char *category_name, short *starty)
+{
+ short sx, sy;
+ int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X - ICON_DEFAULT_WIDTH - 4;
+ int fontsize = file_font_pointsize();
+
+ sx = ar->v2d.cur.xmin + TILE_BORDER_X;
+ sy = *starty;
+
+ UI_ThemeColor(TH_TEXT_HI);
+ file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END);
+
+ sy -= fontsize*2.0f;
+
+ *starty= sy;
+}
+
+static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, short *starty)
{
struct FSMenu* fsmenu = fsmenu_get();
char bookmark[FILE_MAX];
@@ -565,11 +582,6 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate
sx = ar->v2d.cur.xmin + TILE_BORDER_X;
sy = *starty;
- UI_ThemeColor(TH_TEXT_HI);
- file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END);
-
- sy -= fontsize*2.0f;
-
switch(category) {
case FS_CATEGORY_SYSTEM:
cat_icon = ICON_DISK_DRIVE; break;
@@ -616,15 +628,54 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate
*starty = sy;
}
+void file_draw_fsmenu_operator(const bContext *C, ARegion *ar, wmOperator *op, short *starty)
+{
+ uiStyle *style= U.uistyles.first;
+ uiBlock *block;
+ uiLayout *layout;
+ int sy;
+
+ sy= *starty;
+
+ block= uiBeginBlock(C, ar, "file_options", UI_EMBOSS);
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, TILE_BORDER_X, sy, ar->winx-2*TILE_BORDER_X, 20, style);
+
+ RNA_STRUCT_BEGIN(op->ptr, prop) {
+ if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
+ continue;
+ if(strcmp(RNA_property_identifier(prop), "filename") == 0)
+ continue;
+
+ uiItemFullR(layout, NULL, 0, op->ptr, prop, -1, 0, 0, 0, 0);
+ }
+ RNA_STRUCT_END;
+
+ uiBlockLayoutResolve(C, block, NULL, &sy);
+ uiEndBlock(C, block);
+ uiDrawBlock(C, block);
+
+ *starty= sy;
+}
+
void file_draw_fsmenu(const bContext *C, ARegion *ar)
{
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
int linestep = file_font_pointsize()*2.0f;
short sy= ar->v2d.cur.ymax-2*TILE_BORDER_Y;
- file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, "SYSTEM", &sy);
+ file_draw_fsmenu_category_name(ar, "SYSTEM", &sy);
+ file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, &sy);
sy -= linestep;
- file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, "BOOKMARKS", &sy);
+ file_draw_fsmenu_category_name(ar, "BOOKMARKS", &sy);
+ file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, &sy);
sy -= linestep;
- file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, "RECENT", &sy);
-
+ file_draw_fsmenu_category_name(ar, "RECENT", &sy);
+ file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, &sy);
+
+ if(sfile->op) {
+ sy -= linestep;
+ file_draw_fsmenu_category_name(ar, "OPTIONS", &sy);
+ file_draw_fsmenu_operator(C, ar, sfile->op, &sy);
+ }
}
+
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 0c6cadc05c1..ab02147d020 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -190,7 +190,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
rect.xmax= RNA_int_get(op->ptr, "xmax");
rect.ymax= RNA_int_get(op->ptr, "ymax");
- BLI_isect_rctf(&(ar->v2d.mask), &rect, &rect);
+ BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
file_select(sfile, ar, &rect, val );
WM_event_add_notifier(C, NC_WINDOW, NULL);
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 4c2def72de0..9c0bcc6b991 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -162,7 +162,7 @@ float file_string_width(const char* str)
{
uiStyle *style= U.uistyles.first;
uiStyleFontSet(&style->widget);
- return BLF_width(str);
+ return BLF_width((char *)str);
}
float file_font_pointsize()
diff --git a/source/blender/editors/space_graph/Makefile b/source/blender/editors/space_graph/Makefile
index 340495ecc79..e04a354fb1d 100644
--- a/source/blender/editors/space_graph/Makefile
+++ b/source/blender/editors/space_graph/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index d9e12afc947..6393b6877b9 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -1,5 +1,5 @@
/**
- * $Id: drawipo.c 17512 2008-11-20 05:55:42Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 057c3c40ddf..fc04308077c 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1,5 +1,5 @@
/**
- * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 4451cfae227..d600396fd77 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -1,5 +1,5 @@
/**
- * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_image/Makefile b/source/blender/editors/space_image/Makefile
index 44d841a0606..e7e9a9b5665 100644
--- a/source/blender/editors/space_image/Makefile
+++ b/source/blender/editors/space_image/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index b5df0257e71..a08a23c1263 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -383,6 +383,7 @@ static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block
}
}
+#if 0
static void image_panel_view_properties(const bContext *C, Panel *pa)
{
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
@@ -439,6 +440,7 @@ static void image_panel_view_properties(const bContext *C, Panel *pa)
}
image_editcursor_buts(C, &ar->v2d, block);
}
+#endif
void brush_buttons(const bContext *C, uiBlock *block, short fromsima,
int evt_nop, int evt_change,
@@ -1023,42 +1025,53 @@ static void image_load_fs_cb(bContext *C, void *ima_pp_v, void *iuser_v)
static void image_multi_cb(bContext *C, void *rr_v, void *iuser_v)
{
BKE_image_multilayer_index(rr_v, iuser_v);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
}
static void image_multi_inclay_cb(bContext *C, void *rr_v, void *iuser_v)
{
RenderResult *rr= rr_v;
ImageUser *iuser= iuser_v;
int tot= BLI_countlist(&rr->layers) + (rr->rectf?1:0); /* fake compo result layer */
- if(iuser->layer<tot-1)
+
+ if(iuser->layer<tot-1) {
iuser->layer++;
- BKE_image_multilayer_index(rr, iuser);
+ BKE_image_multilayer_index(rr, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+ }
}
static void image_multi_declay_cb(bContext *C, void *rr_v, void *iuser_v)
{
ImageUser *iuser= iuser_v;
- if(iuser->layer>0)
+
+ if(iuser->layer>0) {
iuser->layer--;
- BKE_image_multilayer_index(rr_v, iuser);
+ BKE_image_multilayer_index(rr_v, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+ }
}
static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v)
{
RenderResult *rr= rr_v;
ImageUser *iuser= iuser_v;
RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer);
+
if(rl) {
int tot= BLI_countlist(&rl->passes) + (rl->rectf?1:0); /* builtin render result has no combined pass in list */
if(iuser->pass<tot-1) {
iuser->pass++;
BKE_image_multilayer_index(rr, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
}
}
}
static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v)
{
ImageUser *iuser= iuser_v;
+
if(iuser->pass>0) {
iuser->pass--;
BKE_image_multilayer_index(rr_v, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
}
}
@@ -1353,6 +1366,23 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I
uiBlockEndAlign(block);
}
+void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
+{
+ uiBlock *block= uiLayoutFreeBlock(layout);
+ Scene *scene= CTX_data_scene(C);
+ RenderResult *rr;
+
+ /* render layers and passes */
+ if(ima && iuser) {
+ rr= BKE_image_get_renderresult(scene, ima);
+
+ if(rr) {
+ uiBlockBeginAlign(block);
+ uiblock_layer_pass_buttons(block, rr, iuser, 0, 0, 0, 160);
+ uiBlockEndAlign(block);
+ }
+ }
+}
static void image_panel_properties(const bContext *C, Panel *pa)
{
@@ -1377,12 +1407,6 @@ void image_buttons_register(ARegionType *art)
pt->draw= image_panel_properties;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype image view properties");
- strcpy(pt->idname, "IMAGE_PT_view_properties");
- strcpy(pt->label, "View Properties");
- pt->draw= image_panel_view_properties;
- BLI_addtail(&art->paneltypes, pt);
-
pt= MEM_callocN(sizeof(PanelType), "spacetype image panel paint");
strcpy(pt->idname, "IMAGE_PT_paint");
strcpy(pt->label, "Paint");
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 122e298baaa..e61931f2fad 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -311,12 +311,14 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl
// glColorMask(1, 1, 1, 1);
}
+#ifdef WITH_LCMS
static void sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf)
{
colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */
glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect);
}
+#endif
static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti)
{
@@ -450,7 +452,7 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty,
return rectmain;
}
-static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float zoomx, float zoomy)
+static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy)
{
unsigned int *rect;
int dx, dy, sx, sy, x, y;
@@ -477,7 +479,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I
/* draw repeated */
for(sy=0; sy+dy<=ibuf->y; sy+= dy) {
for(sx=0; sx+dx<=ibuf->x; sx+= dx) {
- UI_view2d_view_to_region(&ar->v2d, (float)sx/(float)ibuf->x, (float)sy/(float)ibuf->y, &x, &y);
+ UI_view2d_to_region_no_clip(&ar->v2d, fx + (float)sx/(float)ibuf->x, fy + (float)sy/(float)ibuf->y, &x, &y);
glaDrawPixelsSafe(x, y, dx, dy, dx, GL_RGBA, GL_UNSIGNED_BYTE, rect);
}
@@ -488,16 +490,19 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I
MEM_freeN(rect);
}
-static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, ImBuf *ibuf, float zoomx, float zoomy)
+static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy)
{
float x, y;
double time_current;
time_current = PIL_check_seconds_timer();
- for(x=ar->v2d.cur.xmin; x<ar->v2d.cur.xmax; x += zoomx) {
- for(y=ar->v2d.cur.ymin; y<ar->v2d.cur.ymax; y += zoomy) {
- draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy);
+ for(x=floor(ar->v2d.cur.xmin); x<ar->v2d.cur.xmax; x += 1.0f) {
+ for(y=floor(ar->v2d.cur.ymin); y<ar->v2d.cur.ymax; y += 1.0f) {
+ if(ima && (ima->tpageflag & IMA_TILES))
+ draw_image_buffer_tiled(sima, ar, ima, ibuf, x, y, zoomx, zoomy);
+ else
+ draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy);
/* only draw until running out of time */
if((PIL_check_seconds_timer() - time_current) > 0.25)
@@ -667,9 +672,9 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
if(ibuf==NULL)
draw_image_grid(ar, zoomx, zoomy);
else if(sima->flag & SI_DRAW_TILE)
- draw_image_buffer_repeated(sima, ar, scene, ibuf, zoomx, zoomy);
+ draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy);
else if(ima && (ima->tpageflag & IMA_TILES))
- draw_image_buffer_tiled(sima, ar, ima, ibuf, zoomx, zoomy);
+ draw_image_buffer_tiled(sima, ar, ima, ibuf, 0.0f, 0.0, zoomx, zoomy);
else
draw_image_buffer(sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy);
@@ -699,12 +704,5 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
}
}
#endif
-
-#if 0
- /* it is important to end a view in a transform compatible with buttons */
- bwin_scalematrix(sa->win, sima->blockscale, sima->blockscale, sima->blockscale);
- if(!(G.rendering && show_render))
- image_blockhandlers(sa);
-#endif
}
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index adf4772efde..9550c4c3a29 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -802,11 +802,11 @@ void image_header_buttons(const bContext *C, ARegion *ar)
uiBlockBeginAlign(block);
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_REDR, ICON_VERTEXSEL,
- xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
+ xco,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_REDR, ICON_EDGESEL,
- xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
+ xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_REDR, ICON_FACESEL,
- xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
+ xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
uiBlockEndAlign(block);
}
@@ -837,14 +837,14 @@ void image_header_buttons(const bContext *C, ARegion *ar)
/* snap options, identical to options in 3d view header */
uiBlockBeginAlign(block);
- if (scene->snap_flag & SCE_SNAP) {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab).");
+ if (scene->toolsettings->snap_flag & SCE_SNAP) {
+ uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab).");
xco+= XIC;
- uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,yco,70,YIC, &scene->snap_target, 0, 0, 0, 0, "Snap Target Mode.");
+ uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,yco,70,YIC, &scene->toolsettings->snap_target, 0, 0, 0, 0, "Snap Target Mode.");
xco+= 70;
}
else {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab).");
+ uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab).");
xco+= XIC;
}
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 537996601b8..8f9bb0d05fe 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -577,34 +577,30 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
/**************** load/replace/save callbacks ******************/
-static char *filesel_imagetype_string(Image *ima)
-{
- char *strp, *str= MEM_callocN(15*32, "menu for filesel");
-
- strp= str;
- str += sprintf(str, "Save Image as: %%t|");
- str += sprintf(str, "Targa %%x%d|", R_TARGA);
- str += sprintf(str, "Targa Raw %%x%d|", R_RAWTGA);
- str += sprintf(str, "PNG %%x%d|", R_PNG);
- str += sprintf(str, "BMP %%x%d|", R_BMP);
- str += sprintf(str, "Jpeg %%x%d|", R_JPEG90);
+/* XXX make dynamic */
+static const EnumPropertyItem image_file_type_items[] = {
+ {R_TARGA, "TARGA", 0, "Targa", ""},
+ {R_RAWTGA, "TARGA RAW", 0, "Targa Raw", ""},
+ {R_PNG, "PNG", 0, "PNG", ""},
+ {R_BMP, "BMP", 0, "BMP", ""},
+ {R_JPEG90, "JPEG", 0, "Jpeg", ""},
#ifdef WITH_OPENJPEG
- str += sprintf(str, "Jpeg 2000 %%x%d|", R_JP2);
+ {R_JP2, "JPEG_2000", 0, "Jpeg 2000", ""},
#endif
- str += sprintf(str, "Iris %%x%d|", R_IRIS);
- if(G.have_libtiff)
- str += sprintf(str, "Tiff %%x%d|", R_TIFF);
- str += sprintf(str, "Radiance HDR %%x%d|", R_RADHDR);
- str += sprintf(str, "Cineon %%x%d|", R_CINEON);
- str += sprintf(str, "DPX %%x%d|", R_DPX);
+ {R_IRIS, "IRIS", 0, "Iris", ""},
+ //if(G.have_libtiff)
+ {R_TIFF, "TIFF", 0, "Tiff", ""},
+ {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""},
+ {R_CINEON, "CINEON", 0, "Cineon", ""},
+ {R_DPX, "DPX", 0, "DPX", ""},
#ifdef WITH_OPENEXR
- str += sprintf(str, "OpenEXR %%x%d|", R_OPENEXR);
+ {R_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
/* saving sequences of multilayer won't work, they copy buffers */
- if(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER);
- else str += sprintf(str, "MultiLayer %%x%d|", R_MULTILAYER);
+ /*if(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER);
+ else*/
+ {R_MULTILAYER, "MULTILAYER", 0, "MultiLayer", ""},
#endif
- return strp;
-}
+ {0, NULL, 0, NULL, NULL}};
static void image_filesel(bContext *C, wmOperator *op, const char *path)
{
@@ -799,7 +795,9 @@ static int save_as_exec(bContext *C, wmOperator *op)
if(!ima)
return OPERATOR_CANCELLED;
+ sima->imtypenr= RNA_enum_get(op->ptr, "file_type");
RNA_string_get(op->ptr, "filename", str);
+
save_image_doit(C, sima, scene, op, str);
return OPERATOR_FINISHED;
@@ -820,10 +818,6 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* always opens fileselect */
if(ibuf) {
- char *strp;
-
- strp= filesel_imagetype_string(ima); // XXX unused still
-
/* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
if(ima->rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
sima->imtypenr= R_MULTILAYER;
@@ -831,14 +825,14 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event)
sima->imtypenr= scene->r.imtype;
else
sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype);
+
+ RNA_enum_set(op->ptr, "file_type", sima->imtypenr);
if(ibuf->name[0]==0)
BLI_strncpy(ibuf->name, G.ima, FILE_MAX);
// XXX note: we can give default menu enums to operator for this
image_filesel(C, op, ibuf->name);
-
- MEM_freeN(strp);
return OPERATOR_RUNNING_MODAL;
}
@@ -862,6 +856,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
/* properties */
RNA_def_string_file_path(ot->srna, "filename", "", FILE_MAX, "Filename", "File path to save image to.");
+ RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
}
/******************** save image operator ********************/
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 49f950fe67b..7d6faa00dfc 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -327,12 +327,10 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar, Scene *sce
#endif
if(sima->image) {
ImBuf *ibuf= ED_space_image_buffer(sima);
- float xuser_asp, yuser_asp;
- ED_image_aspect(sima->image, &xuser_asp, &yuser_asp);
if(ibuf) {
- width= ibuf->x*xuser_asp;
- height= ibuf->y*yuser_asp;
+ width= ibuf->x;
+ height= ibuf->y;
}
else if(sima->image->type==IMA_TYPE_R_RESULT) {
/* not very important, just nice */
@@ -683,7 +681,7 @@ void ED_image_aspect(Image *ima, float *aspx, float *aspy)
*aspx= *aspy= 1.0;
if((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
- (ima->tpageflag & IMA_TILES) || (ima->aspx==0.0 || ima->aspy==0.0))
+ (ima->aspx==0.0 || ima->aspy==0.0))
return;
/* x is always 1 */
diff --git a/source/blender/editors/space_info/Makefile b/source/blender/editors/space_info/Makefile
index bc04ddc7824..931c2f2097c 100644
--- a/source/blender/editors/space_info/Makefile
+++ b/source/blender/editors/space_info/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c
index c8dd3df8425..7b65a70117c 100644
--- a/source/blender/editors/space_info/info_header.c
+++ b/source/blender/editors/space_info/info_header.c
@@ -415,7 +415,7 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u
name[len]= '|';
}
- if(0==uiSearchItemAdd(items, name, ot))
+ if(0==uiSearchItemAdd(items, name, ot, 0))
break;
}
}
diff --git a/source/blender/editors/space_logic/Makefile b/source/blender/editors/space_logic/Makefile
index e07a5bbf4a9..d5709993368 100644
--- a/source/blender/editors/space_logic/Makefile
+++ b/source/blender/editors/space_logic/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index 240ddfc2614..b082d5d6ae2 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -1,5 +1,5 @@
/**
- * $Id: image_buttons.c 20913 2009-06-16 01:22:56Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index b328ed74e08..55e21561c34 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3056,12 +3056,12 @@ void logic_buttons(bContext *C, ARegion *ar)
/* ******************************* */
xco= 500; yco= 170; width= 300;
- uiDefPulldownBut(block, controller_menu, NULL, "Controllers", xco-10, yco+35, 100, 19, "");
+ uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco+35, 100, UI_UNIT_Y, "");
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BUTS_CONT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/3, 19, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
- uiDefButBitS(block, TOG, BUTS_CONT_ACT, B_REDR, "Act", xco+110+(width-100)/3, yco+35, (width-100)/3, 19, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
- uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, 19, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator");
+ uiDefButBitS(block, TOG, BUTS_CONT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
+ uiDefButBitS(block, TOG, BUTS_CONT_ACT, B_REDR, "Act", xco+110+(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
+ uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator");
uiBlockEndAlign(block);
ob= CTX_data_active_object(C);
@@ -3077,9 +3077,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if(ob->controllers.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), 19, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
+ uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
// if(ob->controllers.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
+ uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
uiBlockEndAlign(block);
yco-=20;
@@ -3100,7 +3100,7 @@ void logic_buttons(bContext *C, ARegion *ar)
if(ob->scaflag & OB_SHOWCONT) {
/* first show the state */
- uiDefBlockBut(block, object_state_mask_menu, ob, "State", (short)(xco-10), (short)(yco-10), 36, 19, "Object state menu: store and retrieve initial state");
+ uiDefBlockBut(block, object_state_mask_menu, ob, "State", (short)(xco-10), (short)(yco-10), 36, UI_UNIT_Y, "Object state menu: store and retrieve initial state");
if (!ob->state)
ob->state = 1;
@@ -3116,9 +3116,9 @@ void logic_buttons(bContext *C, ARegion *ar)
}
}
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_SETSTBIT, B_SET_STATE_BIT, "All",(short)(xco+226), yco-10, 22, 19, &ob->scaflag, 0, 0, 0, 0, "Set all state bits");
- uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini",(short)(xco+248), yco-10, 22, 19, &ob->scaflag, 0, 0, 0, 0, "Set the initial state");
- uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D",(short)(xco+270), yco-10, 15, 19, &ob->scaflag, 0, 0, 0, 0, "Print state debug info");
+ uiDefButBitS(block, TOG, OB_SETSTBIT, B_SET_STATE_BIT, "All",(short)(xco+226), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set all state bits");
+ uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini",(short)(xco+248), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set the initial state");
+ uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D",(short)(xco+270), yco-10, 15, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Print state debug info");
uiBlockEndAlign(block);
yco-=35;
@@ -3142,17 +3142,17 @@ void logic_buttons(bContext *C, ARegion *ar)
if (act)
act->flag |= ACT_VISIBLE;
}
- uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X, xco, yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Delete Controller");
- uiDefIconButBitS(block, ICONTOG, CONT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Controller settings");
- uiDefIconButBitS(block, TOG, CONT_PRIO, B_REDR, ICON_BOOKMARKS, (short)(xco+width-66), yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Mark controller for execution before all non-marked controllers (good for startup scripts)");
+ uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X, xco, yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Delete Controller");
+ uiDefIconButBitS(block, ICONTOG, CONT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Controller settings");
+ uiDefIconButBitS(block, TOG, CONT_PRIO, B_REDR, ICON_BOOKMARKS, (short)(xco+width-66), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Mark controller for execution before all non-marked controllers (good for startup scripts)");
sprintf(name, "%d", first_bit(cont->state_mask)+1);
- uiDefBlockBut(block, controller_state_mask_menu, cont, name, (short)(xco+width-44), yco, 22, 19, "Set controller state index (from 1 to 30)");
+ uiDefBlockBut(block, controller_state_mask_menu, cont, name, (short)(xco+width-44), yco, 22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
if(cont->flag & CONT_SHOW) {
cont->otype= cont->type;
- uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, 19, &cont->type, 0, 0, 0, 0, "Controller type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), 19, cont->name, 0, 31, 0, 0, "Controller name");
+ uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
+ but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, 31, 0, 0, "Controller name");
uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
ycoo= yco;
@@ -3162,17 +3162,17 @@ void logic_buttons(bContext *C, ARegion *ar)
else {
cpack(0x999999);
glRecti(xco+22, yco, xco+width-22,yco+19);
- but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, 19, cont, 0, 0, 0, 0, "Controller type");
+ but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
uiButSetFunc(but, sca_move_controller, cont, NULL);
- but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), 19, cont, 0, 0, 0, 0, "Controller name");
+ but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
uiButSetFunc(but, sca_move_controller, cont, NULL);
ycoo= yco;
}
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, 19, 19, NULL, 0, 0, 0, 0, "");
+ but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, 19, 19, cont, LINK_CONTROLLER, 0, 0, 0, "");
+ uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
/* offset is >0 if at least one controller was displayed */
offset++;
yco-=20;
@@ -3188,13 +3188,13 @@ void logic_buttons(bContext *C, ARegion *ar)
/* ******************************* */
xco= 10; yco= 170; width= 400;
- uiDefPulldownBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 70, 19, "");
+ uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 70, UI_UNIT_Y, "");
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BUTS_SENS_SEL, B_REDR, "Sel", xco+80, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
- uiDefButBitS(block, TOG, BUTS_SENS_ACT, B_REDR, "Act", xco+80+(width-70)/4, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
- uiDefButBitS(block, TOG, BUTS_SENS_LINK, B_REDR, "Link", xco+80+2*(width-70)/4, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
- uiDefButBitS(block, TOG, BUTS_SENS_STATE, B_REDR, "State", xco+80+3*(width-70)/4, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show only sensors connected to active states");
+ uiDefButBitS(block, TOG, BUTS_SENS_SEL, B_REDR, "Sel", xco+80, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
+ uiDefButBitS(block, TOG, BUTS_SENS_ACT, B_REDR, "Act", xco+80+(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
+ uiDefButBitS(block, TOG, BUTS_SENS_LINK, B_REDR, "Link", xco+80+2*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
+ uiDefButBitS(block, TOG, BUTS_SENS_STATE, B_REDR, "State", xco+80+3*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only sensors connected to active states");
uiBlockEndAlign(block);
for(a=0; a<count; a++) {
@@ -3207,9 +3207,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if(ob->sensors.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), 19, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
+ uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
// if(ob->sensors.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
+ uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
uiBlockEndAlign(block);
yco-=20;
@@ -3226,17 +3226,17 @@ void logic_buttons(bContext *C, ARegion *ar)
pin = (slogic->scaflag & BUTS_SENS_STATE && (sens->flag & SENS_SHOW || sens->flag & SENS_PIN)) ? 1:0 ;
sens->flag |= SENS_VISIBLE;
- uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X, xco, yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Delete Sensor");
+ uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X, xco, yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Delete Sensor");
if (pin)
- uiDefIconButBitS(block, ICONTOG, SENS_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
+ uiDefIconButBitS(block, ICONTOG, SENS_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
- uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Sensor settings");
+ uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Sensor settings");
ycoo= yco;
if(sens->flag & SENS_SHOW)
{
- uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, 19, &sens->type, 0, 0, 0, 0, "Sensor type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), 19, sens->name, 0, 31, 0, 0, "Sensor name");
+ uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, UI_UNIT_Y, &sens->type, 0, 0, 0, 0, "Sensor type");
+ but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, 31, 0, 0, "Sensor name");
uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
sens->otype= sens->type;
@@ -3246,13 +3246,13 @@ void logic_buttons(bContext *C, ARegion *ar)
else {
set_col_sensor(sens->type, 1);
glRecti(xco+22, yco, xco+width-22,yco+19);
- but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, 19, sens, 0, 0, 0, 0, "");
+ but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
uiButSetFunc(but, sca_move_sensor, sens, NULL);
- but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), 19, sens, 0, 31, 0, 0, "");
+ but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, 31, 0, 0, "");
uiButSetFunc(but, sca_move_sensor, sens, NULL);
}
- but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, 19, 19, NULL, 0, 0, 0, 0, "");
+ but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
yco-=20;
@@ -3266,13 +3266,13 @@ void logic_buttons(bContext *C, ARegion *ar)
/* ******************************* */
xco= 900; yco= 170; width= 400;
- uiDefPulldownBut(block, actuator_menu, NULL, "Actuators", xco-10, yco+35, 90, 19, "");
+ uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco+35, 90, UI_UNIT_Y, "");
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BUTS_ACT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
- uiDefButBitS(block, TOG, BUTS_ACT_ACT, B_REDR, "Act", xco+110+(width-100)/4, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
- uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-100)/4, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
- uiDefButBitS(block, TOG, BUTS_ACT_STATE, B_REDR, "State", xco+110+3*(width-100)/4, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show only actuators connected to active states");
+ uiDefButBitS(block, TOG, BUTS_ACT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
+ uiDefButBitS(block, TOG, BUTS_ACT_ACT, B_REDR, "Act", xco+110+(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
+ uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
+ uiDefButBitS(block, TOG, BUTS_ACT_STATE, B_REDR, "State", xco+110+3*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only actuators connected to active states");
uiBlockEndAlign(block);
for(a=0; a<count; a++) {
ob= (Object *)idar[a];
@@ -3283,9 +3283,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if(ob->actuators.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), 19, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
+ uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
// if(ob->actuators.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
+ uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
uiBlockEndAlign(block);
yco-=20;
@@ -3301,15 +3301,15 @@ void logic_buttons(bContext *C, ARegion *ar)
pin = (slogic->scaflag & BUTS_ACT_STATE && (act->flag & SENS_SHOW || act->flag & SENS_PIN)) ? 1:0 ;
act->flag |= ACT_VISIBLE; /* mark the actuator as visible to help implementing the up/down action */
- uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X, xco, yco, 22, 19, &act->flag, 0, 0, 0, 0, "Delete Actuator");
+ uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X, xco, yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Delete Actuator");
if (pin)
- uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
- uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Display the actuator");
+ uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
+ uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display the actuator");
if(act->flag & ACT_SHOW) {
act->otype= act->type;
- uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 90, 19, &act->type, 0, 0, 0, 0, "Actuator type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), 19, act->name, 0, 31, 0, 0, "Actuator name");
+ uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 90, UI_UNIT_Y, &act->type, 0, 0, 0, 0, "Actuator type");
+ but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, 31, 0, 0, "Actuator name");
uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0);
ycoo= yco;
@@ -3319,14 +3319,14 @@ void logic_buttons(bContext *C, ARegion *ar)
else {
set_col_actuator(act->type, 1);
glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19));
- but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, 19, act, 0, 0, 0, 0, "Actuator type");
+ but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type");
uiButSetFunc(but, sca_move_actuator, act, NULL);
- but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), 19, act, 0, 0, 0, 0, "Actuator name");
+ but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name");
uiButSetFunc(but, sca_move_actuator, act, NULL);
ycoo= yco;
}
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, 19, 19, act, LINK_ACTUATOR, 0, 0, 0, "");
+ uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
yco-=20;
}
diff --git a/source/blender/editors/space_nla/Makefile b/source/blender/editors/space_nla/Makefile
index 43f010e6adc..d7c9477dc83 100644
--- a/source/blender/editors/space_nla/Makefile
+++ b/source/blender/editors/space_nla/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_node/Makefile b/source/blender/editors/space_node/Makefile
index 60f81255a74..5bd6e95e28c 100644
--- a/source/blender/editors/space_node/Makefile
+++ b/source/blender/editors/space_node/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 0670dd9e01f..f2e2486075b 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -1,5 +1,5 @@
/**
- * $Id: drawnode.c 17439 2008-11-13 09:57:11Z kakbarnf $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_outliner/Makefile b/source/blender/editors/space_outliner/Makefile
index 19d40a4a31e..8d7cd017e0b 100644
--- a/source/blender/editors/space_outliner/Makefile
+++ b/source/blender/editors/space_outliner/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index eba0aa84e85..6563a7dc7df 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1031,7 +1031,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv;
- PropertyRNA *prop, *iterprop, *nameprop;
+ PropertyRNA *prop, *iterprop;
PropertyType proptype;
PropertySubType propsubtype;
int a, tot;
@@ -1043,12 +1043,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
else if(type == TSE_RNA_STRUCT) {
/* struct */
- nameprop= RNA_struct_name_property(ptr->type);
+ te->name= RNA_struct_name_get_alloc(ptr, NULL, 0);
- if(nameprop) {
- te->name= RNA_property_string_get_alloc(ptr, nameprop, NULL, 0);
+ if(te->name)
te->flag |= TE_FREE_NAME;
- }
else
te->name= (char*)RNA_struct_ui_name(ptr->type);
@@ -3075,7 +3073,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
TreeElement *tem, *temnext, *temsub;
TreeStoreElem *tse, *tsenext;
PointerRNA *ptr, *nextptr;
- PropertyRNA *prop, *nameprop;
+ PropertyRNA *prop;
char *newpath=NULL;
/* optimise tricks:
@@ -3119,17 +3117,16 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
newpath= RNA_path_append(*path, ptr, prop, 0, NULL);
}
else if(RNA_property_type(prop) == PROP_COLLECTION) {
+ char buf[128], *name;
+
temnext= (TreeElement*)(ld->next->data);
tsenext= TREESTORE(temnext);
nextptr= &temnext->rnaptr;
- nameprop= RNA_struct_name_property(nextptr->type);
+ name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf));
- if(nameprop) {
+ if(name) {
/* if possible, use name as a key in the path */
- char buf[128], *name;
- name= RNA_property_string_get_alloc(nextptr, nameprop, buf, sizeof(buf));
-
newpath= RNA_path_append(*path, NULL, prop, 0, name);
if(name != buf)
diff --git a/source/blender/editors/space_script/Makefile b/source/blender/editors/space_script/Makefile
index 48e1cd8e861..3322cb61a7f 100644
--- a/source/blender/editors/space_script/Makefile
+++ b/source/blender/editors/space_script/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_sequencer/Makefile b/source/blender/editors/space_sequencer/Makefile
index 80699db4baa..7be0bc9cfef 100644
--- a/source/blender/editors/space_sequencer/Makefile
+++ b/source/blender/editors/space_sequencer/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index f127ab4b0cf..cc4f5cf5ce3 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -1,5 +1,5 @@
/**
- * $Id: sequencer_buttons.c 20279 2009-05-19 17:13:33Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/space_sound/Makefile b/source/blender/editors/space_sound/Makefile
index 4d375282223..a072684d543 100644
--- a/source/blender/editors/space_sound/Makefile
+++ b/source/blender/editors/space_sound/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_text/Makefile b/source/blender/editors/space_text/Makefile
index 33e12dc1abb..50871017085 100644
--- a/source/blender/editors/space_text/Makefile
+++ b/source/blender/editors/space_text/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 1b8149cb5a2..c761587198f 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -88,6 +88,7 @@
/* ************************ header area region *********************** */
#ifndef DISABLE_PYTHON
+#if 0
static void do_text_template_scriptsmenu(bContext *C, void *arg, int event)
{
// XXX BPY_menu_do_python(PYMENU_SCRIPTTEMPLATE, event);
@@ -154,6 +155,7 @@ static uiBlock *text_plugin_scriptsmenu(bContext *C, void *args_unused)
return block;
}
#endif
+#endif
/************************** properties ******************************/
diff --git a/source/blender/editors/space_time/Makefile b/source/blender/editors/space_time/Makefile
index 20877b48559..e0bf3943dd8 100644
--- a/source/blender/editors/space_time/Makefile
+++ b/source/blender/editors/space_time/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index cf9c12f3dff..29f31671670 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -567,12 +567,12 @@ void time_header_buttons(const bContext *C, ARegion *ar)
uiBlockBeginAlign(block);
uiDefIconButBitS(block, TOG, AUTOKEY_ON, B_REDRAWALL, ICON_REC,
- xco, yco, XIC, YIC, &(scene->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
+ xco, yco, XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
xco+= XIC;
if (IS_AUTOKEY_ON(scene)) {
uiDefButS(block, MENU, B_REDRAWALL,
"Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5",
- xco, yco, (int)5.5*XIC, YIC, &(scene->autokey_mode), 0, 1, 0, 0,
+ xco, yco, (int)5.5*XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0,
"Mode of automatic keyframe insertion for Objects and Bones");
xco+= (6*XIC);
}
diff --git a/source/blender/editors/space_view3d/Makefile b/source/blender/editors/space_view3d/Makefile
index dd4eab89411..5e6f8a6c426 100644
--- a/source/blender/editors/space_view3d/Makefile
+++ b/source/blender/editors/space_view3d/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 42da6775d5f..05490e2fce1 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -117,7 +117,7 @@
(vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
#define CHECK_OB_DRAWFACEDOT(sce, vd, dt) \
-( (sce->selectmode & SCE_SELECT_FACE) && \
+( (sce->toolsettings->selectmode & SCE_SELECT_FACE) && \
(vd->drawtype<=OB_SOLID) && \
(((vd->drawtype==OB_SOLID) && (dt>=OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX) && (vd->flag & V3D_ZBUF_SELECT)) == 0) \
)
@@ -1493,14 +1493,14 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb
static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no)
{
- Scene *scene= (Scene *)userData;
+ ToolSettings *ts= ((Scene *)userData)->toolsettings;
EditFace *efa = EM_get_face_for_index(index);
if (efa->h==0 && efa->fgonf!=EM_FGON) {
glVertex3fv(cent);
- glVertex3f( cent[0] + no[0]*scene->editbutsize,
- cent[1] + no[1]*scene->editbutsize,
- cent[2] + no[2]*scene->editbutsize);
+ glVertex3f( cent[0] + no[0]*ts->normalsize,
+ cent[1] + no[1]*ts->normalsize,
+ cent[2] + no[2]*ts->normalsize);
}
}
static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm)
@@ -1529,19 +1529,20 @@ static void draw_dm_face_centers(DerivedMesh *dm, int sel)
static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
{
Scene *scene= (Scene *)userData;
+ ToolSettings *ts= scene->toolsettings;
EditVert *eve = EM_get_vert_for_index(index);
if (eve->h==0) {
glVertex3fv(co);
if (no_f) {
- glVertex3f( co[0] + no_f[0]*scene->editbutsize,
- co[1] + no_f[1]*scene->editbutsize,
- co[2] + no_f[2]*scene->editbutsize);
+ glVertex3f( co[0] + no_f[0]*ts->normalsize,
+ co[1] + no_f[1]*ts->normalsize,
+ co[2] + no_f[2]*ts->normalsize);
} else {
- glVertex3f( co[0] + no_s[0]*scene->editbutsize/32767.0f,
- co[1] + no_s[1]*scene->editbutsize/32767.0f,
- co[2] + no_s[2]*scene->editbutsize/32767.0f);
+ glVertex3f( co[0] + no_s[0]*ts->normalsize/32767.0f,
+ co[1] + no_s[1]*ts->normalsize/32767.0f,
+ co[2] + no_s[2]*ts->normalsize/32767.0f);
}
}
}
@@ -1762,7 +1763,9 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, floa
}
static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
{
- if (scene->selectmode & SCE_SELECT_VERTEX) {
+ ToolSettings *ts= scene->toolsettings;
+
+ if (ts->selectmode & SCE_SELECT_VERTEX) {
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2);
bglBegin(GL_POINTS);
dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, NULL);
@@ -1786,6 +1789,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act)
{
+ ToolSettings *ts= scene->toolsettings;
int sel;
if(v3d->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select
@@ -1817,7 +1821,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM
col[3] = fcol[3] = 255;
}
- if(scene->selectmode & SCE_SELECT_VERTEX) {
+ if(ts->selectmode & SCE_SELECT_VERTEX) {
glPointSize(size);
glColor4ubv((GLubyte *)col);
draw_dm_verts(cageDM, sel, eve_act);
@@ -1842,6 +1846,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM
static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
{
+ ToolSettings *ts= scene->toolsettings;
int pass;
unsigned char wireCol[4], selCol[4], actCol[4];
@@ -1871,11 +1876,11 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh
if (!sel_only) wireCol[3] = 255;
}
- if(scene->selectmode == SCE_SELECT_FACE) {
+ if(ts->selectmode == SCE_SELECT_FACE) {
draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
}
- else if( (me->drawflag & ME_DRAWEDGES) || (scene->selectmode & SCE_SELECT_EDGE) ) {
- if(cageDM->drawMappedEdgesInterp && (scene->selectmode & SCE_SELECT_VERTEX)) {
+ else if( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) {
+ if(cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) {
glShadeModel(GL_SMOOTH);
draw_dm_edges_sel_interp(cageDM, wireCol, selCol);
glShadeModel(GL_FLAT);
@@ -3664,13 +3669,13 @@ static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ob
}
/* draw edit vertices */
- if(scene->selectmode!=SCE_SELECT_PATH){
+ if(pset->selectmode!=SCE_SELECT_PATH){
glDisableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDisable(GL_LIGHTING);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- if(scene->selectmode==SCE_SELECT_POINT){
+ if(pset->selectmode==SCE_SELECT_POINT){
float *cd=0,*cdata=0;
cd=cdata=MEM_callocN(edit->totkeys*(timed?4:3)*sizeof(float), "particle edit color data");
@@ -3709,7 +3714,7 @@ static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ob
MEM_freeN(cdata);
cd=cdata=0;
}
- else if(scene->selectmode == SCE_SELECT_END){
+ else if(pset->selectmode == SCE_SELECT_END){
for(i=0, pa=psys->particles; i<totpart; i++, pa++){
if((pa->flag & PARS_HIDE)==0){
key = edit->keys[i] + pa->totkey - 1;
@@ -3947,6 +3952,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, int dt)
{
+ ToolSettings *ts= scene->toolsettings;
Object *ob= base->object;
Curve *cu = ob->data;
Nurb *nu;
@@ -3978,7 +3984,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* direction vectors for 3d curve paths
when at its lowest, dont render normals */
- if(cu->flag & CU_3D && scene->editbutsize > 0.0015) {
+ if(cu->flag & CU_3D && ts->normalsize > 0.0015) {
UI_ThemeColor(TH_WIRE);
for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
BevPoint *bevp= (BevPoint *)(bl+1);
@@ -3986,7 +3992,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
int skip= nu->resolu/16;
while (nr-->0) { /* accounts for empty bevel lists */
- float fac= bevp->radius * scene->editbutsize;
+ float fac= bevp->radius * ts->normalsize;
float ox,oy,oz; // Offset perpendicular to the curve
float dx,dy,dz; // Delta along the curve
@@ -5408,6 +5414,7 @@ static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob)
void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
{
+ ToolSettings *ts= scene->toolsettings;
wmMultMatrix(ob->obmat);
@@ -5425,8 +5432,8 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
EM_init_index_arrays(em, 1, 1, 1);
- bbs_mesh_solid_EM(scene, v3d, ob, dm, scene->selectmode & SCE_SELECT_FACE);
- if(scene->selectmode & SCE_SELECT_FACE)
+ bbs_mesh_solid_EM(scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE);
+ if(ts->selectmode & SCE_SELECT_FACE)
em_solidoffs = 1+em->totface;
else
em_solidoffs= 1;
@@ -5438,7 +5445,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
em_wireoffs= em_solidoffs + em->totedge;
// we draw verts if vert select mode or if in transform (for snap).
- if(scene->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
+ if(ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
bbs_mesh_verts(dm, em_wireoffs);
em_vertoffs= em_wireoffs + em->totvert;
}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index b6e9e05b120..91565235591 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1663,7 +1663,7 @@ static void view3d_panel_bonesketch_spaces(const bContext *C, Panel *pa)
uiBlockEndAlign(block);
- uiDefButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_NOP, "Peel Objects", 10, yco, 200, 20, &scene->snap_flag, 0, 0, 0, 0, "Peel whole objects as one");
+ uiDefButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_NOP, "Peel Objects", 10, yco, 200, 20, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Peel whole objects as one");
}
@@ -1710,7 +1710,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
}
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
- uiDefAutoButsRNA(C, pa->layout, &ptr);
+ uiDefAutoButsRNA(C, pa->layout, &ptr, 2);
}
void view3d_buttons_register(ARegionType *art)
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index de0680c6cc1..79ea90864f3 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -1812,6 +1812,7 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
{
#if 0
Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
switch(event) {
case 1:
@@ -1870,22 +1871,22 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
Transform();
break;
case 15:
- scene->snap_flag &= ~SCE_SNAP;
+ ts->snap_flag &= ~SCE_SNAP;
break;
case 16:
- scene->snap_flag |= SCE_SNAP;
+ ts->snap_flag |= SCE_SNAP;
break;
case 17:
- scene->snap_target = SCE_SNAP_TARGET_CLOSEST;
+ ts->snap_target = SCE_SNAP_TARGET_CLOSEST;
break;
case 18:
- scene->snap_target = SCE_SNAP_TARGET_CENTER;
+ ts->snap_target = SCE_SNAP_TARGET_CENTER;
break;
case 19:
- scene->snap_target = SCE_SNAP_TARGET_MEDIAN;
+ ts->snap_target = SCE_SNAP_TARGET_MEDIAN;
break;
case 20:
- scene->snap_target = SCE_SNAP_TARGET_ACTIVE;
+ ts->snap_target = SCE_SNAP_TARGET_ACTIVE;
break;
case 21:
alignmenu();
@@ -1896,7 +1897,7 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
@@ -1948,7 +1949,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if (scene->snap_flag & SCE_SNAP)
+ if (ts->snap_flag & SCE_SNAP)
{
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Grid", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
@@ -1961,7 +1962,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- switch(scene->snap_target)
+ switch(ts->snap_target)
{
case SCE_SNAP_TARGET_CLOSEST:
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
@@ -2650,34 +2651,34 @@ static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unuse
static void do_view3d_edit_propfalloffmenu(bContext *C, void *arg, int event)
{
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
- scene->prop_mode= event;
+ ts->prop_mode= event;
}
static uiBlock *view3d_edit_propfalloffmenu(bContext *C, ARegion *ar, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
block= uiBeginBlock(C, ar, "view3d_edit_propfalloffmenu", UI_EMBOSSP);
uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL);
- if (scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
+ if (ts->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
- if (scene->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
+ if (ts->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
- if (scene->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
+ if (ts->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
- if (scene->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
+ if (ts->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
- if (scene->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
+ if (ts->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
- if (scene->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
+ if (ts->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, "");
- if (scene->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
+ if (ts->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
uiBlockSetDirection(block, UI_RIGHT);
@@ -2698,7 +2699,7 @@ void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event)
make_parent();
break;
case 1: /* remove doubles */
- count= removedoublesflag(1, 0, scene->toolsettings->doublimit);
+ count= removedoublesflag(1, 0, ts->doublimit);
notice("Removed: %d", count);
if (count) { /* only undo and redraw if an action is taken */
DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
@@ -2768,18 +2769,18 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event)
switch(event) {
case 0: /* subdivide smooth */
- esubdivideflag(1, 0.0, scene->toolsettings->editbutflag | B_SMOOTH,1,0);
+ esubdivideflag(1, 0.0, ts->editbutflag | B_SMOOTH,1,0);
ED_undo_push(C, "Subdivide Smooth");
break;
case 1: /*subdivide fractal */
randfac= 10;
if(button(&randfac, 1, 100, "Rand fac:")==0) return;
fac= -( (float)randfac )/100;
- esubdivideflag(1, fac, scene->toolsettings->editbutflag,1,0);
+ esubdivideflag(1, fac, ts->editbutflag,1,0);
ED_undo_push(C, "Subdivide Fractal");
break;
case 2: /* subdivide */
- esubdivideflag(1, 0.0, scene->toolsettings->editbutflag,1,0);
+ esubdivideflag(1, 0.0, ts->editbutflag,1,0);
ED_undo_push(C, "Subdivide");
break;
case 3: /* knife subdivide */
@@ -3142,6 +3143,7 @@ static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg
static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
{
#if 0
+ ToolSettings *ts= CTX_data_tool_settings(C);
Scene *scene= CTX_data_scene(C);
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
@@ -3185,12 +3187,12 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
Transform();
break;
case 12: /* proportional edit (toggle) */
- if(scene->proportional) scene->proportional= 0;
- else scene->proportional= 1;
+ if(ts->proportional) ts->proportional= 0;
+ else ts->proportional= 1;
break;
case 13: /* automerge edit (toggle) */
- if(scene->automerge) scene->automerge= 0;
- else scene->automerge= 1;
+ if(ts->automerge) ts->automerge= 0;
+ else ts->automerge= 1;
break;
case 15:
uv_autocalc_tface();
@@ -3204,7 +3206,7 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -3250,7 +3252,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
- if(scene->proportional) {
+ if(ts->proportional) {
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
} else {
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
@@ -3261,7 +3263,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
/* PITA but we should let users know that automerge cant work with multires :/ */
uiDefIconTextBut(block, BUTM, 1,
- scene->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
+ ts->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
((Mesh*)obedit->data)->mr ? "AutoMerge Editing (disabled by multires)" : "AutoMerge Editing",
0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
@@ -3536,8 +3538,8 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event)
Transform();
break;
case 5: /* proportional edit (toggle) */
- if(scene->proportional) scene->proportional= 0;
- else scene->proportional= 1;
+ if(ts->proportional) ts->proportional= 0;
+ else ts->proportional= 1;
break;
case 7: /* delete keyframe */
common_deletekey();
@@ -3548,7 +3550,7 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event)
static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -3574,7 +3576,7 @@ static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unus
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if(scene->proportional) {
+ if(ts->proportional) {
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
} else {
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -4695,7 +4697,7 @@ static uiBlock *view3d_faceselmenu(bContext *C, ARegion *ar, void *arg_unused)
static void view3d_select_particlemenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border");
@@ -4704,7 +4706,7 @@ static void view3d_select_particlemenu(bContext *C, uiLayout *layout, void *arg_
uiItemO(layout, NULL, 0, "PARTICLE_OT_select_all_toggle");
uiItemO(layout, NULL, 0, "PARTICLE_OT_select_linked");
- if(scene->selectmode & SCE_SELECT_POINT) {
+ if(ts->particle.selectmode & SCE_SELECT_POINT) {
uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last"); // |W, 4
uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first"); // |W, 3
}
@@ -4724,7 +4726,7 @@ static void view3d_particle_showhidemenu(bContext *C, uiLayout *layout, void *ar
static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
// XXX uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Particle Edit Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
// add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
@@ -4739,7 +4741,7 @@ static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused)
uiItemO(layout, NULL, 0, "PARTICLE_OT_remove_doubles"); // |W, 5
uiItemO(layout, NULL, 0, "PARTICLE_OT_delete");
- if(scene->selectmode & SCE_SELECT_POINT)
+ if(ts->particle.selectmode & SCE_SELECT_POINT)
uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide"); // |W, 2
uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey"); // |W, 1
@@ -4873,6 +4875,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
{
wmWindow *win= CTX_wm_window(C);
Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
Base *basact= CTX_data_active_base(C);
@@ -5007,7 +5010,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
if(em) {
if(shift==0 || em->selectmode==0)
em->selectmode= SCE_SELECT_VERTEX;
- scene->selectmode= em->selectmode;
+ ts->selectmode= em->selectmode;
EM_selectmode_set(em);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
ED_undo_push(C, "Selectmode Set: Vertex");
@@ -5021,7 +5024,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
}
em->selectmode = SCE_SELECT_EDGE;
}
- scene->selectmode= em->selectmode;
+ ts->selectmode= em->selectmode;
EM_selectmode_set(em);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
ED_undo_push(C, "Selectmode Set: Edge");
@@ -5030,12 +5033,12 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
case B_SEL_FACE:
if(em) {
if( shift==0 || em->selectmode==0){
- if( ((scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
- if(ctrl) EM_convertsel(em, (scene->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
+ if( ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
+ if(ctrl) EM_convertsel(em, (ts->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
}
em->selectmode = SCE_SELECT_FACE;
}
- scene->selectmode= em->selectmode;
+ ts->selectmode= em->selectmode;
EM_selectmode_set(em);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
ED_undo_push(C, "Selectmode Set: Face");
@@ -5043,15 +5046,15 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
break;
case B_SEL_PATH:
- scene->selectmode= SCE_SELECT_PATH;
+ ts->particle.selectmode= SCE_SELECT_PATH;
ED_undo_push(C, "Selectmode Set: Path");
break;
case B_SEL_POINT:
- scene->selectmode = SCE_SELECT_POINT;
+ ts->particle.selectmode = SCE_SELECT_POINT;
ED_undo_push(C, "Selectmode Set: Point");
break;
case B_SEL_END:
- scene->selectmode = SCE_SELECT_END;
+ ts->particle.selectmode = SCE_SELECT_END;
ED_undo_push(C, "Selectmode Set: End point");
break;
@@ -5280,6 +5283,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *ob= OBACT;
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
@@ -5449,11 +5453,11 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
if((obedit && (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || G.f & G_PARTICLEEDIT) {
uiBlockBeginAlign(block);
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(scene->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) ");
+ uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(ts->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) ");
xco+= XIC+10;
- if(scene->proportional) {
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,yco,XIC+10,YIC, &(scene->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
+ if(ts->proportional) {
+ uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,yco,XIC+10,YIC, &(ts->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
xco+= XIC+10;
}
uiBlockEndAlign(block);
@@ -5464,21 +5468,21 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
if (BIF_snappingSupported(obedit)) {
uiBlockBeginAlign(block);
- if (scene->snap_flag & SCE_SNAP) {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
+ if (ts->snap_flag & SCE_SNAP) {
+ uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
xco+= XIC;
- uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target");
+ uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target");
xco+= XIC;
- if (scene->snap_mode == SCE_SNAP_MODE_VOLUME) {
- uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center");
+ if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) {
+ uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center");
xco+= XIC;
}
- uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_VERTEX, snapmode_pup(), xco,yco,XIC+10,YIC, &(scene->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
+ uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_VERTEX, snapmode_pup(), xco,yco,XIC+10,YIC, &(ts->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
xco+= XIC;
- uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
+ uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &ts->snap_target, 0, 0, 0, 0, "Snap Target Mode");
xco+= XIC+70;
} else {
- uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
+ uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");
xco+= XIC;
}
@@ -5509,11 +5513,11 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
}
else if(G.f & G_PARTICLEEDIT) {
uiBlockBeginAlign(block);
- uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode");
+ uiDefIconButBitI(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Path edit mode");
xco+= XIC;
- uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode");
+ uiDefIconButBitI(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Point select mode");
xco+= XIC;
- uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode");
+ uiDefIconButBitI(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Tip select mode");
xco+= XIC;
uiBlockEndAlign(block);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index e0e8ac7c7a7..a153f795292 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -438,6 +438,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, in
static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves, short select)
{
struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } data;
+ ToolSettings *ts= vc->scene->toolsettings;
rcti rect;
int bbsel;
@@ -456,14 +457,14 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves
bbsel= EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
- if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
+ if(ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
EM_backbuf_checkAndSelectVerts(vc->em, select);
} else {
mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, 1);
}
}
- if(vc->scene->selectmode & SCE_SELECT_EDGE) {
+ if(ts->selectmode & SCE_SELECT_EDGE) {
/* Does both bbsel and non-bbsel versions (need screen cos for both) */
data.pass = 0;
@@ -475,7 +476,7 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves
}
}
- if(vc->scene->selectmode & SCE_SELECT_FACE) {
+ if(ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
EM_backbuf_checkAndSelectFaces(vc->em, select);
} else {
@@ -1277,6 +1278,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int
static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
{
struct { ViewContext vc; rcti *rect; short select, pass, done; } data;
+ ToolSettings *ts= vc->scene->toolsettings;
int bbsel;
data.vc= *vc;
@@ -1287,14 +1289,14 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
- if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
+ if(ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
EM_backbuf_checkAndSelectVerts(vc->em, select);
} else {
mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, 1);
}
}
- if(vc->scene->selectmode & SCE_SELECT_EDGE) {
+ if(ts->selectmode & SCE_SELECT_EDGE) {
/* Does both bbsel and non-bbsel versions (need screen cos for both) */
data.pass = 0;
@@ -1306,7 +1308,7 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select)
}
}
- if(vc->scene->selectmode & SCE_SELECT_FACE) {
+ if(ts->selectmode & SCE_SELECT_FACE) {
if(bbsel) {
EM_backbuf_checkAndSelectFaces(vc->em, select);
} else {
@@ -1639,6 +1641,7 @@ static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y
static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, float rad)
{
+ ToolSettings *ts= vc->scene->toolsettings;
int bbsel;
if(vc->obedit==NULL && (FACESEL_PAINT_TEST)) {
@@ -1666,7 +1669,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa
data.mval[1] = mval[1];
data.radius = rad;
- if(vc->scene->selectmode & SCE_SELECT_VERTEX) {
+ if(ts->selectmode & SCE_SELECT_VERTEX) {
if(bbsel) {
EM_backbuf_checkAndSelectVerts(vc->em, selecting==LEFTMOUSE);
} else {
@@ -1674,7 +1677,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa
}
}
- if(vc->scene->selectmode & SCE_SELECT_EDGE) {
+ if(ts->selectmode & SCE_SELECT_EDGE) {
if (bbsel) {
EM_backbuf_checkAndSelectEdges(vc->em, selecting==LEFTMOUSE);
} else {
@@ -1682,7 +1685,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa
}
}
- if(vc->scene->selectmode & SCE_SELECT_FACE) {
+ if(ts->selectmode & SCE_SELECT_FACE) {
if(bbsel) {
EM_backbuf_checkAndSelectFaces(vc->em, selecting==LEFTMOUSE);
} else {
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 1e55f2e4a9a..15254ba505e 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -120,8 +120,6 @@ static void redo_cb(bContext *C, void *arg_op, void *arg2)
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
{
- /* XXX temp */
- extern void uiDefAutoButsRNA_single(const bContext *C, uiLayout *layout, PointerRNA *ptr);
wmWindowManager *wm= CTX_wm_manager(C);
wmOperator *op;
PointerRNA ptr;
@@ -147,7 +145,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
}
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
- uiDefAutoButsRNA_single(C, pa->layout, &ptr);
+ uiDefAutoButsRNA(C, pa->layout, &ptr, 1);
}
void view3d_toolbar_register(ARegionType *art)
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 2db5f2c97fd..782d426641f 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -76,11 +76,12 @@
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "GPU_draw.h"
+
#include "PIL_time.h" /* smoothview */
#include "view3d_intern.h" // own include
-
/* use this call when executing an operator,
event system doesn't set for each event the
opengl drawing context */
diff --git a/source/blender/editors/transform/Makefile b/source/blender/editors/transform/Makefile
index bc3e08a2ae8..607038b413b 100644
--- a/source/blender/editors/transform/Makefile
+++ b/source/blender/editors/transform/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index a417aa46773..ded6edbbb0e 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1137,7 +1137,7 @@ void drawTransform(const struct bContext *C, struct ARegion *ar, void *arg)
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
{
- Scene *sce = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
int constraint_axis[3] = {0, 0, 0};
int proportional = 0;
@@ -1198,8 +1198,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
// XXX If modal, save settings back in scene
if (t->flag & T_MODAL)
{
- sce->prop_mode = t->prop_mode;
- sce->proportional = proportional;
+ ts->prop_mode = t->prop_mode;
+ ts->proportional = proportional;
if(t->spacetype == SPACE_VIEW3D)
{
@@ -2362,7 +2362,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
}
else if (t->flag & T_EDIT) {
- if(t->around==V3D_LOCAL && (t->scene->selectmode & SCE_SELECT_FACE)) {
+ if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
VECCOPY(center, td->center);
}
else {
@@ -2663,7 +2663,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
}
else {
/* !TODO! Make this if not rely on G */
- if(around==V3D_LOCAL && (t->scene->selectmode & SCE_SELECT_FACE)) {
+ if(around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
center = td->center;
}
}
@@ -3129,7 +3129,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
sprintf(distvec, "%.4f", dist);
if(t->flag & T_AUTOIK) {
- short chainlen= t->scene->toolsettings->autoik_chainlen;
+ short chainlen= t->settings->autoik_chainlen;
if(chainlen)
sprintf(autoik, "AutoIK-Len: %d", chainlen);
@@ -4254,7 +4254,7 @@ int Align(TransInfo *t, short mval[2])
VECCOPY(t->center, td->center);
}
else {
- if(t->scene->selectmode & SCE_SELECT_FACE) {
+ if(t->settings->selectmode & SCE_SELECT_FACE) {
VECCOPY(t->center, td->center);
}
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index c0a57a85033..1b35701a753 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -264,6 +264,7 @@ typedef struct TransInfo {
struct ScrArea *sa;
struct ARegion *ar;
struct Scene *scene;
+ struct ToolSettings *settings;
struct wmTimer *animtimer;
short mval[2]; /* current mouse position */
struct Object *obedit;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 1f75384880e..08ce1b1d554 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -778,7 +778,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen)
/* change the chain-length of auto-ik */
void transform_autoik_update (TransInfo *t, short mode)
{
- short *chainlen= &t->scene->toolsettings->autoik_chainlen;
+ short *chainlen= &t->settings->autoik_chainlen;
bPoseChannel *pchan;
/* mode determines what change to apply to chainlen */
@@ -1632,7 +1632,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
int count = 0, hasselected = 0;
int propmode = t->flag & T_PROP_EDIT;
- if(psys==NULL || t->scene->selectmode==SCE_SELECT_PATH) return;
+ if(psys==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
psmd = psys_get_modifier(ob,psys);
@@ -2102,7 +2102,7 @@ void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) {
static void createTransEditVerts(bContext *C, TransInfo *t)
{
- Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
TransData *tob = NULL;
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
EditVert *eve;
@@ -2120,7 +2120,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
// transform now requires awareness for select mode, so we tag the f1 flags in verts
- if(scene->selectmode & SCE_SELECT_VERTEX) {
+ if(ts->selectmode & SCE_SELECT_VERTEX) {
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->h==0 && (eve->f & SELECT))
eve->f1= SELECT;
@@ -2128,7 +2128,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
eve->f1= 0;
}
}
- else if(scene->selectmode & SCE_SELECT_EDGE) {
+ else if(ts->selectmode & SCE_SELECT_EDGE) {
EditEdge *eed;
for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
for(eed= em->edges.first; eed; eed= eed->next) {
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index a60135107bc..db7c6d6ee99 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -622,6 +622,7 @@ void resetTransRestrictions(TransInfo *t)
int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
{
Scene *sce = CTX_data_scene(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
ARegion *ar = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
Object *obedit = CTX_data_edit_object(C);
@@ -636,6 +637,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->sa = sa;
t->ar = ar;
t->obedit = obedit;
+ t->settings = ts;
t->data = NULL;
t->ext = NULL;
@@ -709,9 +711,10 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE)
{
+ SpaceImage *sima = sa->spacedata.first;
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
- t->around = ar->v2d.around;
+ t->around = sima->around;
}
else
{
@@ -731,7 +734,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
// Need stuff to take it from edit mesh or whatnot here
else
{
- if (t->obedit && t->obedit->type == OB_MESH && sce->toolsettings->editbutflag & B_MESH_X_MIRROR)
+ if (t->obedit && t->obedit->type == OB_MESH && ts->editbutflag & B_MESH_X_MIRROR)
{
t->flag |= T_MIRROR;
}
@@ -751,10 +754,10 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
else
{
- if ((t->options & CTX_NO_PET) == 0 && (sce->proportional)) {
+ if ((t->options & CTX_NO_PET) == 0 && (ts->proportional)) {
t->flag |= T_PROP_EDIT;
- if(sce->proportional == 2)
+ if(ts->proportional == 2)
t->flag |= T_PROP_CONNECTED; // yes i know, has to become define
}
}
@@ -765,7 +768,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
else
{
- t->prop_size = sce->toolsettings->proportional_size;
+ t->prop_size = ts->proportional_size;
}
if (op && RNA_struct_find_property(op->ptr, "proportional_editing_falloff") && RNA_property_is_set(op->ptr, "proportional_editing_falloff"))
@@ -774,7 +777,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
else
{
- t->prop_mode = sce->prop_mode;
+ t->prop_mode = ts->prop_mode;
}
/* TRANSFORM_FIX_ME rna restrictions */
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 76b3f58f75c..631eb1eb134 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -1,5 +1,5 @@
/**
- * $Id: transform_input.c 18142 2008-12-29 07:19:16Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index de731ad7d95..28606932c64 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -1,5 +1,5 @@
/**
- * $Id: transform_ops.c 17542 2008-11-23 15:27:53Z theeth $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 72901110388..0b9a176dbdf 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -210,7 +210,7 @@ int handleSnapping(TransInfo *t, wmEvent *event)
if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift)
{
/* toggle snap and reinit */
- t->scene->snap_flag ^= SCE_SNAP;
+ t->settings->snap_flag ^= SCE_SNAP;
initSnapping(t, NULL);
status = 1;
}
@@ -282,10 +282,10 @@ int validSnappingNormal(TransInfo *t)
void initSnapping(TransInfo *t, wmOperator *op)
{
- Scene *scene = t->scene;
+ ToolSettings *ts = t->settings;
Object *obedit = t->obedit;
int snapping = 0;
- short snap_mode = t->scene->snap_target;
+ short snap_mode = t->settings->snap_target;
resetSnapping(t);
@@ -310,8 +310,8 @@ void initSnapping(TransInfo *t, wmOperator *op)
}
else
{
- snapping = ((scene->snap_flag & SCE_SNAP) == SCE_SNAP);
- t->tsnap.align = ((t->scene->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE);
+ snapping = ((ts->snap_flag & SCE_SNAP) == SCE_SNAP);
+ t->tsnap.align = ((t->settings->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE);
}
if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) && // Only 3D view or UV
@@ -542,7 +542,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
int dist = SNAP_MIN_DISTANCE; // Use a user defined value here
SnapMode mode;
- if (t->scene->snap_mode == SCE_SNAP_MODE_VOLUME)
+ if (t->settings->snap_mode == SCE_SNAP_MODE_VOLUME)
{
ListBase depth_peels;
DepthPeel *p1, *p2;
@@ -575,7 +575,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
p1->flag = 1;
/* if peeling objects, take the first and last from each object */
- if (t->scene->snap_flag & SCE_SNAP_PEEL_OBJECT)
+ if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT)
{
DepthPeel *peel;
for (peel = p1->next; peel; peel = peel->next)
@@ -1346,6 +1346,7 @@ int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, E
int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], float ray_start[3], float ray_normal[3], short mval[2], float *loc, float *no, int *dist, float *depth)
{
+ ToolSettings *ts= scene->toolsettings;
int retval = 0;
if (ob->type == OB_MESH) {
@@ -1363,13 +1364,13 @@ int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obma
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
}
- retval = snapDerivedMesh(scene->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+ retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
dm->release(dm);
}
else if (ob->type == OB_ARMATURE)
{
- retval = snapArmature(scene->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+ retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
}
return retval;
diff --git a/source/blender/editors/util/Makefile b/source/blender/editors/util/Makefile
index da701dc5d86..303079daeee 100644
--- a/source/blender/editors/util/Makefile
+++ b/source/blender/editors/util/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/uvedit/Makefile b/source/blender/editors/uvedit/Makefile
index b8a8f0bc8af..d589bbec3bc 100644
--- a/source/blender/editors/uvedit/Makefile
+++ b/source/blender/editors/uvedit/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index aded5a4cff9..b811906f5e5 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -102,17 +102,19 @@ static void drawcursor_sima(SpaceImage *sima, ARegion *ar)
static int draw_uvs_face_check(Scene *scene)
{
+ ToolSettings *ts= scene->toolsettings;
+
/* checks if we are selecting only faces */
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode == SCE_SELECT_FACE)
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode == SCE_SELECT_FACE)
return 2;
- else if(scene->selectmode & SCE_SELECT_FACE)
+ else if(ts->selectmode & SCE_SELECT_FACE)
return 1;
else
return 0;
}
else
- return (scene->toolsettings->uv_selectmode == UV_SELECT_FACE);
+ return (ts->uv_selectmode == UV_SELECT_FACE);
}
static void draw_uvs_shadow(SpaceImage *sima, Object *obedit)
@@ -418,7 +420,7 @@ static void draw_uvs_other(SpaceImage *sima, Scene *scene, Object *obedit, MTFac
/* draws uv's in the image space */
static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
{
- ToolSettings *settings;
+ ToolSettings *ts;
Mesh *me= obedit->data;
EditMesh *em;
EditFace *efa, *efa_act;
@@ -432,13 +434,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
em= BKE_mesh_get_editmesh(me);
activetf= EM_get_active_mtface(em, &efa_act, NULL, 0); /* will be set to NULL if hidden */
- settings= scene->toolsettings;
+ ts= scene->toolsettings;
drawfaces= draw_uvs_face_check(scene);
- if(settings->uv_flag & UV_SYNC_SELECTION)
- interpedges= (scene->selectmode & SCE_SELECT_VERTEX);
+ if(ts->uv_flag & UV_SYNC_SELECTION)
+ interpedges= (ts->selectmode & SCE_SELECT_VERTEX);
else
- interpedges= (settings->uv_selectmode == UV_SELECT_VERTEX);
+ interpedges= (ts->uv_selectmode == UV_SELECT_VERTEX);
/* draw other uvs */
if(sima->flag & SI_DRAW_OTHER)
@@ -454,7 +456,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
/* when sync selection is enabled, all faces are drawn (except for hidden)
* so if cage is the same as the final, theres no point in drawing this */
- if(!((settings->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
+ if(!((ts->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
draw_uvs_dm_shadow(finaldm);
/* release derivedmesh again */
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 7dca4d34c48..7582145c63b 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -191,7 +191,9 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist
int uvedit_face_visible_nolocal(Scene *scene, EditFace *efa)
{
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SYNC_SELECTION)
return (efa->h==0);
else
return (efa->h==0 && (efa->f & SELECT));
@@ -199,7 +201,9 @@ int uvedit_face_visible_nolocal(Scene *scene, EditFace *efa)
int uvedit_face_visible(Scene *scene, Image *ima, EditFace *efa, MTFace *tf)
{
- if(scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SHOW_SAME_IMAGE)
return (tf->tpage==ima)? uvedit_face_visible_nolocal(scene, efa): 0;
else
return uvedit_face_visible_nolocal(scene, efa);
@@ -207,7 +211,9 @@ int uvedit_face_visible(Scene *scene, Image *ima, EditFace *efa, MTFace *tf)
int uvedit_face_selected(Scene *scene, EditFace *efa, MTFace *tf)
{
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SYNC_SELECTION)
return (efa->f & SELECT);
else
return (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4));
@@ -215,7 +221,9 @@ int uvedit_face_selected(Scene *scene, EditFace *efa, MTFace *tf)
void uvedit_face_select(Scene *scene, EditFace *efa, MTFace *tf)
{
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SYNC_SELECTION)
EM_select_face(efa, 1);
else
tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
@@ -223,7 +231,9 @@ void uvedit_face_select(Scene *scene, EditFace *efa, MTFace *tf)
void uvedit_face_deselect(Scene *scene, EditFace *efa, MTFace *tf)
{
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SYNC_SELECTION)
EM_select_face(efa, 0);
else
tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
@@ -231,12 +241,13 @@ void uvedit_face_deselect(Scene *scene, EditFace *efa, MTFace *tf)
int uvedit_edge_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
{
+ ToolSettings *ts= scene->toolsettings;
int nvert= (efa->v4)? 4: 3;
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode == SCE_SELECT_FACE)
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode == SCE_SELECT_FACE)
return (efa->f & SELECT);
- else if(scene->selectmode == SCE_SELECT_EDGE)
+ else if(ts->selectmode == SCE_SELECT_EDGE)
return (*(&efa->e1 + i))->f & SELECT;
else
return (((efa->v1 + i)->f & SELECT) && ((efa->v1 + (i+1)%nvert)->f & SELECT));
@@ -247,12 +258,13 @@ int uvedit_edge_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_edge_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
{
+ ToolSettings *ts= scene->toolsettings;
int nvert= (efa->v4)? 4: 3;
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode == SCE_SELECT_FACE)
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode == SCE_SELECT_FACE)
EM_select_face(efa, 1);
- else if(scene->selectmode == SCE_SELECT_EDGE)
+ else if(ts->selectmode == SCE_SELECT_EDGE)
EM_select_edge((*(&efa->e1 + i)), 1);
else {
(efa->v1 + i)->f |= SELECT;
@@ -265,12 +277,13 @@ void uvedit_edge_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_edge_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
{
+ ToolSettings *ts= scene->toolsettings;
int nvert= (efa->v4)? 4: 3;
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode == SCE_SELECT_FACE)
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode == SCE_SELECT_FACE)
EM_select_face(efa, 0);
- else if(scene->selectmode == SCE_SELECT_EDGE)
+ else if(ts->selectmode == SCE_SELECT_EDGE)
EM_select_edge((*(&efa->e1 + i)), 0);
else {
(efa->v1 + i)->f &= ~SELECT;
@@ -283,8 +296,10 @@ void uvedit_edge_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
int uvedit_uv_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
{
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode == SCE_SELECT_FACE)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode == SCE_SELECT_FACE)
return (efa->f & SELECT);
else
return (*(&efa->v1 + i))->f & SELECT;
@@ -295,8 +310,10 @@ int uvedit_uv_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_uv_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
{
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode == SCE_SELECT_FACE)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode == SCE_SELECT_FACE)
EM_select_face(efa, 1);
else
(*(&efa->v1 + i))->f |= SELECT;
@@ -307,8 +324,10 @@ void uvedit_uv_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_uv_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
{
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode == SCE_SELECT_FACE)
+ ToolSettings *ts= scene->toolsettings;
+
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode == SCE_SELECT_FACE)
EM_select_face(efa, 0);
else
(*(&efa->v1 + i))->f &= ~SELECT;
@@ -1289,6 +1308,7 @@ void UV_OT_stitch(wmOperatorType *ot)
static int select_inverse_exec(bContext *C, wmOperator *op)
{
Scene *scene;
+ ToolSettings *ts;
Object *obedit;
EditMesh *em;
EditFace *efa;
@@ -1296,11 +1316,12 @@ static int select_inverse_exec(bContext *C, wmOperator *op)
MTFace *tf;
scene= CTX_data_scene(C);
+ ts= CTX_data_tool_settings(C);
obedit= CTX_data_edit_object(C);
em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
ima= CTX_data_edit_image(C);
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
EM_select_swap(em);
}
else {
@@ -1339,6 +1360,7 @@ void UV_OT_select_invert(wmOperatorType *ot)
static int de_select_all_exec(bContext *C, wmOperator *op)
{
Scene *scene;
+ ToolSettings *ts;
Object *obedit;
EditMesh *em;
EditFace *efa;
@@ -1347,11 +1369,12 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
int sel;
scene= CTX_data_scene(C);
+ ts= CTX_data_tool_settings(C);
obedit= CTX_data_edit_object(C);
em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
ima= CTX_data_edit_image(C);
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
EM_toggle_select_all(em);
}
else {
@@ -1431,6 +1454,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
{
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C);
Image *ima= CTX_data_edit_image(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
@@ -1445,12 +1469,12 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
uvedit_pixel_to_float(sima, penalty, 5.0f);
/* retrieve operation mode */
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
sync= 1;
- if(scene->selectmode & SCE_SELECT_FACE)
+ if(ts->selectmode & SCE_SELECT_FACE)
selectmode= UV_SELECT_FACE;
- else if(scene->selectmode & SCE_SELECT_EDGE)
+ else if(ts->selectmode & SCE_SELECT_EDGE)
selectmode= UV_SELECT_EDGE;
else
selectmode= UV_SELECT_VERTEX;
@@ -1459,7 +1483,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
else {
sync= 0;
- selectmode= scene->toolsettings->uv_selectmode;
+ selectmode= ts->uv_selectmode;
sticky= sima->sticky;
}
@@ -1681,7 +1705,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
if(sync) {
/* flush for mesh selection */
- if(scene->selectmode != SCE_SELECT_FACE) {
+ if(ts->selectmode != SCE_SELECT_FACE) {
if(flush==1) EM_select_flush(em);
else if(flush==-1) EM_deselect_flush(em);
}
@@ -1794,13 +1818,14 @@ static int select_linked_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C);
Image *ima= CTX_data_edit_image(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
float limit[2];
int extend;
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled.");
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_CANCELLED;
@@ -1838,13 +1863,14 @@ void UV_OT_select_linked(wmOperatorType *ot)
static int unlink_selection_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C);
Image *ima= CTX_data_edit_image(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
EditFace *efa;
MTFace *tf;
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
BKE_report(op->reports, RPT_ERROR, "Can't unlink selection when sync selection is enabled.");
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_CANCELLED;
@@ -1901,12 +1927,13 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
* This only needs to be done when the Mesh is not used for
* selection (so for sticky modes, vertex or location based). */
+ ToolSettings *ts= CTX_data_tool_settings(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
EditFace *efa;
MTFace *tf;
int nverts, i;
- if((scene->toolsettings->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) {
+ if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) {
/* Tag all verts as untouched, then touch the ones that have a face center
* in the loop and select all MTFace UV's that use a touched vert. */
EditVert *eve;
@@ -1937,7 +1964,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
}
}
}
- else if((scene->toolsettings->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) {
+ else if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) {
EditFace *efa_vlist;
MTFace *tf_vlist;
UvMapVert *start_vlist=NULL, *vlist_iter;
@@ -2008,7 +2035,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
EM_free_uv_vert_map(vmap);
}
- else { /* SI_STICKY_DISABLE or scene->toolsettings->uv_flag & UV_SYNC_SELECTION */
+ else { /* SI_STICKY_DISABLE or ts->uv_flag & UV_SYNC_SELECTION */
for(efa= em->faces.first; efa; efa= efa->next) {
if(efa->tmp.l) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -2026,6 +2053,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C);
Image *ima= CTX_data_edit_image(C);
ARegion *ar= CTX_wm_region(C);
@@ -2049,10 +2077,10 @@ static int border_select_exec(bContext *C, wmOperator *op)
select= (RNA_int_get(op->ptr, "event_type") == LEFTMOUSE); // XXX hardcoded
pinned= RNA_boolean_get(op->ptr, "pinned");
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION)
- faces= (scene->selectmode == SCE_SELECT_FACE);
+ if(ts->uv_flag & UV_SYNC_SELECTION)
+ faces= (ts->selectmode == SCE_SELECT_FACE);
else
- faces= (scene->toolsettings->uv_selectmode == UV_SELECT_FACE);
+ faces= (ts->uv_selectmode == UV_SELECT_FACE);
/* do actual selection */
if(faces && !pinned) {
@@ -2084,7 +2112,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
for(efa= em->faces.first; efa; efa= efa->next) {
tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(uvedit_face_visible(scene, ima, efa, tface)) {
- if(!pinned || (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) ) {
+ if(!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
/* UV_SYNC_SELECTION - can't do pinned selection */
if(BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
if(select) uvedit_uv_select(scene, efa, tface, 0);
@@ -2133,8 +2161,8 @@ static int border_select_exec(bContext *C, wmOperator *op)
if(change) {
/* make sure newly selected vert selection is updated*/
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(scene->selectmode != SCE_SELECT_FACE) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->selectmode != SCE_SELECT_FACE) {
if(select) EM_select_flush(em);
else EM_deselect_flush(em);
}
@@ -2668,14 +2696,14 @@ void UV_OT_select_pinned(wmOperatorType *ot)
static int hide_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
EditFace *efa;
MTFace *tf;
int swap= RNA_boolean_get(op->ptr, "unselected");
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
EM_hide_mesh(em, swap);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
@@ -2811,14 +2839,14 @@ void UV_OT_hide(wmOperatorType *ot)
static int reveal_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
- Scene *scene= CTX_data_scene(C);
+ ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
EditFace *efa;
MTFace *tf;
/* call the mesh function if we are in mesh sync sel */
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+ if(ts->uv_flag & UV_SYNC_SELECTION) {
EM_reveal_mesh(em);
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index b10f35b9091..05f1cc1f351 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -34,6 +34,8 @@
#include "DNA_ID.h"
+struct AnimData;
+
typedef struct HairKey {
float co[3]; /* location of hair vertex */
float time; /* time along hair, default 0-100 */
@@ -100,6 +102,7 @@ typedef struct ParticleData {
typedef struct ParticleSettings {
ID id;
+ struct AnimData *adt;
int flag;
short type, from, distr;
@@ -167,7 +170,7 @@ typedef struct ParticleSettings {
struct Group *eff_group;
struct Object *dup_ob;
struct Object *bb_ob;
- struct Ipo *ipo;
+ struct Ipo *ipo; // xxx depreceated... old animation system
struct PartDeflect *pd;
struct PartDeflect *pd2;
} ParticleSettings;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 89db9ae3ee8..d0cd169905f 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -47,6 +47,7 @@ struct Group;
struct Text;
struct bNodeTree;
struct AnimData;
+struct Editing;
typedef struct Base {
struct Base *next, *prev;
@@ -382,6 +383,8 @@ typedef struct ParticleEditSettings {
float emitterdist;
int draw_timed;
+
+ int selectmode, pad;
} ParticleEditSettings;
typedef struct TransformOrientation {
@@ -441,14 +444,19 @@ typedef struct ToolSettings {
short editbutflag;
/*Triangle to Quad conversion threshold*/
float jointrilimit;
- /* Extrude Tools */
+ /* Editmode Tools */
float degr;
short step;
short turn;
- float extr_offs;
- float doublimit;
-
+ float extr_offs; /* extrude offset */
+ float doublimit; /* remove doubles limit */
+ float normalsize; /* size of normals */
+ short automerge;
+
+ /* Selection Mode for Mesh */
+ short selectmode;
+
/* Primitive Settings */
/* UV Sphere */
short segments;
@@ -484,8 +492,11 @@ typedef struct ToolSettings {
/* Select Group Threshold */
float select_thresh;
- /* IPO-Editor */
+ /* Graph Editor */
float clean_thresh;
+
+ /* Auto-Keying Mode */
+ short autokey_mode, pad2; /* defines in DNA_userdef_types.h */
/* Retopo */
char retopo_mode;
@@ -512,7 +523,6 @@ typedef struct ToolSettings {
char skgen_postpro_passes;
char skgen_subdivisions[3];
char skgen_multi_level;
- int skgen_pad;
/* Skeleton Sketching */
struct Object *skgen_template;
@@ -526,7 +536,10 @@ typedef struct ToolSettings {
/* Alt+RMB option */
char edge_mode;
- char pad3[2];
+
+ /* transform */
+ short snap_mode, snap_flag, snap_target;
+ short proportional, prop_mode;
} ToolSettings;
typedef struct bStats {
@@ -547,28 +560,22 @@ typedef struct Scene {
struct Image *ima;
ListBase base;
- struct Base *basact;
+ struct Base *basact; /* active base */
struct Object *obedit; /* name replaces old G.obedit */
- float cursor[3];
+ float cursor[3]; /* 3d cursor location */
float twcent[3]; /* center for transform widget */
float twmin[3], twmax[3]; /* boundbox of selection for transform widget */
unsigned int lay;
- /* editmode stuff */
- float editbutsize; /* size of normals */
- short selectmode; /* for mesh only! */
- short proportional, prop_mode;
- short automerge, pad5;
short flag; /* various settings */
- short autokey_mode; /* mode for autokeying (defines in DNA_userdef_types.h) */
short use_nodes;
struct bNodeTree *nodetree;
- void *ed; /* sequence editor data is allocated here */
+ struct Editing *ed; /* sequence editor data is allocated here */
struct GameFraming framing;
@@ -578,20 +585,20 @@ typedef struct Scene {
/* migrate or replace? depends on some internal things... */
/* no, is on the right place (ton) */
struct RenderData r;
- struct AudioData audio; /* DEPRICATED 2.5 */
+ struct AudioData audio; /* DEPRECATED 2.5 */
ScriptLink scriptlink;
ListBase markers;
ListBase transform_spaces;
- short jumpframe;
- short snap_mode, snap_flag, snap_target;
/* none of the dependancy graph vars is mean to be saved */
struct DagForest *theDag;
short dagisvalid, dagflags;
- short pad4, recalc; /* recalc = counterpart of ob->recalc */
+ short recalc; /* recalc = counterpart of ob->recalc */
+
+ short jumpframe;
/* frame step. */
int frame_step;
@@ -791,27 +798,27 @@ typedef struct Scene {
/* base->flag is in DNA_object_types.h */
-/* scene->snap_flag */
+/* toolsettings->snap_flag */
#define SCE_SNAP 1
#define SCE_SNAP_ROTATE 2
#define SCE_SNAP_PEEL_OBJECT 4
-/* scene->snap_target */
+/* toolsettings->snap_target */
#define SCE_SNAP_TARGET_CLOSEST 0
#define SCE_SNAP_TARGET_CENTER 1
#define SCE_SNAP_TARGET_MEDIAN 2
#define SCE_SNAP_TARGET_ACTIVE 3
-/* scene->snap_mode */
+/* toolsettings->snap_mode */
#define SCE_SNAP_MODE_VERTEX 0
#define SCE_SNAP_MODE_EDGE 1
#define SCE_SNAP_MODE_FACE 2
#define SCE_SNAP_MODE_VOLUME 3
-/* sce->selectmode */
+/* toolsettings->selectmode */
#define SCE_SELECT_VERTEX 1 /* for mesh */
#define SCE_SELECT_EDGE 2
#define SCE_SELECT_FACE 4
-/* sce->selectmode for particles */
+/* toolsettings->particle.selectmode for particles */
#define SCE_SELECT_PATH 1
#define SCE_SELECT_POINT 2
#define SCE_SELECT_END 4
@@ -819,7 +826,7 @@ typedef struct Scene {
/* sce->recalc (now in use by previewrender) */
#define SCE_PRV_CHANGED 1
-/* sce->prop_mode (proportional falloff) */
+/* toolsettings->prop_mode (proportional falloff) */
#define PROP_SMOOTH 0
#define PROP_SPHERE 1
#define PROP_ROOT 2
@@ -887,7 +894,7 @@ typedef enum SculptFlags {
/* toolsettings->uv_selectmode */
#define UV_SELECT_VERTEX 1
-#define UV_SELECT_EDGE 2 /* not implemented */
+#define UV_SELECT_EDGE 2
#define UV_SELECT_FACE 4
#define UV_SELECT_ISLAND 8
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 28b5f882288..f66c0c31fda 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -229,7 +229,7 @@ typedef struct SpaceImage {
char dt_uv; /* UV draw type */
char sticky; /* sticky selection type */
char dt_uvstretch;
- char pad;
+ char around;
float xof, yof; /* user defined offset, image is centered */
float zoom, pad4; /* user defined zoom level */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 9d554c88a95..771a7e43793 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -67,7 +67,8 @@ typedef struct uiFontStyle {
short uifont_id; /* saved in file, 0 is default */
short points; /* actual size depends on 'global' dpi */
float kerning; /* kerning space between characters. */
- float pad;
+ short overlap; /* check overlaped characters. */
+ short pad;
short italic, bold; /* style hint */
short shadow; /* value is amount of pixels blur */
short shadx, shady; /* shadow offset in pixels */
@@ -123,10 +124,11 @@ typedef struct uiWidgetColors {
typedef struct ThemeUI {
/* Interface Elements (buttons, menus, icons) */
- uiWidgetColors wcol_regular, wcol_tool, wcol_radio, wcol_text, wcol_option;
+ uiWidgetColors wcol_regular, wcol_tool, wcol_text;
+ uiWidgetColors wcol_radio, wcol_option, wcol_toggle;
uiWidgetColors wcol_num, wcol_numslider;
uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item;
- uiWidgetColors wcol_box;
+ uiWidgetColors wcol_box, wcol_scroll;
char iconfile[80]; // FILE_MAXFILE length
@@ -379,7 +381,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_ZOOM_TO_MOUSEPOS (1 << 20)
#define USER_SHOW_FPS (1 << 21)
#define USER_MMB_PASTE (1 << 22)
-#define USER_DIRECTIONALORDER (1 << 23)
+#define USER_MENUFIXEDORDER (1 << 23)
/* Auto-Keying mode */
/* AUTOKEY_ON is a bitflag */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index af64daa3293..dda0d57f8ad 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -519,6 +519,8 @@ const struct ListBase *RNA_struct_defined_properties(StructRNA *srna);
FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier);
const struct ListBase *RNA_struct_defined_functions(StructRNA *srna);
+char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen);
+
/* Properties
*
* Access to struct properties. All this works with RNA pointers rather than
@@ -698,6 +700,28 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name);
RNA_property_collection_end(&rna_macro_iter); \
}
+#define RNA_PROP_BEGIN(sptr, itemptr, prop) \
+ { \
+ CollectionPropertyIterator rna_macro_iter; \
+ for(RNA_property_collection_begin(sptr, prop, &rna_macro_iter); rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { \
+ PointerRNA itemptr= rna_macro_iter.ptr;
+
+#define RNA_PROP_END \
+ } \
+ RNA_property_collection_end(&rna_macro_iter); \
+ }
+
+#define RNA_STRUCT_BEGIN(sptr, prop) \
+ { \
+ CollectionPropertyIterator rna_macro_iter; \
+ for(RNA_property_collection_begin(sptr, RNA_struct_iterator_property(sptr->type), &rna_macro_iter); rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { \
+ PropertyRNA *prop= rna_macro_iter.ptr.data;
+
+#define RNA_STRUCT_END \
+ } \
+ RNA_property_collection_end(&rna_macro_iter); \
+ }
+
/* check if the idproperty exists, for operators */
int RNA_property_is_set(PointerRNA *ptr, const char *name);
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index b620a315085..85a148be2e2 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -80,7 +80,7 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont, const char *identifier, c
PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
-PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
+PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
diff --git a/source/blender/makesrna/intern/Makefile b/source/blender/makesrna/intern/Makefile
index 03f75f0bea6..1694e55ed4c 100644
--- a/source/blender/makesrna/intern/Makefile
+++ b/source/blender/makesrna/intern/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 13161 2008-01-07 19:13:47Z hos $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 13686809cd2..66127ebc6df 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -426,23 +426,16 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
/* Find the property which uses the given nested struct */
PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna)
{
- CollectionPropertyIterator iter;
- PropertyRNA *iterprop, *prop;
- int i = 0;
+ PropertyRNA *prop= NULL;
- iterprop= RNA_struct_iterator_property(ptr->type);
- RNA_property_collection_begin(ptr, iterprop, &iter);
- prop= NULL;
-
- for(; iter.valid; RNA_property_collection_next(&iter), i++) {
+ RNA_STRUCT_BEGIN(ptr, iprop) {
/* This assumes that there can only be one user of this nested struct */
- if (RNA_property_pointer_type(ptr, iter.ptr.data) == srna) {
- prop= iter.ptr.data;
+ if (RNA_property_pointer_type(ptr, iprop) == srna) {
+ prop= iprop;
break;
}
}
-
- RNA_property_collection_end(&iter);
+ RNA_PROP_END;
return prop;
}
@@ -455,25 +448,21 @@ const struct ListBase *RNA_struct_defined_properties(StructRNA *srna)
FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
{
PointerRNA tptr;
- CollectionPropertyIterator iter;
PropertyRNA *iterprop;
FunctionRNA *func;
- int i = 0;
RNA_pointer_create(NULL, &RNA_Struct, ptr->type, &tptr);
iterprop= RNA_struct_find_property(&tptr, "functions");
- RNA_property_collection_begin(&tptr, iterprop, &iter);
func= NULL;
- for(; iter.valid; RNA_property_collection_next(&iter), i++) {
- if(strcmp(identifier, RNA_function_identifier(iter.ptr.data)) == 0) {
- func= iter.ptr.data;
+ RNA_PROP_BEGIN(&tptr, funcptr, iterprop) {
+ if(strcmp(identifier, RNA_function_identifier(funcptr.data)) == 0) {
+ func= funcptr.data;
break;
}
}
-
- RNA_property_collection_end(&iter);
+ RNA_PROP_END;
return func;
}
@@ -518,6 +507,16 @@ void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
srna->blender_type= blender_type;
}
+char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen)
+{
+ PropertyRNA *nameprop;
+
+ if(ptr->data && (nameprop = RNA_struct_name_property(ptr->type)))
+ return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen);
+
+ return NULL;
+}
+
/* Property Information */
const char *RNA_property_identifier(PropertyRNA *prop)
@@ -643,25 +642,27 @@ void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPrope
if(eprop->itemf) {
*item= eprop->itemf(ptr);
- for(tot=0; (*item)[tot].identifier; tot++);
- *totitem= tot;
+ if(totitem) {
+ for(tot=0; (*item)[tot].identifier; tot++);
+ *totitem= tot;
+ }
}
else {
*item= eprop->item;
- *totitem= eprop->totitem;
+ if(totitem)
+ *totitem= eprop->totitem;
}
}
int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value)
{
const EnumPropertyItem *item;
- int totitem, i;
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(ptr, prop, &item, NULL);
- for(i=0; i<totitem; i++) {
- if(strcmp(item[i].identifier, identifier)==0) {
- *value = item[i].value;
+ for(; item->identifier; item++) {
+ if(strcmp(item->identifier, identifier)==0) {
+ *value = item->value;
return 1;
}
}
@@ -693,11 +694,9 @@ int RNA_enum_name(const EnumPropertyItem *item, const int value, const char **na
int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
{
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ const EnumPropertyItem *item= NULL;
+ RNA_property_enum_items(ptr, prop, &item, NULL);
return RNA_enum_identifier(item, value, identifier);
}
@@ -2067,14 +2066,13 @@ int RNA_enum_is_equal(PointerRNA *ptr, const char *name, const char *enumname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
const EnumPropertyItem *item;
- int a, totitem;
if(prop) {
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(ptr, prop, &item, NULL);
- for(a=0; a<totitem; a++)
- if(strcmp(item[a].identifier, enumname) == 0)
- return (item[a].value == RNA_property_enum_get(ptr, prop));
+ for(; item->identifier; item++)
+ if(strcmp(item->identifier, enumname) == 0)
+ return (item->value == RNA_property_enum_get(ptr, prop));
printf("RNA_enum_is_equal: %s.%s item %s not found.\n", ptr->type->identifier, name, enumname);
return 0;
@@ -2247,17 +2245,12 @@ char *RNA_pointer_as_string(PointerRNA *ptr)
DynStr *dynstr= BLI_dynstr_new();
char *cstring;
- PropertyRNA *prop, *iterprop;
- CollectionPropertyIterator iter;
const char *propname;
int first_time = 1;
BLI_dynstr_append(dynstr, "{");
- iterprop= RNA_struct_iterator_property(ptr->type);
-
- for(RNA_property_collection_begin(ptr, iterprop, &iter); iter.valid; RNA_property_collection_next(&iter)) {
- prop= iter.ptr.data;
+ RNA_STRUCT_BEGIN(ptr, prop) {
propname = RNA_property_identifier(prop);
if(strcmp(propname, "rna_type")==0)
@@ -2271,8 +2264,8 @@ char *RNA_pointer_as_string(PointerRNA *ptr)
BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring);
MEM_freeN(cstring);
}
+ RNA_STRUCT_END;
- RNA_property_collection_end(&iter);
BLI_dynstr_append(dynstr, "}");
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 51c1818eed9..bd449acc050 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1946,7 +1946,7 @@ PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *ide
return prop;
}
-PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, EnumPropertyItem *items, int default_value,
+PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value,
const char *ui_name, const char *ui_description)
{
ContainerRNA *cont= cont_;
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 252cd633b69..4a6fdf5a734 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -35,6 +35,8 @@
#include "BKE_context.h"
#include "BKE_image.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
static void rna_Image_animated_update(bContext *C, PointerRNA *ptr)
@@ -133,16 +135,19 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* imagechanged */
RNA_def_property_ui_text(prop, "Filename", "Image/Movie file name.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_source_items);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* imagechanged */
RNA_def_property_ui_text(prop, "Source", "Where the image comes from.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* imagechanged */
RNA_def_property_ui_text(prop, "Type", "How to generate the image.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
@@ -152,90 +157,105 @@ static void rna_def_image(BlenderRNA *brna)
prop= RNA_def_property(srna, "fields", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_FIELDS);
RNA_def_property_ui_text(prop, "Fields", "Use fields of the image.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "odd_fields", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_STD_FIELD);
RNA_def_property_ui_text(prop, "Odd Fields", "Standard field toggle.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "antialias", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANTIALI);
RNA_def_property_ui_text(prop, "Anti-alias", "Toggles image anti-aliasing, only works with solid colors");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "premultiply", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DO_PREMUL);
RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
/* generated image (image_generated_change_cb) */
prop= RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "gen_type");
RNA_def_property_enum_items(prop, prop_generated_type_items);
RNA_def_property_ui_text(prop, "Generated Type", "Generated image type.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gen_x");
RNA_def_property_range(prop, 1, 16384);
RNA_def_property_ui_text(prop, "Generated Width", "Generated image width.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gen_y");
RNA_def_property_range(prop, 1, 16384);
RNA_def_property_ui_text(prop, "Generated Height", "Generated image height.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
/* realtime properties */
prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_items(prop, prop_mapping_items);
RNA_def_property_ui_text(prop, "Mapping", "Mapping type to use for this image in the game engine.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_VECTOR);
RNA_def_property_float_sdna(prop, NULL, "aspx");
RNA_def_property_array(prop, 2);
RNA_def_property_range(prop, 0.1f, 5000.0f);
RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this image, does not affect rendering.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "animated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TWINANIM);
RNA_def_property_ui_text(prop, "Animated", "Use as animated texture in the game engine.");
- RNA_def_property_update(prop, 0, "rna_Image_animated_update");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");
prop= RNA_def_property(srna, "animation_start", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "twsta");
RNA_def_property_range(prop, 0, 128);
RNA_def_property_ui_text(prop, "Animation Start", "Start frame of an animated texture.");
- RNA_def_property_update(prop, 0, "rna_Image_animated_update");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");
prop= RNA_def_property(srna, "animation_end", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "twend");
RNA_def_property_range(prop, 0, 128);
RNA_def_property_ui_text(prop, "Animation End", "End frame of an animated texture.");
- RNA_def_property_update(prop, 0, "rna_Image_animated_update");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");
prop= RNA_def_property(srna, "animation_speed", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "animspeed");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_text(prop, "Animation Speed", "Speed of the animation in frames per second.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "tiles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TILES);
RNA_def_property_ui_text(prop, "Tiles", "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces).");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "tiles_x", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "xrep");
RNA_def_property_range(prop, 1, 16);
RNA_def_property_ui_text(prop, "Tiles X", "Degree of repetition in the X direction.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "tiles_y", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "yrep");
RNA_def_property_range(prop, 1, 16);
RNA_def_property_ui_text(prop, "Tiles Y", "Degree of repetition in the Y direction.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "clamp_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_U);
RNA_def_property_ui_text(prop, "Clamp X", "Disable texture repeating horizontally.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "clamp_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_V);
RNA_def_property_ui_text(prop, "Clamp Y", "Disable texture repeating vertically.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
}
void RNA_def_image(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index b97dd95c4d4..71e424bbd69 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -1,5 +1,5 @@
/**
- * $Id: rna_key.c 19382 2009-03-23 13:24:48Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 092a5804a74..a49b4377d9d 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -253,11 +253,11 @@ static void rna_def_lamp(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem prop_type_items[] = {
- {LA_LOCAL, "POINT", 0, "Point", "Omnidirectional point light source."},
- {LA_SUN, "SUN", 0, "Sun", "Constant direction parallel ray light source."},
- {LA_SPOT, "SPOT", 0, "Spot", "Directional cone light source."},
- {LA_HEMI, "HEMI", 0, "Hemi", "180 degree constant light source."},
- {LA_AREA, "AREA", 0, "Area", "Directional area light source."},
+ {LA_LOCAL, "POINT", ICON_LAMP_POINT, "Point", "Omnidirectional point light source."},
+ {LA_SUN, "SUN", ICON_LAMP_SUN, "Sun", "Constant direction parallel ray light source."},
+ {LA_SPOT, "SPOT", ICON_LAMP_SPOT, "Spot", "Directional cone light source."},
+ {LA_HEMI, "HEMI", ICON_LAMP_HEMI, "Hemi", "180 degree constant light source."},
+ {LA_AREA, "AREA", ICON_LAMP_AREA, "Area", "Directional area light source."},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "Lamp", "ID");
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index 3af448b0233..f67267ce0d0 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -1,5 +1,5 @@
/**
- * $Id: rna_lattice.c 19382 2009-03-23 13:24:48Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index dab7a94584f..9b3ff6e74a0 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -41,35 +41,35 @@
#include "WM_types.h"
EnumPropertyItem modifier_type_items[] ={
- {eModifierType_Armature, "ARMATURE", 0, "Armature", ""},
- {eModifierType_Array, "ARRAY", 0, "Array", ""},
- {eModifierType_Bevel, "BEVEL", 0, "Bevel", ""},
- {eModifierType_Boolean, "BOOLEAN", 0, "Boolean", ""},
- {eModifierType_Build, "BUILD", 0, "Build", ""},
- {eModifierType_Cast, "CAST", 0, "Cast", ""},
- {eModifierType_Cloth, "CLOTH", 0, "Cloth", ""},
- {eModifierType_Collision, "COLLISION", 0, "Collision", ""},
- {eModifierType_Curve, "CURVE", 0, "Curve", ""},
- {eModifierType_Decimate, "DECIMATE", 0, "Decimate", ""},
- {eModifierType_Displace, "DISPLACE", 0, "Displace", ""},
- {eModifierType_EdgeSplit, "EDGE_SPLIT", 0, "Edge Split", ""},
- {eModifierType_Explode, "EXPLODE", 0, "Explode", ""},
- {eModifierType_Fluidsim, "FLUID_SIMULATION", 0, "Fluid Simulation", ""},
- {eModifierType_Hook, "HOOK", 0, "Hook", ""},
- {eModifierType_Lattice, "LATTICE", 0, "Lattice", ""},
- {eModifierType_Mask, "MASK", 0, "Mask", ""},
- {eModifierType_MeshDeform, "MESH_DEFORM", 0, "Mesh Deform", ""},
- {eModifierType_Mirror, "MIRROR", 0, "Mirror", ""},
- {eModifierType_Multires, "MULTIRES", 0, "Multires", ""},
- {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", 0, "Particle Instance", ""},
- {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", 0, "Particle System", ""},
- {eModifierType_Shrinkwrap, "SHRINKWRAP", 0, "Shrinkwrap", ""},
- {eModifierType_SimpleDeform, "SIMPLE_DEFORM", 0, "Simple Deform", ""},
- {eModifierType_Smooth, "SMOOTH", 0, "Smooth", ""},
- {eModifierType_Softbody, "SOFTBODY", 0, "Softbody", ""},
- {eModifierType_Subsurf, "SUBSURF", 0, "Subsurf", ""},
- {eModifierType_UVProject, "UV_PROJECT", 0, "UV Project", ""},
- {eModifierType_Wave, "WAVE", 0, "Wave", ""},
+ {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
+ {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
+ {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
+ {eModifierType_Boolean, "BOOLEAN", ICON_MOD_BOOLEAN, "Boolean", ""},
+ {eModifierType_Build, "BUILD", ICON_MOD_BUILD, "Build", ""},
+ {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
+ {eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
+ {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
+ {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""},
+ {eModifierType_Decimate, "DECIMATE", ICON_MOD_DECIM, "Decimate", ""},
+ {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""},
+ {eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""},
+ {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
+ {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
+ {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""},
+ {eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""},
+ {eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""},
+ {eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""},
+ {eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
+ {eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multires", ""},
+ {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLES, "Particle Instance", ""},
+ {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""},
+ {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
+ {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
+ {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
+ {eModifierType_Softbody, "SOFTBODY", ICON_MOD_SOFT, "Softbody", ""},
+ {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subsurf", ""},
+ {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
+ {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 85e68ec4877..fd79ac36c57 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -409,11 +409,13 @@ static void rna_def_material_slot(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL);
RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_SHADING, "rna_Object_update");
prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, link_items);
RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_SHADING, "rna_Object_update");
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c
index 6b6db71ef87..6b9a708f555 100644
--- a/source/blender/makesrna/intern/rna_packedfile.c
+++ b/source/blender/makesrna/intern/rna_packedfile.c
@@ -1,5 +1,5 @@
/**
- * $Id: rna_packedfile.c 19382 2009-03-23 13:24:48Z blendix $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index c48c1006588..ae53c815ed9 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -1470,14 +1470,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
-
-#if 0
- prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_sdna(prop, NULL, "ipo");
- RNA_def_property_struct_type(prop, "Ipo");
- RNA_def_property_ui_text(prop, "Ipo", "");
-#endif
+
+ /* animation here? */
+ rna_def_animdata_common(srna);
// struct PartDeflect *pd;
// struct PartDeflect *pd2;
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 5d4916bb3c6..47c9025149a 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -151,8 +151,34 @@ void rna_def_tool_settings(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static EnumPropertyItem uv_select_mode_items[] = {
+ {UV_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode."},
+ {UV_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode."},
+ {UV_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode."},
+ {UV_SELECT_ISLAND, "ISLAND", ICON_LINKEDSEL, "Island", "Island selection mode."},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem mesh_select_mode_items[] = {
+ {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode."},
+ {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode."},
+ {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode."},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem snap_element_items[] = {
+ {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices."},
+ {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges."},
+ {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces."},
+ {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume."},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem snap_mode_items[] = {
+ {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target."},
+ {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target."},
+ {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target."},
+ {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target."},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "ToolSettings", NULL);
- RNA_def_struct_nested(brna, srna, "Scene");
RNA_def_struct_ui_text(srna, "Tool Settings", "");
prop= RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
@@ -163,6 +189,62 @@ void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "VPaint");
RNA_def_property_ui_text(prop, "Vertex Paint", "");
+ /* Transform */
+ prop= RNA_def_property(srna, "proportional_editing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "proportional", 0);
+ RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional editing mode.");
+
+ prop= RNA_def_property(srna, "proportional_editing_falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
+ RNA_def_property_enum_items(prop, prop_mode_items);
+ RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
+
+ prop= RNA_def_property(srna, "snap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
+ RNA_def_property_ui_text(prop, "Snap", "Snap while Ctrl is held during transform.");
+ RNA_def_property_ui_icon(prop, ICON_SNAP_GEAR, 1);
+
+ prop= RNA_def_property(srna, "snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
+ RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target.");
+ RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
+
+ prop= RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
+ RNA_def_property_enum_items(prop, snap_element_items);
+ RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to.");
+
+ prop= RNA_def_property(srna, "snap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "snap_target");
+ RNA_def_property_enum_items(prop, snap_mode_items);
+ RNA_def_property_ui_text(prop, "Snap Mode", "Which part to snap onto the target.");
+
+ prop= RNA_def_property(srna, "snap_peel_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
+ RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center.");
+ RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
+
+ /* UV */
+ prop= RNA_def_property(srna, "uv_selection_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
+ RNA_def_property_enum_items(prop, uv_select_mode_items);
+ RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode.");
+
+ prop= RNA_def_property(srna, "uv_sync_selection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
+ RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync.");
+ RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
+
+ prop= RNA_def_property(srna, "uv_local_view", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
+ RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned.");
+
+ /* Mesh */
+ prop= RNA_def_property(srna, "mesh_selection_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
+ RNA_def_property_enum_items(prop, mesh_select_mode_items);
+ RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Mesh selection and display mode.");
+
rna_def_sculpt(brna);
}
@@ -839,10 +921,6 @@ void RNA_def_scene(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem unwrapper_items[] = {
- {0, "CONFORMAL", 0, "Conformal", ""},
- {1, "ANGLEBASED", 0, "Angle Based", ""},
- {0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "Scene", "ID");
RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings.");
@@ -874,11 +952,6 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible when rendering the scene.");
RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
- prop= RNA_def_property(srna, "proportional_editing_falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
- RNA_def_property_enum_items(prop, prop_mode_items);
- RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
-
prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE);
RNA_def_property_int_sdna(prop, NULL, "r.cfra");
@@ -911,11 +984,6 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping.");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "unwrapper", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "toolsettings->unwrapper");
- RNA_def_property_enum_items(prop, unwrapper_items);
- RNA_def_property_ui_text(prop, "Unwrapper", "Unwrap algorithm used by the Unwrap tool.");
-
prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree.");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index ce31cb27c9a..9335b3619fc 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -246,19 +246,10 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
-#if 0
- static EnumPropertyItem select_mode_items[] = {
- {SI_SELECT_VERTEX, "VERTEX", 0, "Vertex", "Vertex selection mode."},
- //{SI_SELECT_EDGE, "Edge", 0, "Edge", "Edge selection mode."},
- {SI_SELECT_FACE, "FACE", 0, "Face", "Face selection mode."},
- {SI_SELECT_ISLAND, "ISLAND", 0, "Island", "Island selection mode."},
- {0, NULL, 0, NULL, NULL}};
-#endif
-
static EnumPropertyItem sticky_mode_items[] = {
- {SI_STICKY_DISABLE, "DISABLED", 0, "Disabled", "Sticky vertex selection disabled."},
- {SI_STICKY_LOC, "SHARED_LOCATION", 0, "SHARED_LOCATION", "Select UVs that are at the same location and share a mesh vertex."},
- {SI_STICKY_VERTEX, "SHARED_VERTEX", 0, "SHARED_VERTEX", "Select UVs that share mesh vertex, irrespective if they are in the same location."},
+ {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled."},
+ {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "SHARED_LOCATION", "Select UVs that are at the same location and share a mesh vertex."},
+ {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "SHARED_VERTEX", "Select UVs that share mesh vertex, irrespective if they are in the same location."},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem dt_uv_items[] = {
@@ -273,17 +264,18 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
{SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces."},
{0, NULL, 0, NULL, NULL}};
+ static EnumPropertyItem pivot_items[] = {
+ {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
+ {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
+ {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "SpaceUVEditor", NULL);
RNA_def_struct_sdna(srna, "SpaceImage");
RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space.");
/* selection */
- /*prop= RNA_def_property(srna, "selection_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "selectmode");
- RNA_def_property_enum_items(prop, select_mode_items);
- RNA_def_property_ui_text(prop, "Selection Mode", "UV selection and display mode.");*/
-
prop= RNA_def_property(srna, "sticky_selection_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "sticky");
RNA_def_property_enum_items(prop, sticky_mode_items);
@@ -313,16 +305,15 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw.");
RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
- prop= RNA_def_property(srna, "draw_modified_edges", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
- RNA_def_property_enum_items(prop, dt_uvstretch_items);
- RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges from the final mesh after object modifier evaluation.");
+ prop= RNA_def_property(srna, "draw_modified_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW);
+ RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges after modifiers are applied.");
RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
- /*prop= RNA_def_property(srna, "local_view", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LOCAL_UV);
- RNA_def_property_ui_text(prop, "Local View", "Draw only faces with the currently displayed image assigned.");
- RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);*/
+ prop= RNA_def_property(srna, "draw_other_objects", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_OTHER);
+ RNA_def_property_ui_text(prop, "Draw Other Objects", "Draw other selected objects that share the same image.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
prop= RNA_def_property(srna, "normalized_coordinates", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
@@ -331,12 +322,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
/* todo: move edge and face drawing options here from G.f */
- /* editing */
- /*prop= RNA_def_property(srna, "sync_selection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SYNC_UVSEL);
- RNA_def_property_ui_text(prop, "Sync Selection", "Keep UV and edit mode mesh selection in sync.");
- RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);*/
-
prop= RNA_def_property(srna, "snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing.");
@@ -348,6 +333,12 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
prop= RNA_def_property(srna, "live_unwrap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices.");
+
+ prop= RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "around");
+ RNA_def_property_enum_items(prop, pivot_items);
+ RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot.");
+ RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
}
static void rna_def_space_outliner(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index d06d4d4406d..75de9d53766 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -189,8 +189,7 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_common(func);
func= RNA_def_function(srna, "itemM", "uiItemM");
- parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_common(func);
parm= RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu.");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -206,12 +205,10 @@ void RNA_api_ui_layout(StructRNA *srna)
/* templates */
func= RNA_def_function(srna, "template_header", "uiTemplateHeader");
- parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
func= RNA_def_function(srna, "template_ID", "uiTemplateID");
- parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block.");
RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a new ID block.");
@@ -245,6 +242,19 @@ void RNA_api_ui_layout(StructRNA *srna)
func= RNA_def_function(srna, "template_layers", "uiTemplateLayers");
api_ui_item_rna_common(func);
+
+ func= RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm= RNA_def_pointer(func, "image", "Image", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "image_user", "ImageUser", "", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "template_list", "uiTemplateList");
+ api_ui_item_rna_common(func);
+ parm= RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, indicating the active element.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_int(func, "items", 5, 0, INT_MAX, "", "Number of items to display.", 0, INT_MAX);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 65d83bec552..609082144e1 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -139,7 +139,12 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
prop= RNA_def_property(srna, "kerning", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -5.0, 5.0);
- RNA_def_property_ui_text(prop, "Kerning", "");
+ RNA_def_property_ui_text(prop, "Kerning", "User kerning value in pixels");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop= RNA_def_property(srna, "overlap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlap", 1);
+ RNA_def_property_ui_text(prop, "Overlap", "Check for overlap characters");
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "shadow", PROP_INT, PROP_NONE);
@@ -301,6 +306,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Option Widget Colors", "");
RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "wcol_toggle");
+ RNA_def_property_struct_type(prop, "ThemeWidgetColors");
+ RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "wcol_num");
@@ -343,7 +354,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Menu Item Colors", "");
RNA_def_property_update(prop, NC_WINDOW, NULL);
-
+
+ prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "wcol_scroll");
+ RNA_def_property_struct_type(prop, "ThemeWidgetColors");
+ RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "iconfile");
@@ -1505,7 +1521,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox.");
prop= RNA_def_property(srna, "directional_menus", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DIRECTIONALORDER);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER);
RNA_def_property_ui_text(prop, "Contents Follow Opening Direction", "Otherwise menus, etc will always be top to bottom, left to right, no matter opening direction.");
/* snap to grid */
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index a1b51084fca..1bfc3b6f8f6 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -202,7 +202,7 @@ static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
}
-static int rna_Event_ascii_get(PointerRNA *ptr, char *value)
+static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
{
wmEvent *event= (wmEvent*)ptr->id.data;
value[0]= event->ascii;
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 855fdde50c5..d141a585378 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -1,5 +1,5 @@
/*
- * $Id: BPY_extern.h 12334 2007-10-21 23:00:29Z aligorith $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -50,6 +50,8 @@ struct bConstraintTarget; /* DNA_constraint_types.h*/
struct Script; /* DNA_screen_types.h */
struct BPyMenu;
struct bContext;
+struct ReportList;
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c
deleted file mode 100644
index b67f1e717da..00000000000
--- a/source/blender/python/BPY_menus.c
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*
- * $Id: BPY_menus.c 12932 2007-12-17 20:21:06Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Michael Reimpell
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-/*
- *This is the main file responsible for having bpython scripts accessible
- * from Blender menus. To know more, please start with its header file.
- */
-
-#include "BPY_menus.h"
-
-#include <Python.h>
-#ifndef WIN32
- #include <dirent.h>
-#else
- #include "BLI_winstuff.h"
-#endif
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
-#include "MEM_guardedalloc.h"
-#include "DNA_userdef_types.h" /* for U.pythondir */
-#include "api2_2x/EXPP_interface.h" /* for bpy_gethome() */
-
-#define BPYMENU_DATAFILE "Bpymenus"
-#define MAX_DIR_DEPTH 4 /* max depth for traversing scripts dirs */
-#define MAX_DIR_NUMBER 30 /* max number of dirs in scripts dirs trees */
-
-static int DEBUG;
-static int Dir_Depth;
-static int Dirs_Number;
-
-/* BPyMenuTable holds all registered pymenus, as linked lists for each menu
- * where they can appear (see PYMENUHOOKS enum in BPY_menus.h).
-*/
-BPyMenu *BPyMenuTable[PYMENU_TOTAL];
-
-static int bpymenu_group_atoi( char *str )
-{
- if( !strcmp( str, "Export" ) )
- return PYMENU_EXPORT;
- else if( !strcmp( str, "Import" ) )
- return PYMENU_IMPORT;
- else if( !strcmp( str, "Help" ) )
- return PYMENU_HELP;
- else if( !strcmp( str, "HelpWebsites" ) )
- return PYMENU_HELPWEBSITES;
- else if( !strcmp( str, "HelpSystem" ) )
- return PYMENU_HELPSYSTEM;
- else if( !strcmp( str, "Render" ) )
- return PYMENU_RENDER;
- else if( !strcmp( str, "System" ) )
- return PYMENU_SYSTEM;
- else if( !strcmp( str, "Object" ) )
- return PYMENU_OBJECT;
- else if( !strcmp( str, "Mesh" ) )
- return PYMENU_MESH;
- else if( !strncmp( str, "Theme", 5 ) )
- return PYMENU_THEMES;
- else if( !strcmp( str, "Add" ) )
- return PYMENU_ADD;
- else if( !strcmp( str, "Wizards" ) )
- return PYMENU_WIZARDS;
- else if( !strcmp( str, "Animation" ) )
- return PYMENU_ANIMATION;
- else if( !strcmp( str, "Materials" ) )
- return PYMENU_MATERIALS;
- else if( !strcmp( str, "UV" ) )
- return PYMENU_UV;
- else if( !strcmp( str, "Image" ) )
- return PYMENU_IMAGE;
- else if( !strcmp( str, "FaceSelect" ) )
- return PYMENU_FACESELECT;
- else if( !strcmp( str, "WeightPaint" ) )
- return PYMENU_WEIGHTPAINT;
- else if( !strcmp( str, "VertexPaint" ) )
- return PYMENU_VERTEXPAINT;
- else if( !strcmp( str, "UVCalculation" ) )
- return PYMENU_UVCALCULATION;
- else if( !strcmp( str, "Armature" ) )
- return PYMENU_ARMATURE;
- else if( !strcmp( str, "ScriptTemplate" ) )
- return PYMENU_SCRIPTTEMPLATE;
- else if( !strcmp( str, "MeshFaceKey" ) )
- return PYMENU_MESHFACEKEY;
- else if( !strcmp( str, "AddMesh" ) )
- return PYMENU_ADDMESH;
- /* "Misc" or an inexistent group name: use misc */
- else
- return PYMENU_MISC;
-}
-
-char *BPyMenu_group_itoa( short menugroup )
-{
- switch ( menugroup ) {
- case PYMENU_EXPORT:
- return "Export";
- break;
- case PYMENU_IMPORT:
- return "Import";
- break;
- case PYMENU_ADD:
- return "Add";
- break;
- case PYMENU_HELP:
- return "Help";
- break;
- case PYMENU_HELPWEBSITES:
- return "HelpWebsites";
- break;
- case PYMENU_HELPSYSTEM:
- return "HelpSystem";
- break;
- case PYMENU_RENDER:
- return "Render";
- break;
- case PYMENU_SYSTEM:
- return "System";
- break;
- case PYMENU_OBJECT:
- return "Object";
- break;
- case PYMENU_MESH:
- return "Mesh";
- break;
- case PYMENU_THEMES:
- return "Themes";
- break;
- case PYMENU_WIZARDS:
- return "Wizards";
- break;
- case PYMENU_ANIMATION:
- return "Animation";
- break;
- case PYMENU_MATERIALS:
- return "Materials";
- break;
- case PYMENU_UV:
- return "UV";
- break;
- case PYMENU_IMAGE:
- return "Image";
- break;
- case PYMENU_FACESELECT:
- return "FaceSelect";
- break;
- case PYMENU_WEIGHTPAINT:
- return "WeightPaint";
- break;
- case PYMENU_VERTEXPAINT:
- return "VertexPaint";
- break;
- case PYMENU_UVCALCULATION:
- return "UVCalculation";
- break;
- case PYMENU_ARMATURE:
- return "Armature";
- break;
- case PYMENU_SCRIPTTEMPLATE:
- return "ScriptTemplate";
- break;
- case PYMENU_MESHFACEKEY:
- return "MeshFaceKey";
- break;
- case PYMENU_ADDMESH:
- return "AddMesh";
- break;
- case PYMENU_MISC:
- return "Misc";
- break;
- }
- return NULL;
-}
-
-/* BPyMenu_CreatePupmenuStr:
- * build and return a meaninful string to be used by pupmenu(). The
- * string is made of a bpymenu name as title and its submenus as possible
- * choices for the user.
-*/
-char *BPyMenu_CreatePupmenuStr( BPyMenu * pym, short menugroup )
-{
- BPySubMenu *pysm = pym->submenus;
- char str[1024], str2[100];
- int i = 0, rlen;
-
- if( !pym || !pysm )
- return NULL;
-
- str[0] = '\0';
-
- PyOS_snprintf( str2, sizeof( str2 ), "%s: %s%%t",
- BPyMenu_group_itoa( menugroup ), pym->name );
- strcat( str, str2 );
-
- while( pysm ) {
- PyOS_snprintf( str2, sizeof( str2 ), "|%s%%x%d", pysm->name,
- i );
- rlen = sizeof( str ) - strlen( str );
- strncat( str, str2, rlen );
- i++;
- pysm = pysm->next;
- }
-
- return BLI_strdup( str );
-}
-
-static void bpymenu_RemoveAllSubEntries( BPySubMenu * smenu )
-{
- BPySubMenu *tmp;
-
- while( smenu ) {
- tmp = smenu->next;
- if( smenu->name )
- MEM_freeN( smenu->name );
- if( smenu->arg )
- MEM_freeN( smenu->arg );
- MEM_freeN( smenu );
- smenu = tmp;
- }
- return;
-}
-
-void BPyMenu_RemoveAllEntries( void )
-{
- BPyMenu *tmp, *pymenu;
- int i;
-
- for( i = 0; i < PYMENU_TOTAL; i++ ) {
- pymenu = BPyMenuTable[i];
- while( pymenu ) {
- tmp = pymenu->next;
- if( pymenu->name )
- MEM_freeN( pymenu->name );
- if( pymenu->filename )
- MEM_freeN( pymenu->filename );
- if( pymenu->tooltip )
- MEM_freeN( pymenu->tooltip );
- if( pymenu->submenus )
- bpymenu_RemoveAllSubEntries( pymenu->
- submenus );
- MEM_freeN( pymenu );
- pymenu = tmp;
- }
- BPyMenuTable[i] = NULL;
- }
-
- Dirs_Number = 0;
- Dir_Depth = 0;
-
- return;
-}
-
-static BPyMenu *bpymenu_FindEntry( short group, char *name )
-{
- BPyMenu *pymenu;
-
- if( ( group < 0 ) || ( group >= PYMENU_TOTAL ) )
- return NULL;
-
- pymenu = BPyMenuTable[group];
-
- while( pymenu ) {
- if( !strcmp( pymenu->name, name ) )
- return pymenu;
- pymenu = pymenu->next;
- }
-
- return NULL;
-}
-
-/* BPyMenu_GetEntry:
- * given a group and a position, return the entry in that position from
- * that group.
-*/
-BPyMenu *BPyMenu_GetEntry( short group, short pos )
-{
- BPyMenu *pym = NULL;
-
- if( ( group < 0 ) || ( group >= PYMENU_TOTAL ) )
- return NULL;
-
- pym = BPyMenuTable[group];
-
- while( pos-- ) {
- if( pym )
- pym = pym->next;
- else
- break;
- }
-
- return pym; /* found entry or NULL */
-}
-
-static void bpymenu_set_tooltip( BPyMenu * pymenu, char *tip )
-{
- if( !pymenu )
- return;
-
- if( pymenu->tooltip )
- MEM_freeN( pymenu->tooltip );
- pymenu->tooltip = BLI_strdup( tip );
-
- return;
-}
-
-/* bpymenu_AddEntry:
- * try to find an existing pymenu entry with the given type and name;
- * if found, update it with new info, otherwise create a new one and fill it.
- */
-static BPyMenu *bpymenu_AddEntry( short group, short version, char *name,
- char *fname, int is_userdir, char *tooltip )
-{
- BPyMenu *menu, *next = NULL, **iter;
- int nameclash = 0;
-
- if( ( group < 0 ) || ( group >= PYMENU_TOTAL ) )
- return NULL;
- if( !name || !fname )
- return NULL;
-
- menu = bpymenu_FindEntry( group, name ); /* already exists? */
-
- /* if a menu with this name already exists in the same group:
- * - if one script is in the default dir and the other in U.pythondir,
- * accept and let the new one override the other.
- * - otherwise, report the error and return NULL. */
- if( menu ) {
- if( menu->dir < is_userdir ) { /* new one is in U.pythondir */
- nameclash = 1;
- if( menu->name )
- MEM_freeN( menu->name );
- if( menu->filename )
- MEM_freeN( menu->filename );
- if( menu->tooltip )
- MEM_freeN( menu->tooltip );
- if( menu->submenus )
- bpymenu_RemoveAllSubEntries( menu->submenus );
- next = menu->next;
- } else { /* they are in the same dir */
- if (DEBUG) {
- fprintf(stderr, "\n\
-Warning: script %s's menu name is already in use.\n\
-Edit the script and change its \n\
-Name: '%s'\n\
-field, please.\n\
-Note: if you really want to have two scripts for the same menu with\n\
-the same name, keep one in the default dir and the other in\n\
-the user defined dir (only the later will be registered).\n", fname, name);
- }
- return NULL;
- }
- } else
- menu = MEM_mallocN( sizeof( BPyMenu ), "pymenu" );
-
- if( !menu )
- return NULL;
-
- menu->name = BLI_strdup( name );
- menu->version = version;
- menu->filename = BLI_strdup( fname );
- menu->tooltip = NULL;
- if( tooltip )
- menu->tooltip = BLI_strdup( tooltip );
- menu->dir = is_userdir;
- menu->submenus = NULL;
- menu->next = next; /* non-NULL if menu already existed */
-
- if( nameclash )
- return menu; /* no need to place it, it's already at the list */
- else { /* insert the new entry in its correct position at the table */
- BPyMenu *prev = NULL;
- char *s = NULL;
-
- iter = &BPyMenuTable[group];
- while( *iter ) {
- s = ( *iter )->name;
- if( s )
- if( strcmp( menu->name, s ) < 0 )
- break; /* sort by names */
- prev = *iter;
- iter = &( ( *iter )->next );
- }
-
- if( *iter ) { /* prepend */
- menu->next = *iter;
- if( prev )
- prev->next = menu;
- else
- BPyMenuTable[group] = menu; /* is first entry */
- } else
- *iter = menu; /* append */
- }
-
- return menu;
-}
-
-/* bpymenu_AddSubEntry:
- * add a submenu to an existing python menu.
- */
-static int bpymenu_AddSubEntry( BPyMenu * mentry, char *name, char *arg )
-{
- BPySubMenu *smenu, **iter;
-
- smenu = MEM_mallocN( sizeof( BPySubMenu ), "pysubmenu" );
- if( !smenu )
- return -1;
-
- smenu->name = BLI_strdup( name );
- smenu->arg = BLI_strdup( arg );
- smenu->next = NULL;
-
- if( !smenu->name || !smenu->arg )
- return -1;
-
- iter = &( mentry->submenus );
- while( *iter )
- iter = &( ( *iter )->next );
-
- *iter = smenu;
-
- return 0;
-}
-
-/* bpymenu_CreateFromFile:
- * parse the bpymenus data file where Python menu data is stored;
- * based on this data, create and fill the pymenu structs.
- */
-static int bpymenu_CreateFromFile( void )
-{
- FILE *fp;
- char line[255], w1[255], w2[255], tooltip[255], *tip;
- char *homedir = NULL;
- int parsing, version, is_userdir;
- short group;
- BPyMenu *pymenu = NULL;
-
- /* init global bpymenu table (it is a list of pointers to struct BPyMenus
- * for each available cathegory: import, export, etc.) */
- for( group = 0; group < PYMENU_TOTAL; group++ )
- BPyMenuTable[group] = NULL;
-
- /* let's try to open the file with bpymenu data */
- homedir = bpy_gethome(0);
- if (!homedir) {
- if( DEBUG )
- fprintf(stderr,
- "BPyMenus error: couldn't open config file Bpymenus: no home dir.\n");
- return -1;
- }
-
- BLI_make_file_string( "/", line, homedir, BPYMENU_DATAFILE );
-
- fp = fopen( line, "rb" );
-
- if( !fp ) {
- if( DEBUG )
- fprintf(stderr, "BPyMenus error: couldn't open config file %s.\n", line );
- return -1;
- }
-
- fgets( line, 255, fp ); /* header */
-
- /* check if the U.pythondir we saved at the file is different from the
- * current one. If so, return to force updating from dirs */
- w1[0] = '\0';
- fscanf( fp, "# User defined scripts dir: %[^\n]\n", w1 );
- if( w1 ) {
- char upythondir[FILE_MAXDIR];
-
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0);
- if( strcmp( w1, upythondir ) != 0 )
- return -1;
- w1[0] = '\0';
- }
-
- while( fgets( line, 255, fp ) ) { /* parsing file lines */
-
- switch ( line[0] ) { /* check first char */
- case '#': /* comment */
- continue;
- break;
- case '\n':
- continue;
- break;
- default:
- parsing = sscanf( line, "%s {\n", w1 ); /* menu group */
- break;
- }
-
- if( parsing == 1 ) { /* got menu group string */
- group = (short)bpymenu_group_atoi( w1 );
- if( group < 0 && DEBUG ) { /* invalid type */
- fprintf(stderr,
- "BPyMenus error parsing config file: wrong group: %s,\n\
-will use 'Misc'.\n", w1 );
- }
- } else
- continue;
-
- for(;;) {
- tip = NULL; /* optional tooltip */
- fgets( line, 255, fp );
- if( line[0] == '}' )
- break;
- else if( line[0] == '\n' )
- continue;
- else if( line[0] == '\'' ) { /* menu entry */
- parsing =
- sscanf( line,
- "'%[^']' %d %s %d '%[^']'\n",
- w1, &version, w2, &is_userdir,
- tooltip );
-
- if( parsing <= 0 ) { /* invalid line, get rid of it */
- fgets( line, 255, fp );
- } else if( parsing == 5 )
- tip = tooltip; /* has tooltip */
-
- pymenu = bpymenu_AddEntry( group,
- ( short ) version,
- w1, w2, is_userdir,
- tip );
- if( !pymenu ) {
- puts( "BPyMenus error: couldn't create bpymenu entry.\n" );
- fclose( fp );
- return -1;
- }
- } else if( line[0] == '|' && line[1] == '_' ) { /* menu sub-entry */
- if( !pymenu )
- continue; /* no menu yet, skip this line */
- sscanf( line, "|_%[^:]: %s\n", w1, w2 );
- bpymenu_AddSubEntry( pymenu, w1, w2 );
- }
- }
- }
-
- fclose( fp );
- return 0;
-}
-
-/* bpymenu_WriteDataFile:
- * writes the registered scripts info to the user's home dir, for faster
- * access when the scripts dir hasn't changed.
-*/
-static void bpymenu_WriteDataFile( void )
-{
- BPyMenu *pymenu;
- BPySubMenu *smenu;
- FILE *fp;
- char fname[FILE_MAXDIR], *homedir;
- int i;
-
- homedir = bpy_gethome(0);
-
- if (!homedir) {
- if( DEBUG )
- fprintf(stderr,
- "BPyMenus error: couldn't write Bpymenus file: no home dir.\n\n");
- return;
- }
-
- BLI_make_file_string( "/", fname, homedir, BPYMENU_DATAFILE );
-
- fp = fopen( fname, "w" );
- if( !fp ) {
- if( DEBUG )
- fprintf(stderr, "BPyMenus error: couldn't write %s file.\n\n",
- fname );
- return;
- }
-
- fprintf( fp,
- "# Blender: registered menu entries for bpython scripts\n" );
-
- if (U.pythondir[0] != '\0' &&
- strcmp(U.pythondir, "/") != 0 && strcmp(U.pythondir, "//") != 0)
- {
- char upythondir[FILE_MAXDIR];
-
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0);
- fprintf( fp, "# User defined scripts dir: %s\n", upythondir );
- }
-
- for( i = 0; i < PYMENU_TOTAL; i++ ) {
- pymenu = BPyMenuTable[i];
- if( !pymenu )
- continue;
- fprintf( fp, "\n%s {\n", BPyMenu_group_itoa( (short)i ) );
- while( pymenu ) {
- fprintf( fp, "'%s' %d %s %d", pymenu->name,
- pymenu->version, pymenu->filename,
- pymenu->dir );
- if( pymenu->tooltip )
- fprintf( fp, " '%s'\n", pymenu->tooltip );
- else
- fprintf( fp, "\n" );
- smenu = pymenu->submenus;
- while( smenu ) {
- fprintf( fp, "|_%s: %s\n", smenu->name,
- smenu->arg );
- smenu = smenu->next;
- }
- pymenu = pymenu->next;
- }
- fprintf( fp, "}\n" );
- }
-
- fclose( fp );
- return;
-}
-
-/* BPyMenu_PrintAllEntries:
- * useful for debugging.
- */
-void BPyMenu_PrintAllEntries( void )
-{
- BPyMenu *pymenu;
- BPySubMenu *smenu;
- int i;
-
- printf( "# Blender: registered menu entries for bpython scripts\n" );
-
- for( i = 0; i < PYMENU_TOTAL; i++ ) {
- pymenu = BPyMenuTable[i];
- printf( "\n%s {\n", BPyMenu_group_itoa( (short)i ) );
- while( pymenu ) {
- printf( "'%s' %d %s %d", pymenu->name, pymenu->version,
- pymenu->filename, pymenu->dir );
- if( pymenu->tooltip )
- printf( " '%s'\n", pymenu->tooltip );
- else
- printf( "\n" );
- smenu = pymenu->submenus;
- while( smenu ) {
- printf( "|_%s: %s\n", smenu->name,
- smenu->arg );
- smenu = smenu->next;
- }
- pymenu = pymenu->next;
- }
- printf( "}\n" );
- }
-}
-
-/* bpymenu_ParseFile:
- * recursively scans folders looking for scripts to register.
- *
- * This function scans the scripts directory looking for .py files with the
- * right header and menu info, using that to fill the bpymenu structs.
- * is_userdir defines if the script is in the default scripts dir or the
- * user defined one (U.pythondir: is_userdir == 1).
- * Speed is important.
- *
- * The first line of the script must be '#!BPY'.
- * The header registration lines must appear between the first pair of
- * '\"\"\"' and follow this order (the single-quotes are part of
- * the format):
- *
- * # \"\"\"<br>
- * # Name: 'script name for the menu'
- * # Blender: <code>short int</code> (minimal Blender version)
- * # Group: 'group name' (defines menu)
- * # Submenu: 'submenu name' related_1word_arg
- * # Tooltip: 'tooltip for the menu'
- * # \"\"\"
- *
- * Notes:
- *
- * - Commenting out header lines with "#" is optional, but recommended.
- * - There may be more than one submenu line, or none:
- * submenus and the tooltip are optional;
- * - The Blender version is the same number reported by
- * Blender.Get('version') in BPython or G.version in C;
- * - Line length must be less than 99.
- */
-static int bpymenu_ParseFile(FILE *file, char *fname, int is_userdir)
-{
- char line[100];
- char head[100];
- char middle[100];
- char tail[100];
- int matches;
- int parser_state;
-
- char script_name[100];
- int script_version = 1;
- int script_group;
-
- BPyMenu *scriptMenu = NULL;
-
- if (file != NULL) {
- parser_state = 1; /* state of parser, 0 to terminate */
-
- while ((parser_state != 0) && (fgets(line, 100, file) != NULL)) {
-
- switch (parser_state) {
-
- case 1: /* !BPY */
- if (strncmp(line, "#!BPY", 5) == 0) {
- parser_state++;
- } else {
- parser_state = 0;
- }
- break;
-
- case 2: /* \"\"\" */
- if ((strstr(line, "\"\"\""))) {
- parser_state++;
- }
- break;
-
- case 3: /* Name: 'script name for the menu' */
- matches = sscanf(line, "%[^']'%[^']'%c", head, script_name, tail);
- if ((matches == 3) && (strstr(head, "Name:") != NULL)) {
- parser_state++;
- } else {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Wrong 'Name' line: %s\n", fname);
- parser_state = 0;
- }
- break;
-
- case 4: /* Blender: <short int> */
- matches = sscanf(line, "%[^1234567890]%i%c", head, &script_version,
- tail);
- if (matches == 3) {
- parser_state++;
- } else {
- if (DEBUG)
- fprintf(stderr,"BPyMenus error: Wrong 'Blender' line: %s\n",fname);
- parser_state = 0;
- }
- break;
-
- case 5: /* Group: 'group name' */
- matches = sscanf(line, "%[^']'%[^']'%c", head, middle, tail);
- if ((matches == 3) && (strstr(head, "Group:") != NULL)) {
- script_group = bpymenu_group_atoi(middle);
- if (script_group < 0) {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Unknown group \"%s\": %s\n",
- middle, fname);
- parser_state = 0;
- }
-
- else { /* register script */
- scriptMenu = bpymenu_AddEntry((short)script_group,
- (short int)script_version, script_name, fname, is_userdir,NULL);
- if (scriptMenu == NULL) {
- if (DEBUG)
- fprintf(stderr,
- "BPyMenus error: Couldn't create entry for: %s\n", fname);
- parser_state = 0;
- } else {
- parser_state++;
- }
- }
-
- } else {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Wrong 'Group' line: %s\n",fname);
- parser_state = 0;
- }
- break;
-
- case 6: /* optional elements */
- /* Submenu: 'submenu name' related_1word_arg */
- matches = sscanf(line, "%[^']'%[^']'%s\n", head, middle, tail);
- if ((matches == 3) && (strstr(head, "Submenu:") != NULL)) {
- bpymenu_AddSubEntry(scriptMenu, middle, tail);
- } else {
- /* Tooltip: 'tooltip for the menu */
- matches = sscanf(line, "%[^']'%[^']'%c", head, middle, tail);
- if ((matches == 3) && ((strstr(head, "Tooltip:") != NULL) ||
- (strstr(head, "Tip:") != NULL))) {
- bpymenu_set_tooltip(scriptMenu, middle);
- }
- parser_state = 0;
- }
- break;
-
- default:
- parser_state = 0;
- break;
- }
- }
- }
-
- else { /* shouldn't happen, it's checked in bpymenus_ParseDir */
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Couldn't open %s.\n", fname);
- return -1;
- }
-
- return 0;
-}
-
-/* bpymenu_ParseDir:
- * recursively scans folders looking for scripts to register.
- *
- * This function scans the scripts directory looking for .py files with the
- * right header and menu info.
- * - is_userdir defines if the script is in the default scripts dir or the
- * user defined one (U.pythondir: is_userdir == 1);
- * - parentdir is the parent dir name to store as part of the script filename,
- * if we're down a subdir.
- * Speed is important.
- */
-static int bpymenu_ParseDir(char *dirname, char *parentdir, int is_userdir )
-{
- DIR *dir;
- FILE *file = NULL;
- struct dirent *de;
- struct stat status;
- char *file_extension;
- char path[FILE_MAX];
- char subdir[FILE_MAX];
- char *s = NULL;
-
- dir = opendir(dirname);
-
- if (dir != NULL) {
- while ((de = readdir(dir)) != NULL) {
-
- /* skip files and dirs starting with '.' or 'bpy' */
- if ((de->d_name[0] == '.') || !strncmp(de->d_name, "bpy", 3)) {
- continue;
- }
-
- BLI_make_file_string("/", path, dirname, de->d_name);
-
- if (stat(path, &status) != 0) {
- if (DEBUG)
- fprintf(stderr, "stat %s failed: %s\n", path, strerror(errno));
- }
-
- if (S_ISREG(status.st_mode)) { /* is file */
-
- file_extension = strstr(de->d_name, ".py");
-
- if (file_extension && *(file_extension + 3) == '\0') {
- file = fopen(path, "rb");
-
- if (file) {
- s = de->d_name;
- if (parentdir) {
- /* Join parentdir and de->d_name */
- BLI_join_dirfile(subdir, parentdir, de->d_name);
-
- s = subdir;
- }
- bpymenu_ParseFile(file, s, is_userdir);
- fclose(file);
- }
-
- else {
- if (DEBUG)
- fprintf(stderr, "BPyMenus error: Couldn't open %s.\n", path);
- }
- }
- }
-
- else if (S_ISDIR(status.st_mode)) { /* is subdir */
- Dirs_Number++;
- Dir_Depth++;
- if (Dirs_Number > MAX_DIR_NUMBER) {
- if (DEBUG) {
- fprintf(stderr, "BPyMenus error: too many subdirs.\n");
- }
- closedir(dir);
- return -1;
- }
- else if (Dir_Depth > MAX_DIR_DEPTH) {
- if (DEBUG)
- fprintf(stderr,
- "BPyMenus error: max depth reached traversing dir tree.\n");
- closedir(dir);
- return -1;
- }
- s = de->d_name;
- if (parentdir) {
- /* Join parentdir and de->d_name */
- BLI_join_dirfile(subdir, parentdir, de->d_name);
- s = subdir;
- }
- if (bpymenu_ParseDir(path, s, is_userdir) == -1) {
- closedir(dir);
- return -1;
- }
- Dir_Depth--;
- }
-
- }
- closedir(dir);
- }
-
- else { /* open directory stream failed */
- if (DEBUG)
- fprintf(stderr, "opendir %s failed: %s\n", dirname, strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int bpymenu_GetStatMTime( char *name, int is_file, time_t * mtime )
-{
- struct stat st;
- int result;
-
- result = stat( name, &st );
-
- if( result == -1 )
- return -1;
-
- if( is_file ) {
- if( !S_ISREG( st.st_mode ) )
- return -2;
- } else if( !S_ISDIR( st.st_mode ) )
- return -2;
-
- *mtime = st.st_mtime;
-
- return 0;
-}
-
-/* BPyMenu_Init:
- * import the bpython menus data to Blender, either from:
- * - the BPYMENU_DATAFILE file (?/.blender/Bpymenus) or
- * - the scripts dir(s), case newer than the datafile (then update the file).
- * then fill the bpymenu table with this data.
- * if param usedir != 0, then the data is recreated from the dir(s) anyway.
-*/
-int BPyMenu_Init( int usedir )
-{
- char fname[FILE_MAXDIR];
- char dirname[FILE_MAXDIR];
- char upythondir[FILE_MAXDIR];
- char *upydir = U.pythondir, *sdir = NULL;
- time_t time_dir1 = 0, time_dir2 = 0, time_file = 0;
- int stat_dir1 = 0, stat_dir2 = 0, stat_file = 0;
- int i;
-
- DEBUG = G.f & G_DEBUG; /* is Blender in debug mode (started with -d) ? */
-
- /* init global bpymenu table (it is a list of pointers to struct BPyMenus
- * for each available group: import, export, etc.) */
- for( i = 0; i < PYMENU_TOTAL; i++ )
- BPyMenuTable[i] = NULL;
-
- if( DEBUG )
- fprintf(stdout, "\nRegistering scripts in Blender menus ...\n\n" );
-
- if( U.pythondir[0] == '\0') {
- upydir = NULL;
- }
- else if (strcmp(U.pythondir, "/") == 0 || strcmp(U.pythondir, "//") == 0) {
- /* these are not accepted to prevent possible slight slowdowns on startup;
- * they should not be used as user defined scripts dir, anyway, also from
- * speed considerations, since they'd not be dedicated scripts dirs */
- if (DEBUG) fprintf(stderr,
- "BPyMenus: invalid user defined Python scripts dir: \"/\" or \"//\".\n");
- upydir = NULL;
- }
- else {
- BLI_strncpy(upythondir, upydir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0);
- }
-
- sdir = bpy_gethome(1);
-
- if (sdir) {
- BLI_strncpy(dirname, sdir, FILE_MAXDIR);
- stat_dir1 = bpymenu_GetStatMTime( dirname, 0, &time_dir1 );
-
- if( stat_dir1 < 0 ) {
- time_dir1 = 0;
- if( DEBUG ) {
- fprintf(stderr,
- "\nDefault scripts dir: %s:\n%s\n", dirname, strerror(errno));
- if( upydir )
- fprintf(stdout,
- "Getting scripts menu data from user defined dir: %s.\n",
- upythondir );
- }
- }
- }
- else stat_dir1 = -1;
-
- if( upydir ) {
- stat_dir2 = bpymenu_GetStatMTime( upythondir, 0, &time_dir2 );
-
- if( stat_dir2 < 0 ) {
- time_dir2 = 0;
- upydir = NULL;
- if( DEBUG )
- fprintf(stderr, "\nUser defined scripts dir: %s:\n%s.\n",
- upythondir, strerror( errno ) );
- if( stat_dir1 < 0 ) {
- if( DEBUG )
- fprintf(stderr, "\
-To have scripts in menus, please add them to the default scripts dir:\n\
-%s\n\
-and / or go to 'Info window -> File Paths tab' and set a valid path for\n\
-the user defined Python scripts dir.\n", dirname );
- return -1;
- }
- }
- }
- else stat_dir2 = -1;
-
- if( ( stat_dir1 < 0 ) && ( stat_dir2 < 0 ) ) {
- if( DEBUG ) {
- fprintf(stderr, "\nCannot register scripts in menus, no scripts dir"
- " available.\nExpected default dir at: %s \n", dirname );
- }
- return -1;
- }
-
- if (usedir) stat_file = -1;
- else { /* if we're not forced to use the dir */
- char *homedir = bpy_gethome(0);
-
- if (homedir) {
- BLI_make_file_string( "/", fname, homedir, BPYMENU_DATAFILE );
- stat_file = bpymenu_GetStatMTime( fname, 1, &time_file );
- if( stat_file < 0 )
- time_file = 0;
-
- /* comparing dates */
-
- if((stat_file == 0)
- && (time_file > time_dir1) && (time_file > time_dir2))
- { /* file is newer */
- stat_file = bpymenu_CreateFromFile( ); /* -1 if an error occurred */
- if( !stat_file && DEBUG )
- fprintf(stdout,
- "Getting menu data for scripts from file:\n%s\n\n", fname );
- }
- else stat_file = -1;
- }
- else stat_file = -1; /* -1 to use dirs: didn't use file or it was corrupted */
- }
-
- if( stat_file == -1 ) { /* use dirs */
- if( DEBUG ) {
- fprintf(stdout,
- "Getting menu data for scripts from dir(s):\ndefault: %s\n", dirname );
- if( upydir )
- fprintf(stdout, "user defined: %s\n", upythondir );
- fprintf(stdout, "\n");
- }
- if( stat_dir1 == 0 ) {
- i = bpymenu_ParseDir( dirname, NULL, 0 );
- if (i == -1 && DEBUG)
- fprintf(stderr, "Default scripts dir does not seem valid.\n\n");
- }
- if( stat_dir2 == 0 ) {
- BLI_strncpy(dirname, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(dirname, G.sce, 0);
- i = bpymenu_ParseDir( dirname, NULL, 1 );
- if (i == -1 && DEBUG)
- fprintf(stderr, "User defined scripts dir does not seem valid.\n\n");
- }
-
- /* check if we got any data */
- for( i = 0; i < PYMENU_TOTAL; i++ )
- if( BPyMenuTable[i] )
- break;
-
- /* if we got, recreate the file */
- if( i < PYMENU_TOTAL )
- bpymenu_WriteDataFile( );
- else if( DEBUG ) {
- fprintf(stderr, "\n\
-Warning: Registering scripts in menus -- no info found.\n\
-Either your scripts dirs have no .py scripts or the scripts\n\
-don't have a header with registration data.\n\
-Default scripts dir is:\n\
-%s\n", dirname );
- if( upydir )
- fprintf(stderr, "User defined scripts dir is: %s\n",
- upythondir );
- }
- }
-
- return 0;
-}
diff --git a/source/blender/python/BPY_menus.h b/source/blender/python/BPY_menus.h
deleted file mode 100644
index 6cdea608b10..00000000000
--- a/source/blender/python/BPY_menus.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * $Id: BPY_menus.h 12931 2007-12-17 18:20:48Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano, Matt Ebb
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
-*/
-
-#ifndef BPY_MENUS_H
-#define BPY_MENUS_H
-
-/* This header exposes BPyMenu related public declarations. The implementation
- * adds 'dynamic' menus to Blender, letting scripts register themselves in any
- * of a few pre-defined (trivial to upgrade) places in menus. These places or
- * slots are called groups here (Import, Export, etc). This is how it works:
- * - scripts at dirs user pref U.pythondir and .blender/scripts/ are scanned
- * for registration info.
- * - this data is also saved to a Bpymenus file at the user's .blender/ dir and
- * only re-created when the scripts folder gets modified.
- * - on start-up Blender uses this info to fill a table, which is used to
- * create the menu entries when they are needed (see header_info.c or
- * header_script.c, under source/blender/src/, for examples).
-*/
-
-/* These two structs hold py menu/submenu info.
- * BPyMenu holds a script's name (as should appear in the menu) and filename,
- * plus an optional list of submenus. Each submenu is related to a string
- * (arg) that the script can get from the __script__ pydict, to know which
- * submenu was chosen. */
-
-typedef struct BPySubMenu {
- char *name;
- char *arg;
- struct BPySubMenu *next;
-} BPySubMenu;
-
-typedef struct BPyMenu {
- char *name;
- char *filename;
- char *tooltip;
- short version; /* Blender version */
- int dir; /* 0: default, 1: U.pythondir */
- struct BPySubMenu *submenus;
- struct BPyMenu *next;
-} BPyMenu;
-
-/* Scripts can be added to only a few pre-defined places in menus, like
- * File->Import, File->Export, etc. (for speed and better control).
- * To make a new menu 'slot' available for scripts:
- * - add an entry to the enum below, before PYMENU_TOTAL, of course;
- * - update the bpymenu_group_atoi() and BPyMenu_group_itoa() functions in
- * BPY_menus.c;
- * - add the necessary code to the header_***.c file in
- * source/blender/src/, like done in header_info.c for import/export;
-*/
-typedef enum {
- PYMENU_ADD,/* creates new objects */
- PYMENU_ANIMATION,
- PYMENU_EXPORT,
- PYMENU_IMPORT,
- PYMENU_MATERIALS,
- PYMENU_MESH,
- PYMENU_MISC,
- PYMENU_OBJECT,
- PYMENU_RENDER,/* exporters to external renderers */
- PYMENU_SYSTEM,
- PYMENU_THEMES,
- PYMENU_UV,/* UV editing tools, to go in UV/Image editor space, 'UV' menu */
- PYMENU_IMAGE,/* Image editing tools, to go in UV/Image editor space, 'Image' menu */
- PYMENU_WIZARDS,/* complex 'app' scripts */
-
- /* entries put after Wizards don't appear at the Scripts win->Scripts menu;
- * see define right below */
-
- PYMENU_FACESELECT,
- PYMENU_WEIGHTPAINT,
- PYMENU_VERTEXPAINT,
- PYMENU_UVCALCULATION,
- PYMENU_ARMATURE,
- PYMENU_SCRIPTTEMPLATE,
- PYMENU_HELP,/*Main Help menu items - prob best to leave for 'official' ones*/
- PYMENU_HELPSYSTEM,/* Resources, troubleshooting, system tools */
- PYMENU_HELPWEBSITES,/* Help -> Websites submenu */
- PYMENU_MESHFACEKEY, /* face key in mesh editmode */
- PYMENU_ADDMESH, /* adds mesh */
- PYMENU_TOTAL
-} PYMENUHOOKS;
-
-#define PYMENU_SCRIPTS_MENU_TOTAL (PYMENU_WIZARDS + 1)
-
-/* BPyMenuTable holds all registered pymenus, as linked lists for each menu
- * where they can appear (see PYMENUHOOKS enum above).
-*/
-extern BPyMenu *BPyMenuTable[]; /* defined in BPY_menus.c */
-
-/* public functions: */
-int BPyMenu_Init( int usedir );
-void BPyMenu_RemoveAllEntries( void );
-void BPyMenu_PrintAllEntries( void );
-char *BPyMenu_CreatePupmenuStr( BPyMenu * pym, short group );
-char *BPyMenu_group_itoa( short group );
-struct BPyMenu *BPyMenu_GetEntry( short group, short pos );
-
-#endif /* BPY_MENUS_H */
diff --git a/source/blender/python/Makefile b/source/blender/python/Makefile
index 0c4b9ab6578..8e2a04b8449 100644
--- a/source/blender/python/Makefile
+++ b/source/blender/python/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 14444 2008-04-16 22:40:48Z hos $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/python/generic/BGL.c b/source/blender/python/generic/BGL.c
index f1a72270ea1..a90fabd3586 100644
--- a/source/blender/python/generic/BGL.c
+++ b/source/blender/python/generic/BGL.c
@@ -1,5 +1,5 @@
/*
- * $Id: BGL.c 20922 2009-06-16 07:16:51Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -1087,7 +1087,7 @@ static struct PyMethodDef BGL_methods[] = {
#if (PY_VERSION_HEX >= 0x03000000)
static struct PyModuleDef BGL_module_def = {
- {}, /* m_base */
+ PyModuleDef_HEAD_INIT,
"BGL", /* m_name */
0, /* m_doc */
0, /* m_size */
diff --git a/source/blender/python/generic/BGL.h b/source/blender/python/generic/BGL.h
index e2d1b0bb495..938c916bcea 100755
--- a/source/blender/python/generic/BGL.h
+++ b/source/blender/python/generic/BGL.h
@@ -1,5 +1,5 @@
/*
- * $Id: BGL.h 19717 2009-04-14 17:19:09Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/python/generic/Geometry.c b/source/blender/python/generic/Geometry.c
index d1e8b471f75..37053ce753f 100644
--- a/source/blender/python/generic/Geometry.c
+++ b/source/blender/python/generic/Geometry.c
@@ -1,5 +1,5 @@
/*
- * $Id: Geometry.c 20922 2009-06-16 07:16:51Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -80,7 +80,7 @@ struct PyMethodDef M_Geometry_methods[] = {
#if (PY_VERSION_HEX >= 0x03000000)
static struct PyModuleDef M_Geometry_module_def = {
- {}, /* m_base */
+ PyModuleDef_HEAD_INIT,
"Geometry", /* m_name */
M_Geometry_doc, /* m_doc */
0, /* m_size */
diff --git a/source/blender/python/generic/Geometry.h b/source/blender/python/generic/Geometry.h
index d7292e31fac..ebfb054c54a 100644
--- a/source/blender/python/generic/Geometry.h
+++ b/source/blender/python/generic/Geometry.h
@@ -1,5 +1,5 @@
/*
- * $Id: Geometry.h 20007 2009-04-30 12:45:13Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/python/generic/Makefile b/source/blender/python/generic/Makefile
index 20cf7f19ec7..0dbfbd1d102 100644
--- a/source/blender/python/generic/Makefile
+++ b/source/blender/python/generic/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 11904 2007-08-31 16:16:33Z sirdude $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/python/generic/Mathutils.c b/source/blender/python/generic/Mathutils.c
index 3c34a369baf..cd9705236d7 100644
--- a/source/blender/python/generic/Mathutils.c
+++ b/source/blender/python/generic/Mathutils.c
@@ -1,5 +1,5 @@
/*
- * $Id: Mathutils.c 20922 2009-06-16 07:16:51Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -96,7 +96,7 @@ struct PyMethodDef M_Mathutils_methods[] = {
#if (PY_VERSION_HEX >= 0x03000000)
static struct PyModuleDef M_Mathutils_module_def = {
- {}, /* m_base */
+ PyModuleDef_HEAD_INIT,
"Mathutils", /* m_name */
M_Mathutils_doc, /* m_doc */
0, /* m_size */
@@ -137,81 +137,12 @@ PyObject *Mathutils_Init(const char *from)
PyModule_AddObject( submodule, "Euler", (PyObject *)&euler_Type );
PyModule_AddObject( submodule, "Quaternion", (PyObject *)&quaternion_Type );
+ mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
+
return (submodule);
}
//-----------------------------METHODS----------------------------
-//----------------column_vector_multiplication (internal)---------
-//COLUMN VECTOR Multiplication (Matrix X Vector)
-// [1][2][3] [a]
-// [4][5][6] * [b]
-// [7][8][9] [c]
-//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
-PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec)
-{
- float vecNew[4], vecCopy[4];
- double dot = 0.0f;
- int x, y, z = 0;
-
- if(mat->rowSize != vec->size){
- if(mat->rowSize == 4 && vec->size != 3){
- PyErr_SetString(PyExc_AttributeError, "matrix * vector: matrix row size and vector size must be the same");
- return NULL;
- }else{
- vecCopy[3] = 1.0f;
- }
- }
-
- for(x = 0; x < vec->size; x++){
- vecCopy[x] = vec->vec[x];
- }
-
- for(x = 0; x < mat->rowSize; x++) {
- for(y = 0; y < mat->colSize; y++) {
- dot += mat->matrix[x][y] * vecCopy[y];
- }
- vecNew[z++] = (float)dot;
- dot = 0.0f;
- }
- return newVectorObject(vecNew, vec->size, Py_NEW);
-}
-
-//-----------------row_vector_multiplication (internal)-----------
-//ROW VECTOR Multiplication - Vector X Matrix
-//[x][y][z] * [1][2][3]
-// [4][5][6]
-// [7][8][9]
-//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
-PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat)
-{
- float vecNew[4], vecCopy[4];
- double dot = 0.0f;
- int x, y, z = 0, vec_size = vec->size;
-
- if(mat->colSize != vec_size){
- if(mat->rowSize == 4 && vec_size != 3){
- PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
- return NULL;
- }else{
- vecCopy[3] = 1.0f;
- }
- }
-
- for(x = 0; x < vec_size; x++){
- vecCopy[x] = vec->vec[x];
- }
-
- //muliplication
- for(x = 0; x < mat->colSize; x++) {
- for(y = 0; y < mat->rowSize; y++) {
- dot += mat->matrix[y][x] * vecCopy[y];
- }
- vecNew[z++] = (float)dot;
- dot = 0.0f;
- }
- return newVectorObject(vecNew, vec_size, Py_NEW);
-}
-
//-----------------quat_rotation (internal)-----------
//This function multiplies a vector/point * quat or vice versa
//to rotate the point/vector by the quaternion
@@ -226,6 +157,10 @@ PyObject *quat_rotation(PyObject *arg1, PyObject *arg2)
quat = (QuaternionObject*)arg1;
if(VectorObject_Check(arg2)){
vec = (VectorObject*)arg2;
+
+ if(!Vector_ReadCallback(vec))
+ return NULL;
+
rot[0] = quat->quat[0]*quat->quat[0]*vec->vec[0] + 2*quat->quat[2]*quat->quat[0]*vec->vec[2] -
2*quat->quat[3]*quat->quat[0]*vec->vec[1] + quat->quat[1]*quat->quat[1]*vec->vec[0] +
2*quat->quat[2]*quat->quat[1]*vec->vec[1] + 2*quat->quat[3]*quat->quat[1]*vec->vec[2] -
@@ -242,6 +177,10 @@ PyObject *quat_rotation(PyObject *arg1, PyObject *arg2)
}
}else if(VectorObject_Check(arg1)){
vec = (VectorObject*)arg1;
+
+ if(!Vector_ReadCallback(vec))
+ return NULL;
+
if(QuaternionObject_Check(arg2)){
quat = (QuaternionObject*)arg2;
rot[0] = quat->quat[0]*quat->quat[0]*vec->vec[0] + 2*quat->quat[2]*quat->quat[0]*vec->vec[2] -
@@ -308,6 +247,9 @@ static PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args)
if(vec1->size != vec2->size)
goto AttributeError1; //bad sizes
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2))
+ return NULL;
+
//since size is the same....
size = vec1->size;
@@ -353,6 +295,9 @@ static PyObject *M_Mathutils_MidpointVecs(PyObject * self, PyObject * args)
PyErr_SetString(PyExc_AttributeError, "Mathutils.MidpointVecs(): expects (2) vector objects of the same size\n");
return NULL;
}
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2))
+ return NULL;
for(x = 0; x < vec1->size; x++) {
vec[x] = 0.5f * (vec1->vec[x] + vec2->vec[x]);
@@ -377,6 +322,10 @@ static PyObject *M_Mathutils_ProjectVecs(PyObject * self, PyObject * args)
return NULL;
}
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2))
+ return NULL;
+
+
//since they are the same size...
size = vec1->size;
@@ -439,6 +388,10 @@ static PyObject *M_Mathutils_RotationMatrix(PyObject * self, PyObject * args)
PyErr_SetString(PyExc_AttributeError, "Mathutils.RotationMatrix(): the arbitrary axis must be a 3D vector\n");
return NULL;
}
+
+ if(!Vector_ReadCallback(vec))
+ return NULL;
+
}
//convert to radians
angle = angle * (float) (Py_PI / 180);
@@ -538,6 +491,10 @@ static PyObject *M_Mathutils_TranslationMatrix(PyObject * self, VectorObject * v
PyErr_SetString(PyExc_TypeError, "Mathutils.TranslationMatrix(): vector must be 3D or 4D\n");
return NULL;
}
+
+ if(!Vector_ReadCallback(vec))
+ return NULL;
+
//create a identity matrix and add translation
Mat4One((float(*)[4]) mat);
mat[12] = vec->vec[0];
@@ -570,6 +527,10 @@ static PyObject *M_Mathutils_ScaleMatrix(PyObject * self, PyObject * args)
PyErr_SetString(PyExc_AttributeError, "Mathutils.ScaleMatrix(): please use 2D vectors when scaling in 2D\n");
return NULL;
}
+
+ if(!Vector_ReadCallback(vec))
+ return NULL;
+
}
if(vec == NULL) { //scaling along axis
if(matSize == 2) {
@@ -645,6 +606,10 @@ static PyObject *M_Mathutils_OrthoProjectionMatrix(PyObject * self, PyObject * a
PyErr_SetString(PyExc_AttributeError, "Mathutils.OrthoProjectionMatrix(): please use 2D vectors when scaling in 2D\n");
return NULL;
}
+
+ if(!Vector_ReadCallback(vec))
+ return NULL;
+
}
if(vec == NULL) { //ortho projection onto cardinal plane
if(((strcmp(plane, "x") == 0)
@@ -891,6 +856,9 @@ static PyObject *M_Mathutils_Intersect( PyObject * self, PyObject * args )
return NULL;
}
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2) || !Vector_ReadCallback(vec3) || !Vector_ReadCallback(ray) || !Vector_ReadCallback(ray_off))
+ return NULL;
+
VECCOPY(v1, vec1->vec);
VECCOPY(v2, vec2->vec);
VECCOPY(v3, vec3->vec);
@@ -959,6 +927,10 @@ static PyObject *M_Mathutils_LineIntersect( PyObject * self, PyObject * args )
PyErr_SetString( PyExc_TypeError,"vectors must be of the same size\n" );
return NULL;
}
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2) || !Vector_ReadCallback(vec3) || !Vector_ReadCallback(vec4))
+ return NULL;
+
if( vec1->size == 3 || vec1->size == 2) {
int result;
@@ -1029,6 +1001,10 @@ static PyObject *M_Mathutils_QuadNormal( PyObject * self, PyObject * args )
PyErr_SetString( PyExc_TypeError, "only 3D vectors\n" );
return NULL;
}
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2) || !Vector_ReadCallback(vec3) || !Vector_ReadCallback(vec4))
+ return NULL;
+
VECCOPY(v1, vec1->vec);
VECCOPY(v2, vec2->vec);
VECCOPY(v3, vec3->vec);
@@ -1073,6 +1049,9 @@ static PyObject *M_Mathutils_TriangleNormal( PyObject * self, PyObject * args )
PyErr_SetString( PyExc_TypeError, "only 3D vectors\n" );
return NULL;
}
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2) || !Vector_ReadCallback(vec3))
+ return NULL;
VECCOPY(v1, vec1->vec);
VECCOPY(v2, vec2->vec);
@@ -1105,6 +1084,9 @@ static PyObject *M_Mathutils_TriangleArea( PyObject * self, PyObject * args )
PyErr_SetString( PyExc_TypeError, "vectors must be of the same size\n" );
return NULL;
}
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2) || !Vector_ReadCallback(vec3))
+ return NULL;
if (vec1->size == 3) {
VECCOPY(v1, vec1->vec);
@@ -1154,8 +1136,8 @@ int EXPP_FloatsAreEqual(float A, float B, int floatSteps)
}
/*---------------------- EXPP_VectorsAreEqual -------------------------
Builds on EXPP_FloatsAreEqual to test vectors */
-int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps){
-
+int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps)
+{
int x;
for (x=0; x< size; x++){
if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0)
@@ -1165,6 +1147,95 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps){
}
+/* Mathutils Callbacks */
+
+/* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
+Mathutils_Callback *mathutils_callbacks[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+
+int Mathutils_RegisterCallback(Mathutils_Callback *cb)
+{
+ int i;
+
+ /* find the first free slot */
+ for(i= 0; mathutils_callbacks[i]; i++) {
+ if(mathutils_callbacks[i]==cb) /* alredy registered? */
+ return i;
+ }
+
+ mathutils_callbacks[i] = cb;
+ return i;
+}
+
+/* use macros to check for NULL */
+int _Vector_ReadCallback(VectorObject *self)
+{
+ Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ if(cb->get(self->cb_user, self->cb_subtype, self->vec)) {
+ return 1;
+ }
+ else {
+ PyErr_SetString(PyExc_SystemError, "Vector user has become invalid");
+ return 0;
+ }
+}
+
+int _Vector_WriteCallback(VectorObject *self)
+{
+ Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ if(cb->set(self->cb_user, self->cb_subtype, self->vec)) {
+ return 1;
+ }
+ else {
+ PyErr_SetString(PyExc_SystemError, "Vector user has become invalid");
+ return 0;
+ }
+}
-//#######################################################################
-//#############################DEPRECATED################################
+int _Vector_ReadIndexCallback(VectorObject *self, int index)
+{
+ Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ if(cb->get_index(self->cb_user, self->cb_subtype, self->vec, index)) {
+ return 1;
+ }
+ else {
+ PyErr_SetString(PyExc_SystemError, "Vector user has become invalid");
+ return 0;
+ }
+}
+
+int _Vector_WriteIndexCallback(VectorObject *self, int index)
+{
+ Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ if(cb->set_index(self->cb_user, self->cb_subtype, self->vec, index)) {
+ return 1;
+ }
+ else {
+ PyErr_SetString(PyExc_SystemError, "Vector user has become invalid");
+ return 0;
+ }
+}
+
+/* matrix callbacks */
+int _Matrix_ReadCallback(MatrixObject *self)
+{
+ Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ if(cb->get(self->cb_user, self->cb_subtype, self->contigPtr)) {
+ return 1;
+ }
+ else {
+ PyErr_SetString(PyExc_SystemError, "Matrix user has become invalid");
+ return 0;
+ }
+}
+
+int _Matrix_WriteCallback(MatrixObject *self)
+{
+ Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
+ if(cb->set(self->cb_user, self->cb_subtype, self->contigPtr)) {
+ return 1;
+ }
+ else {
+ PyErr_SetString(PyExc_SystemError, "Matrix user has become invalid");
+ return 0;
+ }
+}
diff --git a/source/blender/python/generic/Mathutils.h b/source/blender/python/generic/Mathutils.h
index e8882c3dac2..a89b779ecbb 100644
--- a/source/blender/python/generic/Mathutils.h
+++ b/source/blender/python/generic/Mathutils.h
@@ -1,5 +1,5 @@
/*
- * $Id: Mathutils.h 20332 2009-05-22 03:22:56Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -40,8 +40,6 @@
PyObject *Mathutils_Init( const char * from );
-PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat);
-PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec);
PyObject *quat_rotation(PyObject *arg1, PyObject *arg2);
int EXPP_FloatsAreEqual(float A, float B, int floatSteps);
@@ -49,8 +47,9 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
#define Py_PI 3.14159265358979323846
-#define Py_WRAP 1024
-#define Py_NEW 2048
+
+#define Py_NEW 1
+#define Py_WRAP 2
/* Mathutils is used by the BGE and Blender so have to define
@@ -65,4 +64,33 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
#endif
+typedef struct Mathutils_Callback Mathutils_Callback;
+struct Mathutils_Callback {
+ int (*check)(PyObject *user); /* checks the user is still valid */
+ int (*get)(PyObject *user, int subtype, float *from); /* gets the vector from the user */
+ int (*set)(PyObject *user, int subtype, float *to); /* sets the users vector values once the vector is modified */
+ int (*get_index)(PyObject *user, int subtype, float *from,int index); /* same as above but only for an index */
+ int (*set_index)(PyObject *user, int subtype, float *to, int index); /* same as above but only for an index */
+};
+
+int Mathutils_RegisterCallback(Mathutils_Callback *cb);
+
+int _Vector_ReadCallback(VectorObject *self);
+int _Vector_WriteCallback(VectorObject *self);
+int _Vector_ReadIndexCallback(VectorObject *self, int index);
+int _Vector_WriteIndexCallback(VectorObject *self, int index);
+
+/* since this is called so often avoid where possible */
+#define Vector_ReadCallback(_self) (((_self)->cb_user ? _Vector_ReadCallback(_self):1))
+#define Vector_WriteCallback(_self) (((_self)->cb_user ?_Vector_WriteCallback(_self):1))
+#define Vector_ReadIndexCallback(_self, _index) (((_self)->cb_user ? _Vector_ReadIndexCallback(_self, _index):1))
+#define Vector_WriteIndexCallback(_self, _index) (((_self)->cb_user ? _Vector_WriteIndexCallback(_self, _index):1))
+
+
+int _Matrix_ReadCallback(MatrixObject *self);
+int _Matrix_WriteCallback(MatrixObject *self);
+
+#define Matrix_ReadCallback(_self) (((_self)->cb_user ?_Matrix_ReadCallback(_self):1))
+#define Matrix_WriteCallback(_self) (((_self)->cb_user ?_Matrix_WriteCallback(_self):1))
+
#endif /* EXPP_Mathutils_H */
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 6789aea9c10..c41ea386c0e 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -1,5 +1,5 @@
/*
- * $Id: bpy_internal_import.c 20434 2009-05-26 18:06:09Z campbellbarton $
+ * $Id$
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index 475ec8dd118..aeeafb7c1c4 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -1,5 +1,5 @@
/*
- * $Id: bpy_internal_import.h 20434 2009-05-26 18:06:09Z campbellbarton $
+ * $Id$
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/python/generic/euler.c b/source/blender/python/generic/euler.c
index a65feb7e949..e78a5739347 100644
--- a/source/blender/python/generic/euler.c
+++ b/source/blender/python/generic/euler.c
@@ -1,5 +1,5 @@
/*
- * $Id: euler.c 20248 2009-05-18 04:11:54Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/python/generic/euler.h b/source/blender/python/generic/euler.h
index 3206668ffa0..3be629351cb 100644
--- a/source/blender/python/generic/euler.h
+++ b/source/blender/python/generic/euler.h
@@ -1,5 +1,5 @@
/*
- * $Id: euler.h 20248 2009-05-18 04:11:54Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/python/generic/matrix.c b/source/blender/python/generic/matrix.c
index e2ab1c3c653..db5b4ab08bf 100644
--- a/source/blender/python/generic/matrix.c
+++ b/source/blender/python/generic/matrix.c
@@ -1,5 +1,5 @@
/*
- * $Id: matrix.c 20249 2009-05-18 04:27:48Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -31,6 +31,71 @@
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
+static PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec); /* utility func */
+
+
+/* matrix vector callbacks */
+int mathutils_matrix_vector_cb_index= -1;
+
+static int mathutils_matrix_vector_check(MatrixObject *self)
+{
+ return Matrix_ReadCallback(self);
+}
+
+static int mathutils_matrix_vector_get(MatrixObject *self, int subtype, float *vec_from)
+{
+ int i;
+ if(!Matrix_ReadCallback(self))
+ return 0;
+
+ for(i=0; i<self->colSize; i++)
+ vec_from[i]= self->matrix[subtype][i];
+
+ return 1;
+}
+
+static int mathutils_matrix_vector_set(MatrixObject *self, int subtype, float *vec_to)
+{
+ int i;
+ if(!Matrix_ReadCallback(self))
+ return 0;
+
+ for(i=0; i<self->colSize; i++)
+ self->matrix[subtype][i]= vec_to[i];
+
+ Matrix_WriteCallback(self);
+ return 1;
+}
+
+static int mathutils_matrix_vector_get_index(MatrixObject *self, int subtype, float *vec_from, int index)
+{
+ if(!Matrix_ReadCallback(self))
+ return 0;
+
+ vec_from[index]= self->matrix[subtype][index];
+ return 1;
+}
+
+static int mathutils_matrix_vector_set_index(MatrixObject *self, int subtype, float *vec_to, int index)
+{
+ if(!Matrix_ReadCallback(self))
+ return 0;
+
+ self->matrix[subtype][index]= vec_to[index];
+
+ Matrix_WriteCallback(self);
+ return 1;
+}
+
+Mathutils_Callback mathutils_matrix_vector_cb = {
+ mathutils_matrix_vector_check,
+ mathutils_matrix_vector_get,
+ mathutils_matrix_vector_set,
+ mathutils_matrix_vector_get_index,
+ mathutils_matrix_vector_set_index
+};
+/* matrix vector callbacks, this is so you can do matrix[i][j] = val */
+
/*-------------------------DOC STRINGS ---------------------------*/
static char Matrix_Zero_doc[] = "() - set all values in the matrix to 0";
static char Matrix_Identity_doc[] = "() - set the square matrix to it's identity matrix";
@@ -99,6 +164,8 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
argObject = PyTuple_GET_ITEM(args, 0);
if(MatrixObject_Check(argObject)){
mat = (MatrixObject*)argObject;
+ if(!Matrix_ReadCallback(mat))
+ return NULL;
argSize = mat->rowSize; //rows
seqSize = mat->colSize; //col
@@ -158,6 +225,9 @@ static PyObject *Matrix_toQuat(MatrixObject * self)
{
float quat[4];
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
/*must be 3-4 cols, 3-4 rows, square matrix*/
if(self->colSize < 3 || self->rowSize < 3 || (self->colSize != self->rowSize)) {
PyErr_SetString(PyExc_AttributeError, "Matrix.toQuat(): inappropriate matrix size - expects 3x3 or 4x4 matrix");
@@ -178,6 +248,9 @@ PyObject *Matrix_toEuler(MatrixObject * self, PyObject *args)
EulerObject *eul_compat = NULL;
int x;
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(!PyArg_ParseTuple(args, "|O!:toEuler", &euler_Type, &eul_compat))
return NULL;
@@ -213,17 +286,20 @@ PyObject *Matrix_Resize4x4(MatrixObject * self)
{
int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
- if(self->data.blend_data){
- PyErr_SetString(PyExc_TypeError, "cannot resize wrapped data - only python matrices");
+ if(self->wrapped==Py_WRAP){
+ PyErr_SetString(PyExc_TypeError, "cannot resize wrapped data - make a copy and resize that");
return NULL;
}
-
- self->data.py_data = PyMem_Realloc(self->data.py_data, (sizeof(float) * 16));
- if(self->data.py_data == NULL) {
+ if(self->cb_user){
+ PyErr_SetString(PyExc_TypeError, "cannot resize owned data - make a copy and resize that");
+ return NULL;
+ }
+
+ self->contigPtr = PyMem_Realloc(self->contigPtr, (sizeof(float) * 16));
+ if(self->contigPtr == NULL) {
PyErr_SetString(PyExc_MemoryError, "matrix.resize4x4(): problem allocating pointer space");
return NULL;
}
- self->contigPtr = self->data.py_data; /*force*/
self->matrix = PyMem_Realloc(self->matrix, (sizeof(float *) * 4));
if(self->matrix == NULL) {
PyErr_SetString(PyExc_MemoryError, "matrix.resize4x4(): problem allocating pointer space");
@@ -266,7 +342,10 @@ PyObject *Matrix_Resize4x4(MatrixObject * self)
PyObject *Matrix_TranslationPart(MatrixObject * self)
{
float vec[4];
-
+
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(self->colSize < 3 || self->rowSize < 4){
PyErr_SetString(PyExc_AttributeError, "Matrix.translationPart: inappropriate matrix size");
return NULL;
@@ -284,6 +363,9 @@ PyObject *Matrix_RotationPart(MatrixObject * self)
float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(self->colSize < 3 || self->rowSize < 3){
PyErr_SetString(PyExc_AttributeError, "Matrix.rotationPart: inappropriate matrix size\n");
return NULL;
@@ -307,6 +389,9 @@ PyObject *Matrix_scalePart(MatrixObject * self)
float scale[3], rot[3];
float mat[3][3], imat[3][3], tmat[3][3];
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
/*must be 3-4 cols, 3-4 rows, square matrix*/
if(self->colSize == 4 && self->rowSize == 4)
Mat3CpyMat4(mat, (float (*)[4])*self->matrix);
@@ -337,6 +422,9 @@ PyObject *Matrix_Invert(MatrixObject * self)
float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(self->rowSize != self->colSize){
PyErr_SetString(PyExc_AttributeError, "Matrix.invert(ed): only square matrices are supported");
return NULL;
@@ -377,6 +465,7 @@ PyObject *Matrix_Invert(MatrixObject * self)
return NULL;
}
+ Matrix_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -387,6 +476,9 @@ PyObject *Matrix_Determinant(MatrixObject * self)
{
float det = 0.0f;
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(self->rowSize != self->colSize){
PyErr_SetString(PyExc_AttributeError, "Matrix.determinant: only square matrices are supported");
return NULL;
@@ -412,6 +504,9 @@ PyObject *Matrix_Transpose(MatrixObject * self)
{
float t = 0.0f;
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(self->rowSize != self->colSize){
PyErr_SetString(PyExc_AttributeError, "Matrix.transpose(d): only square matrices are supported");
return NULL;
@@ -427,6 +522,7 @@ PyObject *Matrix_Transpose(MatrixObject * self)
Mat4Transp((float (*)[4])*self->matrix);
}
+ Matrix_WriteCallback(self);
Py_INCREF(self);
return (PyObject *)self;
}
@@ -436,18 +532,25 @@ PyObject *Matrix_Transpose(MatrixObject * self)
PyObject *Matrix_Zero(MatrixObject * self)
{
int row, col;
-
+
for(row = 0; row < self->rowSize; row++) {
for(col = 0; col < self->colSize; col++) {
self->matrix[row][col] = 0.0f;
}
}
+
+ if(!Matrix_WriteCallback(self))
+ return NULL;
+
Py_INCREF(self);
return (PyObject *)self;
}
/*---------------------------Matrix.identity(() ------------------*/
PyObject *Matrix_Identity(MatrixObject * self)
{
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(self->rowSize != self->colSize){
PyErr_SetString(PyExc_AttributeError, "Matrix.identity: only square matrices are supported\n");
return NULL;
@@ -464,6 +567,9 @@ PyObject *Matrix_Identity(MatrixObject * self)
Mat4One((float (*)[4]) *self->matrix);
}
+ if(!Matrix_WriteCallback(self))
+ return NULL;
+
Py_INCREF(self);
return (PyObject *)self;
}
@@ -471,6 +577,9 @@ PyObject *Matrix_Identity(MatrixObject * self)
/*---------------------------Matrix.inverted() ------------------*/
PyObject *Matrix_copy(MatrixObject * self)
{
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
return (PyObject*)(MatrixObject*)newMatrixObject((float (*))*self->matrix, self->rowSize, self->colSize, Py_NEW);
}
@@ -480,9 +589,10 @@ static void Matrix_dealloc(MatrixObject * self)
{
PyMem_Free(self->matrix);
/*only free py_data*/
- if(self->data.py_data){
- PyMem_Free(self->data.py_data);
- }
+ if(self->wrapped==Py_WRAP)
+ PyMem_Free(self->contigPtr);
+
+ Py_XDECREF(self->cb_user);
PyObject_DEL(self);
}
@@ -493,6 +603,9 @@ static PyObject *Matrix_repr(MatrixObject * self)
int x, y;
char buffer[48], str[1024];
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
BLI_strncpy(str,"",1024);
for(x = 0; x < self->rowSize; x++){
sprintf(buffer, "[");
@@ -529,6 +642,9 @@ static PyObject* Matrix_richcmpr(PyObject *objectA, PyObject *objectB, int compa
matA = (MatrixObject*)objectA;
matB = (MatrixObject*)objectB;
+ if(!Matrix_ReadCallback(matA) || !Matrix_ReadCallback(matB))
+ return NULL;
+
if (matA->colSize != matB->colSize || matA->rowSize != matB->rowSize){
if (comparison_type == Py_NE){
Py_RETURN_TRUE;
@@ -576,11 +692,14 @@ static int Matrix_len(MatrixObject * self)
the wrapped vector gives direct access to the matrix data*/
static PyObject *Matrix_item(MatrixObject * self, int i)
{
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
if(i < 0 || i >= self->rowSize) {
PyErr_SetString(PyExc_IndexError, "matrix[attribute]: array index out of range");
return NULL;
}
- return newVectorObject(self->matrix[i], self->colSize, Py_WRAP);
+ return newVectorObject_cb((PyObject *)self, self->colSize, mathutils_matrix_vector_cb_index, i);
}
/*----------------------------object[]-------------------------
sequence accessor (set)*/
@@ -590,6 +709,9 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
float vec[4];
PyObject *m, *f;
+ if(!Matrix_ReadCallback(self))
+ return -1;
+
if(i >= self->rowSize || i < 0){
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: bad row\n");
return -1;
@@ -623,6 +745,8 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
for(y = 0; y < size; y++){
self->matrix[i][y] = vec[y];
}
+
+ Matrix_WriteCallback(self);
return 0;
}else{
PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: expects a sequence of column size\n");
@@ -636,6 +760,9 @@ static PyObject *Matrix_slice(MatrixObject * self, int begin, int end)
PyObject *list = NULL;
int count;
+
+ if(!Matrix_ReadCallback(self))
+ return NULL;
CLAMP(begin, 0, self->rowSize);
CLAMP(end, 0, self->rowSize);
@@ -644,7 +771,8 @@ static PyObject *Matrix_slice(MatrixObject * self, int begin, int end)
list = PyList_New(end - begin);
for(count = begin; count < end; count++) {
PyList_SetItem(list, count - begin,
- newVectorObject(self->matrix[count], self->colSize, Py_WRAP));
+ newVectorObject_cb((PyObject *)self, self->colSize, mathutils_matrix_vector_cb_index, count));
+
}
return list;
@@ -659,6 +787,9 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end,
PyObject *subseq;
PyObject *m;
+ if(!Matrix_ReadCallback(self))
+ return -1;
+
CLAMP(begin, 0, self->rowSize);
CLAMP(end, 0, self->rowSize);
begin = MIN2(begin,end);
@@ -716,6 +847,8 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end,
for(x = 0; x < (size * sub_size); x++){
self->matrix[begin + (int)floor(x / self->colSize)][x % self->colSize] = mat[x];
}
+
+ Matrix_WriteCallback(self);
return 0;
}else{
PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: illegal argument type for built-in operation\n");
@@ -738,6 +871,10 @@ static PyObject *Matrix_add(PyObject * m1, PyObject * m2)
PyErr_SetString(PyExc_AttributeError, "Matrix addition: arguments not valid for this operation....");
return NULL;
}
+
+ if(!Matrix_ReadCallback(mat1) || !Matrix_ReadCallback(mat2))
+ return NULL;
+
if(mat1->rowSize != mat2->rowSize || mat1->colSize != mat2->colSize){
PyErr_SetString(PyExc_AttributeError, "Matrix addition: matrices must have the same dimensions for this operation");
return NULL;
@@ -767,6 +904,10 @@ static PyObject *Matrix_sub(PyObject * m1, PyObject * m2)
PyErr_SetString(PyExc_AttributeError, "Matrix addition: arguments not valid for this operation....");
return NULL;
}
+
+ if(!Matrix_ReadCallback(mat1) || !Matrix_ReadCallback(mat2))
+ return NULL;
+
if(mat1->rowSize != mat2->rowSize || mat1->colSize != mat2->colSize){
PyErr_SetString(PyExc_AttributeError, "Matrix addition: matrices must have the same dimensions for this operation");
return NULL;
@@ -791,8 +932,16 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
double dot = 0.0f;
MatrixObject *mat1 = NULL, *mat2 = NULL;
- if(MatrixObject_Check(m1)) mat1 = (MatrixObject*)m1;
- if(MatrixObject_Check(m2)) mat2 = (MatrixObject*)m2;
+ if(MatrixObject_Check(m1)) {
+ mat1 = (MatrixObject*)m1;
+ if(!Matrix_ReadCallback(mat1))
+ return NULL;
+ }
+ if(MatrixObject_Check(m2)) {
+ mat2 = (MatrixObject*)m2;
+ if(!Matrix_ReadCallback(mat2))
+ return NULL;
+ }
if(mat1 && mat2) { /*MATRIX * MATRIX*/
if(mat1->colSize != mat2->rowSize){
@@ -829,7 +978,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
else /* if(mat1) { */ {
if(VectorObject_Check(m2)) { /* MATRIX*VECTOR */
- return column_vector_multiplication(mat1, (VectorObject *)m2);
+ return column_vector_multiplication(mat1, (VectorObject *)m2); /* vector update done inside the function */
}
else {
scalar= PyFloat_AsDouble(m2);
@@ -851,6 +1000,9 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
}
static PyObject* Matrix_inv(MatrixObject *self)
{
+ if(!Matrix_ReadCallback(self))
+ return NULL;
+
return Matrix_Invert(self);
}
@@ -900,6 +1052,17 @@ static PyObject *Matrix_getColSize( MatrixObject * self, void *type )
return PyLong_FromLong((long) self->colSize);
}
+static PyObject *Matrix_getOwner( MatrixObject * self, void *type )
+{
+ if(self->cb_user==NULL) {
+ Py_RETURN_NONE;
+ }
+ else {
+ Py_INCREF(self->cb_user);
+ return self->cb_user;
+ }
+}
+
static PyObject *Matrix_getWrapped( MatrixObject * self, void *type )
{
if (self->wrapped == Py_WRAP)
@@ -915,6 +1078,7 @@ static PyGetSetDef Matrix_getseters[] = {
{"rowSize", (getter)Matrix_getRowSize, (setter)NULL, "", NULL},
{"colSize", (getter)Matrix_getColSize, (setter)NULL, "", NULL},
{"wrapped", (getter)Matrix_getWrapped, (setter)NULL, "", NULL},
+ {"__owner__",(getter)Matrix_getOwner, (setter)NULL, "Read only owner for vectors that depend on another object", NULL},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};
@@ -984,7 +1148,7 @@ self->matrix self->contiguous_ptr (reference to data.xxx)
[4]
[5]
....
-self->matrix[1][1] = self->contiguous_ptr[4] = self->data.xxx_data[4]*/
+self->matrix[1][1] = self->contigPtr[4] */
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
(i.e. it was allocated elsewhere by MEM_mallocN())
@@ -1002,14 +1166,15 @@ PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type)
}
self = PyObject_NEW(MatrixObject, &matrix_Type);
- self->data.blend_data = NULL;
- self->data.py_data = NULL;
self->rowSize = rowSize;
self->colSize = colSize;
+
+ /* init callbacks as NULL */
+ self->cb_user= NULL;
+ self->cb_type= self->cb_subtype= 0;
if(type == Py_WRAP){
- self->data.blend_data = mat;
- self->contigPtr = self->data.blend_data;
+ self->contigPtr = mat;
/*create pointer array*/
self->matrix = PyMem_Malloc(rowSize * sizeof(float *));
if(self->matrix == NULL) { /*allocation failure*/
@@ -1022,16 +1187,15 @@ PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type)
}
self->wrapped = Py_WRAP;
}else if (type == Py_NEW){
- self->data.py_data = PyMem_Malloc(rowSize * colSize * sizeof(float));
- if(self->data.py_data == NULL) { /*allocation failure*/
+ self->contigPtr = PyMem_Malloc(rowSize * colSize * sizeof(float));
+ if(self->contigPtr == NULL) { /*allocation failure*/
PyErr_SetString( PyExc_MemoryError, "matrix(): problem allocating pointer space\n");
return NULL;
}
- self->contigPtr = self->data.py_data;
/*create pointer array*/
self->matrix = PyMem_Malloc(rowSize * sizeof(float *));
if(self->matrix == NULL) { /*allocation failure*/
- PyMem_Free(self->data.py_data);
+ PyMem_Free(self->contigPtr);
PyErr_SetString( PyExc_MemoryError, "matrix(): problem allocating pointer space");
return NULL;
}
@@ -1056,3 +1220,53 @@ PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type)
}
return (PyObject *) self;
}
+
+PyObject *newMatrixObject_cb(PyObject *cb_user, int rowSize, int colSize, int cb_type, int cb_subtype)
+{
+ MatrixObject *self= (MatrixObject *)newMatrixObject(NULL, rowSize, colSize, Py_NEW);
+ if(self) {
+ Py_INCREF(cb_user);
+ self->cb_user= cb_user;
+ self->cb_type= (unsigned char)cb_type;
+ self->cb_subtype= (unsigned char)cb_subtype;
+ }
+ return (PyObject *) self;
+}
+
+//----------------column_vector_multiplication (internal)---------
+//COLUMN VECTOR Multiplication (Matrix X Vector)
+// [1][2][3] [a]
+// [4][5][6] * [b]
+// [7][8][9] [c]
+//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
+static PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec)
+{
+ float vecNew[4], vecCopy[4];
+ double dot = 0.0f;
+ int x, y, z = 0;
+
+ if(!Matrix_ReadCallback(mat) || !Vector_ReadCallback(vec))
+ return NULL;
+
+ if(mat->rowSize != vec->size){
+ if(mat->rowSize == 4 && vec->size != 3){
+ PyErr_SetString(PyExc_AttributeError, "matrix * vector: matrix row size and vector size must be the same");
+ return NULL;
+ }else{
+ vecCopy[3] = 1.0f;
+ }
+ }
+
+ for(x = 0; x < vec->size; x++){
+ vecCopy[x] = vec->vec[x];
+ }
+
+ for(x = 0; x < mat->rowSize; x++) {
+ for(y = 0; y < mat->colSize; y++) {
+ dot += mat->matrix[x][y] * vecCopy[y];
+ }
+ vecNew[z++] = (float)dot;
+ dot = 0.0f;
+ }
+ return newVectorObject(vecNew, vec->size, Py_NEW);
+}
diff --git a/source/blender/python/generic/matrix.h b/source/blender/python/generic/matrix.h
index ef82263fe00..cc3928f1632 100644
--- a/source/blender/python/generic/matrix.h
+++ b/source/blender/python/generic/matrix.h
@@ -1,5 +1,5 @@
/*
- * $Id: matrix.h 20248 2009-05-18 04:11:54Z campbellbarton $
+ * $Id$
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -39,15 +39,14 @@ extern PyTypeObject matrix_Type;
typedef float **ptRow;
typedef struct _Matrix {
PyObject_VAR_HEAD
- struct{
- float *py_data; /*python managed*/
- float *blend_data; /*blender managed*/
- }data;
- ptRow matrix; /*ptr to the contigPtr (accessor)*/
- float *contigPtr; /*1D array of data (alias)*/
- int rowSize;
- int colSize;
- int wrapped; /*is wrapped data?*/
+ ptRow matrix; /*ptr to the contigPtr (accessor)*/
+ float* contigPtr; /*1D array of data (alias)*/
+ PyObject* cb_user; /* if this vector references another object, otherwise NULL, *Note* this owns its reference */
+ unsigned char rowSize;
+ unsigned char colSize;
+ unsigned char wrapped; /*is wrapped data?*/
+ unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */
+ unsigned int cb_subtype; /* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */
} MatrixObject;
/*struct data contains a pointer to the actual data that the
@@ -57,5 +56,9 @@ blender (stored in blend_data). This is an either/or struct not both*/
/*prototypes*/
PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type);
+PyObject *newMatrixObject_cb(PyObject *user, int rowSize, int colSize, int cb_type, int cb_subtype);
+
+extern int mathutils_matrix_vector_cb_index;
+extern struct Mathutils_Callback mathutils_matrix_vector_cb;
#endif /* EXPP_matrix_H */
diff --git a/source/blender/python/generic/quat.c b/source/blender/python/generic/quat.c
index 4ad5d07b3b8..1d46be4b6ba 100644
--- a/source/blender/python/generic/quat.c
+++ b/source/blender/python/generic/quat.c
@@ -1,5 +1,5 @@
/*
- * $Id: quat.c 20332 2009-05-22 03:22:56Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -75,7 +75,7 @@ static struct PyMethodDef Quaternion_methods[] = {
//----------------------------------Mathutils.Quaternion() --------------
static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- PyObject *listObject = NULL, *n, *q, *f;
+ PyObject *listObject = NULL, *n, *q;
int size, i;
float quat[4], scalar;
double norm = 0.0f, angle = 0.0f;
@@ -159,7 +159,6 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
}
quat[i] = scalar;
- Py_DECREF(f);
Py_DECREF(q);
}
if(size == 3){ //calculate the quat based on axis/angle
diff --git a/source/blender/python/generic/quat.h b/source/blender/python/generic/quat.h
index cfb50e4dbe1..ebbac26e39c 100644
--- a/source/blender/python/generic/quat.h
+++ b/source/blender/python/generic/quat.h
@@ -1,5 +1,5 @@
/*
- * $Id: quat.h 20332 2009-05-22 03:22:56Z campbellbarton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/python/generic/vector.c b/source/blender/python/generic/vector.c
index 562413c6967..dea5bc93898 100644
--- a/source/blender/python/generic/vector.c
+++ b/source/blender/python/generic/vector.c
@@ -1,5 +1,5 @@
/*
- * $Id: vector.c 20332 2009-05-22 03:22:56Z campbellbarton $
+ * $Id$
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -39,6 +39,8 @@
#define SWIZZLE_VALID_AXIS 0x4
#define SWIZZLE_AXIS 0x3
+static PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat); /* utility func */
+
/*-------------------------DOC STRINGS ---------------------------*/
static char Vector_Zero_doc[] = "() - set all values in the vector to 0";
static char Vector_Normalize_doc[] = "() - normalize the vector";
@@ -60,7 +62,7 @@ static PyObject *Vector_Resize2D( VectorObject * self );
static PyObject *Vector_Resize3D( VectorObject * self );
static PyObject *Vector_Resize4D( VectorObject * self );
static PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args );
-static PyObject *Vector_Reflect( VectorObject * self, PyObject * value );
+static PyObject *Vector_Reflect( VectorObject *self, VectorObject *value );
static PyObject *Vector_Cross( VectorObject * self, VectorObject * value );
static PyObject *Vector_Dot( VectorObject * self, VectorObject * value );
static PyObject *Vector_copy( VectorObject * self );
@@ -70,8 +72,8 @@ static struct PyMethodDef Vector_methods[] = {
{"normalize", (PyCFunction) Vector_Normalize, METH_NOARGS, Vector_Normalize_doc},
{"negate", (PyCFunction) Vector_Negate, METH_NOARGS, Vector_Negate_doc},
{"resize2D", (PyCFunction) Vector_Resize2D, METH_NOARGS, Vector_Resize2D_doc},
- {"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize2D_doc},
- {"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize2D_doc},
+ {"resize3D", (PyCFunction) Vector_Resize3D, METH_NOARGS, Vector_Resize3D_doc},
+ {"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize4D_doc},
{"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, Vector_ToTrackQuat_doc},
{"reflect", ( PyCFunction ) Vector_Reflect, METH_O, Vector_Reflect_doc},
{"cross", ( PyCFunction ) Vector_Cross, METH_O, Vector_Dot_doc},
@@ -141,6 +143,8 @@ static PyObject *Vector_Zero(VectorObject * self)
for(i = 0; i < self->size; i++) {
self->vec[i] = 0.0f;
}
+
+ Vector_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -151,6 +155,9 @@ static PyObject *Vector_Normalize(VectorObject * self)
int i;
float norm = 0.0f;
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
for(i = 0; i < self->size; i++) {
norm += self->vec[i] * self->vec[i];
}
@@ -158,6 +165,8 @@ static PyObject *Vector_Normalize(VectorObject * self)
for(i = 0; i < self->size; i++) {
self->vec[i] /= norm;
}
+
+ Vector_WriteCallback(self);
Py_INCREF(self);
return (PyObject*)self;
}
@@ -171,6 +180,11 @@ static PyObject *Vector_Resize2D(VectorObject * self)
PyErr_SetString(PyExc_TypeError, "vector.resize2d(): cannot resize wrapped data - only python vectors\n");
return NULL;
}
+ if(self->cb_user) {
+ PyErr_SetString(PyExc_TypeError, "vector.resize4d(): cannot resize a vector that has an owner");
+ return NULL;
+ }
+
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2));
if(self->vec == NULL) {
PyErr_SetString(PyExc_MemoryError, "vector.resize2d(): problem allocating pointer space\n\n");
@@ -189,6 +203,11 @@ static PyObject *Vector_Resize3D(VectorObject * self)
PyErr_SetString(PyExc_TypeError, "vector.resize3d(): cannot resize wrapped data - only python vectors\n");
return NULL;
}
+ if(self->cb_user) {
+ PyErr_SetString(PyExc_TypeError, "vector.resize4d(): cannot resize a vector that has an owner");
+ return NULL;
+ }
+
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3));
if(self->vec == NULL) {
PyErr_SetString(PyExc_MemoryError, "vector.resize3d(): problem allocating pointer space\n\n");
@@ -210,6 +229,11 @@ static PyObject *Vector_Resize4D(VectorObject * self)
PyErr_SetString(PyExc_TypeError, "vector.resize4d(): cannot resize wrapped data - only python vectors");
return NULL;
}
+ if(self->cb_user) {
+ PyErr_SetString(PyExc_TypeError, "vector.resize4d(): cannot resize a vector that has an owner");
+ return NULL;
+ }
+
self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4));
if(self->vec == NULL) {
PyErr_SetString(PyExc_MemoryError, "vector.resize4d(): problem allocating pointer space\n\n");
@@ -241,6 +265,9 @@ static PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args )
PyErr_SetString( PyExc_TypeError, "only for 3D vectors\n" );
return NULL;
}
+
+ if(!Vector_ReadCallback(self))
+ return NULL;
if (strack) {
if (strlen(strack) == 2) {
@@ -342,9 +369,8 @@ static PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args )
return a reflected vector on the mirror normal
((2 * DotVecs(vec, mirror)) * mirror) - vec
using arithb.c would be nice here */
-static PyObject *Vector_Reflect( VectorObject * self, PyObject * value )
+static PyObject *Vector_Reflect( VectorObject * self, VectorObject * value )
{
- VectorObject *mirrvec;
float mirror[3];
float vec[3];
float reflect[4] = {0.0f, 0.0f, 0.0f, 0.0f};
@@ -358,11 +384,13 @@ static PyObject *Vector_Reflect( VectorObject * self, PyObject * value )
PyErr_SetString( PyExc_TypeError, "vec.reflect(value): expected a vector argument" );
return NULL;
}
- mirrvec = (VectorObject *)value;
- mirror[0] = mirrvec->vec[0];
- mirror[1] = mirrvec->vec[1];
- if (mirrvec->size > 2) mirror[2] = mirrvec->vec[2];
+ if(!Vector_ReadCallback(self) || !Vector_ReadCallback(value))
+ return NULL;
+
+ mirror[0] = value->vec[0];
+ mirror[1] = value->vec[1];
+ if (value->size > 2) mirror[2] = value->vec[2];
else mirror[2] = 0.0;
/* normalize, whos idea was it not to use arithb.c? :-/ */
@@ -403,6 +431,9 @@ static PyObject *Vector_Cross( VectorObject * self, VectorObject * value )
return NULL;
}
+ if(!Vector_ReadCallback(self) || !Vector_ReadCallback(value))
+ return NULL;
+
vecCross = (VectorObject *)newVectorObject(NULL, 3, Py_NEW);
Crossf(vecCross->vec, self->vec, value->vec);
return (PyObject *)vecCross;
@@ -423,6 +454,9 @@ static PyObject *Vector_Dot( VectorObject * self, VectorObject * value )
return NULL;
}
+ if(!Vector_ReadCallback(self) || !Vector_ReadCallback(value))
+ return NULL;
+
for(x = 0; x < self->size; x++) {
dot += self->vec[x] * value->vec[x];
}
@@ -433,6 +467,9 @@ static PyObject *Vector_Dot( VectorObject * self, VectorObject * value )
return a copy of the vector */
static PyObject *Vector_copy(VectorObject * self)
{
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
return newVectorObject(self->vec, self->size, Py_NEW);
}
@@ -441,9 +478,10 @@ static PyObject *Vector_copy(VectorObject * self)
static void Vector_dealloc(VectorObject * self)
{
/* only free non wrapped */
- if(self->wrapped != Py_WRAP){
+ if(self->wrapped != Py_WRAP)
PyMem_Free(self->vec);
- }
+
+ Py_XDECREF(self->cb_user);
PyObject_DEL(self);
}
@@ -454,6 +492,9 @@ static PyObject *Vector_repr(VectorObject * self)
int i;
char buffer[48], str[1024];
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
BLI_strncpy(str,"[",1024);
for(i = 0; i < self->size; i++){
if(i < (self->size - 1)){
@@ -484,6 +525,9 @@ static PyObject *Vector_item(VectorObject * self, int i)
return NULL;
}
+ if(!Vector_ReadIndexCallback(self, i))
+ return NULL;
+
return PyFloat_FromDouble(self->vec[i]);
}
@@ -502,6 +546,9 @@ static int Vector_ass_item(VectorObject * self, int i, PyObject * ob)
return -1;
}
self->vec[i] = scalar;
+
+ if(!Vector_WriteIndexCallback(self, i))
+ return -1;
return 0;
}
@@ -512,6 +559,9 @@ static PyObject *Vector_slice(VectorObject * self, int begin, int end)
PyObject *list = NULL;
int count;
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
CLAMP(begin, 0, self->size);
if (end<0) end= self->size+end+1;
CLAMP(end, 0, self->size);
@@ -534,6 +584,9 @@ static int Vector_ass_slice(VectorObject * self, int begin, int end,
float vec[4], scalar;
PyObject *v;
+ if(!Vector_ReadCallback(self))
+ return -1;
+
CLAMP(begin, 0, self->size);
if (end<0) end= self->size+end+1;
CLAMP(end, 0, self->size);
@@ -566,6 +619,10 @@ static int Vector_ass_slice(VectorObject * self, int begin, int end,
for(y = 0; y < size; y++){
self->vec[begin + y] = vec[y];
}
+
+ if(!Vector_WriteCallback(self))
+ return -1;
+
return 0;
}
/*------------------------NUMERIC PROTOCOLS----------------------
@@ -586,6 +643,10 @@ static PyObject *Vector_add(PyObject * v1, PyObject * v2)
/* make sure v1 is always the vector */
if (vec1 && vec2 ) {
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2))
+ return NULL;
+
/*VECTOR + VECTOR*/
if(vec1->size != vec2->size) {
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation\n");
@@ -617,6 +678,10 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
/* make sure v1 is always the vector */
if (vec1 && vec2 ) {
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2))
+ return NULL;
+
/*VECTOR + VECTOR*/
if(vec1->size != vec2->size) {
PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation\n");
@@ -629,6 +694,7 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2)
return v1;
}
+ Vector_WriteCallback(vec1);
PyErr_SetString(PyExc_AttributeError, "Vector addition: arguments not valid for this operation....\n");
return NULL;
}
@@ -648,6 +714,9 @@ static PyObject *Vector_sub(PyObject * v1, PyObject * v2)
vec1 = (VectorObject*)v1;
vec2 = (VectorObject*)v2;
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2))
+ return NULL;
+
if(vec1->size != vec2->size) {
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation\n");
return NULL;
@@ -663,7 +732,7 @@ static PyObject *Vector_sub(PyObject * v1, PyObject * v2)
subtraction*/
static PyObject *Vector_isub(PyObject * v1, PyObject * v2)
{
- int i, size;
+ int i;
VectorObject *vec1 = NULL, *vec2 = NULL;
if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
@@ -677,12 +746,15 @@ static PyObject *Vector_isub(PyObject * v1, PyObject * v2)
PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation\n");
return NULL;
}
+
+ if(!Vector_ReadCallback(vec1) || !Vector_ReadCallback(vec2))
+ return NULL;
- size = vec1->size;
for(i = 0; i < vec1->size; i++) {
vec1->vec[i] = vec1->vec[i] - vec2->vec[i];
}
+ Vector_WriteCallback(vec1);
Py_INCREF( v1 );
return v1;
}
@@ -694,11 +766,17 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
VectorObject *vec1 = NULL, *vec2 = NULL;
float scalar;
- if VectorObject_Check(v1)
+ if VectorObject_Check(v1) {
vec1= (VectorObject *)v1;
-
- if VectorObject_Check(v2)
+ if(!Vector_ReadCallback(vec1))
+ return NULL;
+ }
+ if VectorObject_Check(v2) {
vec2= (VectorObject *)v2;
+ if(!Vector_ReadCallback(vec2))
+ return NULL;
+ }
+
/* make sure v1 is always the vector */
if (vec1 && vec2 ) {
@@ -757,6 +835,9 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
int i;
float scalar;
+ if(!Vector_ReadCallback(vec))
+ return NULL;
+
/* only support vec*=float and vec*=mat
vec*=vec result is a float so that wont work */
if (MatrixObject_Check(v2)) {
@@ -764,6 +845,9 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
int x,y, size = vec->size;
MatrixObject *mat= (MatrixObject*)v2;
+ if(!Vector_ReadCallback(mat))
+ return NULL;
+
if(mat->colSize != size){
if(mat->rowSize == 4 && vec->size != 3){
PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
@@ -787,22 +871,21 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
}
vec->vec[i] = (float)dot;
}
- Py_INCREF( v1 );
- return v1;
}
else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && PyErr_Occurred())==0) { /* VEC*=FLOAT */
for(i = 0; i < vec->size; i++) {
vec->vec[i] *= scalar;
}
-
- Py_INCREF( v1 );
- return v1;
-
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation\n");
+ return NULL;
}
- PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation\n");
- return NULL;
+ Vector_WriteCallback(vec);
+ Py_INCREF( v1 );
+ return v1;
}
/*------------------------obj / obj------------------------------
@@ -819,6 +902,9 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2)
}
vec1 = (VectorObject*)v1; /* vector */
+ if(!Vector_ReadCallback(vec1))
+ return NULL;
+
scalar = (float)PyFloat_AsDouble(v2);
if(scalar== -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float\n");
@@ -842,14 +928,10 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
{
int i;
float scalar;
- VectorObject *vec1 = NULL;
+ VectorObject *vec1 = (VectorObject*)v1;
- /*if(!VectorObject_Check(v1)) {
- PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float\n");
- return -1;
- }*/
-
- vec1 = (VectorObject*)v1; /* vector */
+ if(!Vector_ReadCallback(vec1))
+ return NULL;
scalar = (float)PyFloat_AsDouble(v2);
if(scalar==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
@@ -864,6 +946,9 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
for(i = 0; i < vec1->size; i++) {
vec1->vec[i] /= scalar;
}
+
+ Vector_WriteCallback(vec1);
+
Py_INCREF( v1 );
return v1;
}
@@ -874,6 +959,10 @@ static PyObject *Vector_neg(VectorObject *self)
{
int i;
float vec[4];
+
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
for(i = 0; i < self->size; i++){
vec[i] = -self->vec[i];
}
@@ -919,6 +1008,9 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
vecA = (VectorObject*)objectA;
vecB = (VectorObject*)objectB;
+ if(!Vector_ReadCallback(vecA) || !Vector_ReadCallback(vecB))
+ return NULL;
+
if (vecA->size != vecB->size){
if (comparison_type == Py_NE){
Py_RETURN_TRUE;
@@ -1045,66 +1137,12 @@ static PyNumberMethods Vector_NumMethods = {
static PyObject *Vector_getAxis( VectorObject * self, void *type )
{
- switch( (long)type ) {
- case 'X': /* these are backwards, but that how it works */
- return PyFloat_FromDouble(self->vec[0]);
- case 'Y':
- return PyFloat_FromDouble(self->vec[1]);
- case 'Z': /* these are backwards, but that how it works */
- if(self->size < 3) {
- PyErr_SetString(PyExc_AttributeError, "vector.z: error, cannot get this axis for a 2D vector\n");
- return NULL;
- }
- else {
- return PyFloat_FromDouble(self->vec[2]);
- }
- case 'W':
- if(self->size < 4) {
- PyErr_SetString(PyExc_AttributeError, "vector.w: error, cannot get this axis for a 3D vector\n");
- return NULL;
- }
-
- return PyFloat_FromDouble(self->vec[3]);
- default:
- {
- PyErr_SetString( PyExc_RuntimeError, "undefined type in Vector_getAxis" );
- return NULL;
- }
- }
+ return Vector_item(self, (int)type);
}
static int Vector_setAxis( VectorObject * self, PyObject * value, void * type )
{
- float param= (float)PyFloat_AsDouble( value );
-
- if (param==-1 && PyErr_Occurred()) {
- PyErr_SetString( PyExc_TypeError, "expected a number for the vector axis" );
- return -1;
- }
- switch( (long)type ) {
- case 'X': /* these are backwards, but that how it works */
- self->vec[0]= param;
- break;
- case 'Y':
- self->vec[1]= param;
- break;
- case 'Z': /* these are backwards, but that how it works */
- if(self->size < 3) {
- PyErr_SetString(PyExc_AttributeError, "vector.z: error, cannot get this axis for a 2D vector\n");
- return -1;
- }
- self->vec[2]= param;
- break;
- case 'W':
- if(self->size < 4) {
- PyErr_SetString(PyExc_AttributeError, "vector.w: error, cannot get this axis for a 3D vector\n");
- return -1;
- }
- self->vec[3]= param;
- break;
- }
-
- return 0;
+ return Vector_ass_item(self, (int)type, value);
}
/* vector.length */
@@ -1113,6 +1151,9 @@ static PyObject *Vector_getLength( VectorObject * self, void *type )
double dot = 0.0f;
int i;
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
for(i = 0; i < self->size; i++){
dot += (self->vec[i] * self->vec[i]);
}
@@ -1124,6 +1165,9 @@ static int Vector_setLength( VectorObject * self, PyObject * value )
double dot = 0.0f, param;
int i;
+ if(!Vector_ReadCallback(self))
+ return -1;
+
param= PyFloat_AsDouble( value );
if(param==-1.0 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "length must be set to a number");
@@ -1159,6 +1203,8 @@ static int Vector_setLength( VectorObject * self, PyObject * value )
self->vec[i]= self->vec[i] / (float)dot;
}
+ Vector_WriteCallback(self); /* checked alredy */
+
return 0;
}
@@ -1170,6 +1216,16 @@ static PyObject *Vector_getWrapped( VectorObject * self, void *type )
Py_RETURN_FALSE;
}
+static PyObject *Vector_getOwner( VectorObject * self, void *type )
+{
+ if(self->cb_user==NULL) {
+ Py_RETURN_NONE;
+ }
+ else {
+ Py_INCREF(self->cb_user);
+ return self->cb_user;
+ }
+}
/* Get a new Vector according to the provided swizzle. This function has little
error checking, as we are in control of the inputs: the closure is set by us
@@ -1181,6 +1237,9 @@ static PyObject *Vector_getSwizzle(VectorObject * self, void *closure)
float vec[MAX_DIMENSIONS];
unsigned int swizzleClosure;
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
/* Unpack the axes from the closure into an array. */
axisA = 0;
swizzleClosure = (unsigned int) closure;
@@ -1218,6 +1277,9 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur
float vecTemp[MAX_DIMENSIONS];
+ if(!Vector_ReadCallback(self))
+ return -1;
+
/* Check that the closure can be used with this vector: even 2D vectors have
swizzles defined for axes z and w, but they would be invalid. */
swizzleClosure = (unsigned int) closure;
@@ -1247,7 +1309,7 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur
axisB++;
}
memcpy(self->vec, vecTemp, axisB * sizeof(float));
- return 0;
+ /* continue with Vector_WriteCallback at the end */
}
else if (PyList_Check(value))
{
@@ -1273,7 +1335,7 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur
axisB++;
}
memcpy(self->vec, vecTemp, axisB * sizeof(float));
- return 0;
+ /* continue with Vector_WriteCallback at the end */
}
else if (((scalarVal = (float)PyFloat_AsDouble(value)) == -1.0 && PyErr_Occurred())==0)
{
@@ -1286,13 +1348,17 @@ static int Vector_setSwizzle(VectorObject * self, PyObject * value, void *closur
swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
}
- return 0;
+ /* continue with Vector_WriteCallback at the end */
}
- else
- {
+ else {
PyErr_SetString( PyExc_TypeError, "Expected a Vector, list or scalar value." );
return -1;
}
+
+ if(!Vector_WriteCallback(vecVal))
+ return -1;
+ else
+ return 0;
}
/*****************************************************************************/
@@ -1302,19 +1368,19 @@ static PyGetSetDef Vector_getseters[] = {
{"x",
(getter)Vector_getAxis, (setter)Vector_setAxis,
"Vector X axis",
- (void *)'X'},
+ (void *)0},
{"y",
(getter)Vector_getAxis, (setter)Vector_setAxis,
"Vector Y axis",
- (void *)'Y'},
+ (void *)1},
{"z",
(getter)Vector_getAxis, (setter)Vector_setAxis,
"Vector Z axis",
- (void *)'Z'},
+ (void *)2},
{"w",
(getter)Vector_getAxis, (setter)Vector_setAxis,
"Vector Z axis",
- (void *)'W'},
+ (void *)3},
{"length",
(getter)Vector_getLength, (setter)Vector_setLength,
"Vector Length",
@@ -1327,6 +1393,10 @@ static PyGetSetDef Vector_getseters[] = {
(getter)Vector_getWrapped, (setter)NULL,
"True when this wraps blenders internal data",
NULL},
+ {"__owner__",
+ (getter)Vector_getOwner, (setter)NULL,
+ "Read only owner for vectors that depend on another object",
+ NULL},
/* autogenerated swizzle attrs, see python script below */
{"xx", (getter)Vector_getSwizzle, (setter)Vector_setSwizzle, Vector_swizzle_doc, (void *)((unsigned int)((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, /* 36 */
@@ -1819,6 +1889,10 @@ PyObject *newVectorObject(float *vec, int size, int type)
if(size > 4 || size < 2)
return NULL;
self->size = size;
+
+ /* init callbacks as NULL */
+ self->cb_user= NULL;
+ self->cb_type= self->cb_subtype= 0;
if(type == Py_WRAP) {
self->vec = vec;
@@ -1843,20 +1917,72 @@ PyObject *newVectorObject(float *vec, int size, int type)
return (PyObject *) self;
}
-/*
- #############################DEPRECATED################################
- #######################################################################
- ----------------------------Vector.negate() --------------------
+PyObject *newVectorObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype)
+{
+ float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */
+ VectorObject *self= newVectorObject(dummy, size, Py_NEW);
+ if(self) {
+ Py_INCREF(cb_user);
+ self->cb_user= cb_user;
+ self->cb_type= (unsigned char)cb_type;
+ self->cb_subtype= (unsigned char)cb_subtype;
+ }
+
+ return self;
+}
+
+//-----------------row_vector_multiplication (internal)-----------
+//ROW VECTOR Multiplication - Vector X Matrix
+//[x][y][z] * [1][2][3]
+// [4][5][6]
+// [7][8][9]
+//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
+static PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat)
+{
+ float vecNew[4], vecCopy[4];
+ double dot = 0.0f;
+ int x, y, z = 0, vec_size = vec->size;
+
+ if(mat->colSize != vec_size){
+ if(mat->rowSize == 4 && vec_size != 3){
+ PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
+ return NULL;
+ }else{
+ vecCopy[3] = 1.0f;
+ }
+ }
+
+ if(!Vector_ReadCallback(vec) || !Matrix_ReadCallback(mat))
+ return NULL;
+
+ for(x = 0; x < vec_size; x++){
+ vecCopy[x] = vec->vec[x];
+ }
+
+ //muliplication
+ for(x = 0; x < mat->colSize; x++) {
+ for(y = 0; y < mat->rowSize; y++) {
+ dot += mat->matrix[y][x] * vecCopy[y];
+ }
+ vecNew[z++] = (float)dot;
+ dot = 0.0f;
+ }
+ return newVectorObject(vecNew, vec_size, Py_NEW);
+}
+
+/*----------------------------Vector.negate() --------------------
set the vector to it's negative -x, -y, -z */
static PyObject *Vector_Negate(VectorObject * self)
{
int i;
- for(i = 0; i < self->size; i++) {
+ if(!Vector_ReadCallback(self))
+ return NULL;
+
+ for(i = 0; i < self->size; i++)
self->vec[i] = -(self->vec[i]);
- }
- /*printf("Vector.negate(): Deprecated: use -vector instead\n");*/
+
+ Vector_WriteCallback(self); // alredy checked for error
+
Py_INCREF(self);
return (PyObject*)self;
}
-/*###################################################################
- ###########################DEPRECATED##############################*/
diff --git a/source/blender/python/generic/vector.h b/source/blender/python/generic/vector.h
index d2eb826ef10..82dbf13b9aa 100644
--- a/source/blender/python/generic/vector.h
+++ b/source/blender/python/generic/vector.h
@@ -1,4 +1,4 @@
-/* $Id: vector.h 20332 2009-05-22 03:22:56Z campbellbarton $
+/* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -39,12 +39,17 @@ extern PyTypeObject vector_Type;
typedef struct {
PyObject_VAR_HEAD
- float *vec; /*1D array of data (alias), wrapped status depends on wrapped status */
- short size; /* vec size 2,3 or 4 */
- short wrapped; /* is wrapped data? */
+ float *vec; /*1D array of data (alias), wrapped status depends on wrapped status */
+ PyObject *cb_user; /* if this vector references another object, otherwise NULL, *Note* this owns its reference */
+ unsigned char size; /* vec size 2,3 or 4 */
+ unsigned char wrapped; /* wrapped data type? */
+ unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */
+ unsigned char cb_subtype; /* subtype: location, rotation... to avoid defining many new functions for every attribute of the same type */
+
} VectorObject;
/*prototypes*/
PyObject *newVectorObject(float *vec, int size, int type);
+PyObject *newVectorObject_cb(PyObject *user, int size, int callback_type, int subtype);
#endif /* EXPP_vector_h */
diff --git a/source/blender/python/intern/Makefile b/source/blender/python/intern/Makefile
index 0c4a540a4bd..d210cfaf973 100644
--- a/source/blender/python/intern/Makefile
+++ b/source/blender/python/intern/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 11904 2007-08-31 16:16:33Z sirdude $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 559ed537757..8b5ad36f349 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -37,6 +37,11 @@
#include "BPY_extern.h"
#include "../generic/bpy_internal_import.h" // our own imports
+/* external util modukes */
+
+#include "../generic/Mathutils.h"
+#include "../generic/Geometry.h"
+#include "../generic/BGL.h"
void BPY_free_compiled_text( struct Text *text )
@@ -61,11 +66,17 @@ static void bpy_init_modules( void )
PyModule_AddObject( mod, "types", BPY_rna_types() );
PyModule_AddObject( mod, "props", BPY_rna_props() );
PyModule_AddObject( mod, "ops", BPY_operator_module() );
- PyModule_AddObject( mod, "ui", BPY_ui_module() ); // XXX very experemental, consider this a test, especially PyCObject is not meant to be perminant
+ PyModule_AddObject( mod, "ui", BPY_ui_module() ); // XXX very experimental, consider this a test, especially PyCObject is not meant to be permanent
/* add the module so we can import it */
PyDict_SetItemString(PySys_GetObject("modules"), "bpy", mod);
Py_DECREF(mod);
+
+
+ /* stand alone utility modules not related to blender directly */
+ Geometry_Init("Geometry");
+ Mathutils_Init("Mathutils");
+ BGL_Init("BGL");
}
#if (PY_VERSION_HEX < 0x02050000)
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 542de6bd9b8..b7e3c86dd91 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -107,15 +107,9 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
/* Assign instance attributes from operator properties */
{
- PropertyRNA *prop, *iterprop;
- CollectionPropertyIterator iter;
const char *arg_name;
- iterprop= RNA_struct_iterator_property(op->ptr->type);
- RNA_property_collection_begin(op->ptr, iterprop, &iter);
-
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- prop= iter.ptr.data;
+ RNA_STRUCT_BEGIN(op->ptr, prop) {
arg_name= RNA_property_identifier(prop);
if (strcmp(arg_name, "rna_type")==0) continue;
@@ -124,8 +118,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
PyObject_SetAttrString(py_class_instance, arg_name, item);
Py_DECREF(item);
}
-
- RNA_property_collection_end(&iter);
+ RNA_STRUCT_END;
}
/* set operator pointer RNA as instance "__operator__" attribute */
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index f28f00e9c02..3cef6e14861 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -39,6 +39,94 @@
#include "BKE_global.h" /* evil G.* */
#include "BKE_report.h"
+#define USE_MATHUTILS
+
+#ifdef USE_MATHUTILS
+#include "../generic/Mathutils.h" /* so we can have mathutils callbacks */
+
+/* bpyrna vector callbacks */
+static int mathutils_rna_vector_cb_index= -1; /* index for our callbacks */
+
+static int mathutils_rna_generic_check(BPy_PropertyRNA *self)
+{
+ return self->prop?1:0;
+}
+
+static int mathutils_rna_vector_get(BPy_PropertyRNA *self, int subtype, float *vec_from)
+{
+ if(self->prop==NULL)
+ return 0;
+
+ RNA_property_float_get_array(&self->ptr, self->prop, vec_from);
+ return 1;
+}
+
+static int mathutils_rna_vector_set(BPy_PropertyRNA *self, int subtype, float *vec_to)
+{
+ if(self->prop==NULL)
+ return 0;
+
+ RNA_property_float_set_array(&self->ptr, self->prop, vec_to);
+ return 1;
+}
+
+static int mathutils_rna_vector_get_index(BPy_PropertyRNA *self, int subtype, float *vec_from, int index)
+{
+ if(self->prop==NULL)
+ return 0;
+
+ vec_from[index]= RNA_property_float_get_index(&self->ptr, self->prop, index);
+ return 1;
+}
+
+static int mathutils_rna_vector_set_index(BPy_PropertyRNA *self, int subtype, float *vec_to, int index)
+{
+ if(self->prop==NULL)
+ return 0;
+
+ RNA_property_float_set_index(&self->ptr, self->prop, index, vec_to[index]);
+ return 1;
+}
+
+Mathutils_Callback mathutils_rna_vector_cb = {
+ mathutils_rna_generic_check,
+ mathutils_rna_vector_get,
+ mathutils_rna_vector_set,
+ mathutils_rna_vector_get_index,
+ mathutils_rna_vector_set_index
+};
+
+/* bpyrna matrix callbacks */
+static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
+
+static int mathutils_rna_matrix_get(BPy_PropertyRNA *self, int subtype, float *mat_from)
+{
+ if(self->prop==NULL)
+ return 0;
+
+ RNA_property_float_get_array(&self->ptr, self->prop, mat_from);
+ return 1;
+}
+
+static int mathutils_rna_matrix_set(BPy_PropertyRNA *self, int subtype, float *mat_to)
+{
+ if(self->prop==NULL)
+ return 0;
+
+ RNA_property_float_set_array(&self->ptr, self->prop, mat_to);
+ return 1;
+}
+
+Mathutils_Callback mathutils_rna_matrix_cb = {
+ mathutils_rna_generic_check,
+ mathutils_rna_matrix_get,
+ mathutils_rna_matrix_set,
+ NULL,
+ NULL
+};
+
+#endif
+
static int pyrna_struct_compare( BPy_StructRNA * a, BPy_StructRNA * b )
{
return (a->ptr.data==b->ptr.data) ? 0 : -1;
@@ -73,14 +161,15 @@ static PyObject *pyrna_prop_richcmp(BPy_PropertyRNA * a, BPy_PropertyRNA * b, in
/*----------------------repr--------------------------------------------*/
static PyObject *pyrna_struct_repr( BPy_StructRNA * self )
{
- PropertyRNA *prop;
- char str[512];
+ PyObject *pyob;
+ char *name;
/* print name if available */
- prop= RNA_struct_name_property(self->ptr.type);
- if(prop) {
- RNA_property_string_get(&self->ptr, prop, str);
- return PyUnicode_FromFormat( "[BPy_StructRNA \"%s\" -> \"%s\"]", RNA_struct_identifier(self->ptr.type), str);
+ name= RNA_struct_name_get_alloc(&self->ptr, NULL, 0);
+ if(name) {
+ pyob= PyUnicode_FromFormat( "[BPy_StructRNA \"%s\" -> \"%s\"]", RNA_struct_identifier(self->ptr.type), name);
+ MEM_freeN(name);
+ return pyob;
}
return PyUnicode_FromFormat( "[BPy_StructRNA \"%s\"]", RNA_struct_identifier(self->ptr.type));
@@ -88,20 +177,19 @@ static PyObject *pyrna_struct_repr( BPy_StructRNA * self )
static PyObject *pyrna_prop_repr( BPy_PropertyRNA * self )
{
- PropertyRNA *prop;
+ PyObject *pyob;
PointerRNA ptr;
- char str[512];
+ char *name;
/* if a pointer, try to print name of pointer target too */
if(RNA_property_type(self->prop) == PROP_POINTER) {
ptr= RNA_property_pointer_get(&self->ptr, self->prop);
+ name= RNA_struct_name_get_alloc(&ptr, NULL, 0);
- if(ptr.data) {
- prop= RNA_struct_name_property(ptr.type);
- if(prop) {
- RNA_property_string_get(&ptr, prop, str);
- return PyUnicode_FromFormat( "[BPy_PropertyRNA \"%s\" -> \"%s\" -> \"%s\" ]", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), str);
- }
+ if(name) {
+ pyob= PyUnicode_FromFormat( "[BPy_PropertyRNA \"%s\" -> \"%s\" -> \"%s\" ]", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop), name);
+ MEM_freeN(name);
+ return pyob;
}
}
@@ -130,9 +218,8 @@ static void pyrna_struct_dealloc( BPy_StructRNA * self )
static char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
{
const EnumPropertyItem *item;
- int totitem;
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(ptr, prop, &item, NULL);
return (char*)BPy_enum_as_string((EnumPropertyItem*)item);
}
@@ -144,7 +231,35 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
if (len > 0) {
/* resolve the array from a new pytype */
- return pyrna_prop_CreatePyObject(ptr, prop);
+ PyObject *ret = pyrna_prop_CreatePyObject(ptr, prop);
+
+#ifdef USE_MATHUTILS
+ /* return a mathutils vector where possible */
+ if(RNA_property_type(prop)==PROP_FLOAT) {
+ if(RNA_property_subtype(prop)==PROP_VECTOR) {
+ if(len>=2 && len <= 4) {
+ PyObject *vec_cb= newVectorObject_cb(ret, len, mathutils_rna_vector_cb_index, 0);
+ Py_DECREF(ret); /* the vector owns now */
+ ret= vec_cb; /* return the vector instead */
+ }
+ }
+ else if(RNA_property_subtype(prop)==PROP_MATRIX) {
+ if(len==16) {
+ PyObject *mat_cb= newMatrixObject_cb(ret, 4,4, mathutils_rna_vector_cb_index, 0);
+ Py_DECREF(ret); /* the matrix owns now */
+ ret= mat_cb; /* return the matrix instead */
+ }
+ else if (len==9) {
+ PyObject *mat_cb= newMatrixObject_cb(ret, 3,3, mathutils_rna_vector_cb_index, 0);
+ Py_DECREF(ret); /* the matrix owns now */
+ ret= mat_cb; /* return the matrix instead */
+ }
+ }
+ }
+
+#endif
+
+ return ret;
}
/* see if we can coorce into a python type - PropertyType */
@@ -213,17 +328,9 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const char *error_prefi
const char *arg_name= NULL;
PyObject *item;
- PropertyRNA *prop, *iterprop;
- CollectionPropertyIterator iter;
-
- iterprop= RNA_struct_iterator_property(ptr->type);
- RNA_property_collection_begin(ptr, iterprop, &iter);
-
totkw = kw ? PyDict_Size(kw):0;
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- prop= iter.ptr.data;
-
+ RNA_STRUCT_BEGIN(ptr, prop) {
arg_name= RNA_property_identifier(prop);
if (strcmp(arg_name, "rna_type")==0) continue;
@@ -249,8 +356,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const char *error_prefi
totkw--;
}
-
- RNA_property_collection_end(&iter);
+ RNA_STRUCT_END;
if (error_val==0 && totkw > 0) { /* some keywords were given that were not used :/ */
PyObject *key, *value;
@@ -294,14 +400,29 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
if (len > 0) {
PyObject *item;
+ int py_len = -1;
int i;
- if (!PySequence_Check(value)) {
+
+#ifdef USE_MATHUTILS
+ if(MatrixObject_Check(value)) {
+ MatrixObject *mat = (MatrixObject*)value;
+ if(!Matrix_ReadCallback(mat))
+ return -1;
+
+ py_len = mat->rowSize * mat->colSize;
+ } else // continue...
+#endif
+ if (PySequence_Check(value)) {
+ py_len= (int)PySequence_Length(value);
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "expected a python sequence type assigned to an RNA array.");
return -1;
}
+ /* done getting the length */
- if ((int)PySequence_Length(value) != len) {
+ if (py_len != len) {
PyErr_SetString(PyExc_AttributeError, "python sequence length did not match the RNA array.");
return -1;
}
@@ -368,14 +489,21 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
else param_arr = MEM_mallocN(sizeof(float) * len, "pyrna float array");
-
- /* collect the variables */
- for (i=0; i<len; i++) {
- item = PySequence_GetItem(value, i);
- param_arr[i] = (float)PyFloat_AsDouble(item); /* deal with any errors later */
- Py_DECREF(item);
+#ifdef USE_MATHUTILS
+ if(MatrixObject_Check(value) && RNA_property_subtype(prop) == PROP_MATRIX) {
+ MatrixObject *mat = (MatrixObject*)value;
+ memcpy(param_arr, mat->contigPtr, sizeof(float) * len);
+ } else // continue...
+#endif
+ {
+ /* collect the variables */
+ for (i=0; i<len; i++) {
+ item = PySequence_GetItem(value, i);
+ param_arr[i] = (float)PyFloat_AsDouble(item); /* deal with any errors later */
+ Py_DECREF(item);
+ }
}
-
+
if (PyErr_Occurred()) {
if(data==NULL)
MEM_freeN(param_arr);
@@ -804,7 +932,6 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
PyObject *pystring;
/* for looping over attrs and funcs */
- CollectionPropertyIterator iter;
PropertyRNA *iterprop;
/* Include this incase this instance is a subtype of a python class
@@ -833,26 +960,23 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
/*
* Collect RNA attributes
*/
- PropertyRNA *nameprop;
char name[256], *nameptr;
iterprop= RNA_struct_iterator_property(self->ptr.type);
- RNA_property_collection_begin(&self->ptr, iterprop, &iter);
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- if(iter.ptr.data && (nameprop = RNA_struct_name_property(iter.ptr.type))) {
- nameptr= RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name));
-
+ RNA_PROP_BEGIN(&self->ptr, itemptr, iterprop) {
+ nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
+
+ if(nameptr) {
pystring = PyUnicode_FromString(nameptr);
PyList_Append(ret, pystring);
Py_DECREF(pystring);
- if ((char *)&name != nameptr)
+ if(name != nameptr)
MEM_freeN(nameptr);
}
}
- RNA_property_collection_end(&iter);
-
+ RNA_PROP_END;
}
@@ -865,15 +989,12 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
RNA_pointer_create(NULL, &RNA_Struct, self->ptr.type, &tptr);
iterprop= RNA_struct_find_property(&tptr, "functions");
- RNA_property_collection_begin(&tptr, iterprop, &iter);
-
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- pystring = PyUnicode_FromString(RNA_function_identifier(iter.ptr.data));
+ RNA_PROP_BEGIN(&tptr, itemptr, iterprop) {
+ pystring = PyUnicode_FromString(RNA_function_identifier(itemptr.data));
PyList_Append(ret, pystring);
Py_DECREF(pystring);
}
-
- RNA_property_collection_end(&iter);
+ RNA_PROP_END;
}
if(self->ptr.type == &RNA_Context) {
@@ -986,28 +1107,25 @@ PyObject *pyrna_prop_keys(BPy_PropertyRNA *self)
ret = NULL;
} else {
PyObject *item;
- CollectionPropertyIterator iter;
- PropertyRNA *nameprop;
char name[256], *nameptr;
ret = PyList_New(0);
- RNA_property_collection_begin(&self->ptr, self->prop, &iter);
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- if(iter.ptr.data && (nameprop = RNA_struct_name_property(iter.ptr.type))) {
- nameptr= RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name));
-
+ RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
+
+ if(nameptr) {
/* add to python list */
item = PyUnicode_FromString( nameptr );
PyList_Append(ret, item);
Py_DECREF(item);
/* done */
- if ((char *)&name != nameptr)
+ if(name != nameptr)
MEM_freeN(nameptr);
}
}
- RNA_property_collection_end(&iter);
+ RNA_PROP_END;
}
return ret;
@@ -1021,28 +1139,25 @@ PyObject *pyrna_prop_items(BPy_PropertyRNA *self)
ret = NULL;
} else {
PyObject *item;
- CollectionPropertyIterator iter;
- PropertyRNA *nameprop;
char name[256], *nameptr;
int i= 0;
ret = PyList_New(0);
- RNA_property_collection_begin(&self->ptr, self->prop, &iter);
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- if(iter.ptr.data) {
+ RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ if(itemptr.data) {
/* add to python list */
item= PyTuple_New(2);
- if(nameprop = RNA_struct_name_property(iter.ptr.type)) {
- nameptr= RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name));
+ nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name));
+ if(nameptr) {
PyTuple_SET_ITEM(item, 0, PyUnicode_FromString( nameptr ));
- if ((char *)&name != nameptr)
+ if(name != nameptr)
MEM_freeN(nameptr);
}
else {
PyTuple_SET_ITEM(item, 0, PyLong_FromSsize_t(i)); /* a bit strange but better then returning an empty list */
}
- PyTuple_SET_ITEM(item, 1, pyrna_struct_CreatePyObject(&iter.ptr));
+ PyTuple_SET_ITEM(item, 1, pyrna_struct_CreatePyObject(&itemptr));
PyList_Append(ret, item);
Py_DECREF(item);
@@ -1050,7 +1165,7 @@ PyObject *pyrna_prop_items(BPy_PropertyRNA *self)
i++;
}
}
- RNA_property_collection_end(&iter);
+ RNA_PROP_END;
}
return ret;
@@ -1066,18 +1181,14 @@ PyObject *pyrna_prop_values(BPy_PropertyRNA *self)
ret = NULL;
} else {
PyObject *item;
- CollectionPropertyIterator iter;
- PropertyRNA *iterprop;
ret = PyList_New(0);
- //iterprop= RNA_struct_iterator_property(self->ptr.type);
- RNA_property_collection_begin(&self->ptr, self->prop, &iter);
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- item = pyrna_struct_CreatePyObject(&iter.ptr);
+ RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ item = pyrna_struct_CreatePyObject(&itemptr);
PyList_Append(ret, item);
Py_DECREF(item);
}
- RNA_property_collection_end(&iter);
+ RNA_PROP_END;
}
return ret;
@@ -1674,6 +1785,11 @@ PyObject *BPY_rna_module( void )
{
PointerRNA ptr;
+#ifdef USE_MATHUTILS // register mathutils callbacks, ok to run more then once.
+ mathutils_rna_vector_cb_index= Mathutils_RegisterCallback(&mathutils_rna_vector_cb);
+ mathutils_rna_matrix_cb_index= Mathutils_RegisterCallback(&mathutils_rna_matrix_cb);
+#endif
+
/* This can't be set in the pytype struct because some compilers complain */
pyrna_prop_Type.tp_getattro = PyObject_GenericGetAttr;
pyrna_prop_Type.tp_setattro = PyObject_GenericSetAttr;
@@ -1883,7 +1999,7 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
char *id, *name="", *description="";
int def=0;
- if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssi:IntProperty", kwlist, &id, &name, &description, &def))
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssi:BoolProperty", kwlist, &id, &name, &description, &def))
return NULL;
if (PyTuple_Size(args) > 0) {
@@ -1897,7 +2013,7 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
Py_RETURN_NONE;
} else {
PyObject *ret = PyTuple_New(2);
- PyTuple_SET_ITEM(ret, 0, PyCObject_FromVoidPtr((void *)BPy_IntProperty, NULL));
+ PyTuple_SET_ITEM(ret, 0, PyCObject_FromVoidPtr((void *)BPy_BoolProperty, NULL));
PyTuple_SET_ITEM(ret, 1, kw);
Py_INCREF(kw);
return ret;
diff --git a/source/blender/windowmanager/intern/Makefile b/source/blender/windowmanager/intern/Makefile
index 80ae58f9398..8f0f47c52d0 100644
--- a/source/blender/windowmanager/intern/Makefile
+++ b/source/blender/windowmanager/intern/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile 11904 2007-08-31 16:16:33Z sirdude $
+# $Id$
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 46e9df10adc..410cd11f1bf 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -145,7 +145,6 @@ char *WM_operator_pystring(wmOperator *op)
const char *arg_name= NULL;
PropertyRNA *prop, *iterprop;
- CollectionPropertyIterator iter;
/* for building the string */
DynStr *dynstr= BLI_dynstr_new();
@@ -155,10 +154,9 @@ char *WM_operator_pystring(wmOperator *op)
BLI_dynstr_appendf(dynstr, "%s(", op->idname);
iterprop= RNA_struct_iterator_property(op->ptr->type);
- RNA_property_collection_begin(op->ptr, iterprop, &iter);
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- prop= iter.ptr.data;
+ RNA_PROP_BEGIN(op->ptr, propptr, iterprop) {
+ prop= propptr.data;
arg_name= RNA_property_identifier(prop);
if (strcmp(arg_name, "rna_type")==0) continue;
@@ -170,8 +168,7 @@ char *WM_operator_pystring(wmOperator *op)
MEM_freeN(buf);
first_iter = 0;
}
-
- RNA_property_collection_end(&iter);
+ RNA_PROP_END;
BLI_dynstr_append(dynstr, ")");
@@ -291,7 +288,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 300, 20, style);
- uiDefAutoButsRNA(C, layout, &ptr);
+ uiDefAutoButsRNA(C, layout, &ptr, 2);
uiPopupBoundsBlock(block, 4.0f, 0, 0);
uiEndBlock(C, block);
@@ -333,7 +330,7 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op)
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 300, 20, style);
- uiDefAutoButsRNA(C, layout, op->ptr);
+ uiDefAutoButsRNA(C, layout, op->ptr, 2);
uiPopupBoundsBlock(block, 4.0f, 0, 0);
uiEndBlock(C, block);
@@ -402,7 +399,7 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u
name[len]= '|';
}
- if(0==uiSearchItemAdd(items, name, ot))
+ if(0==uiSearchItemAdd(items, name, ot, 0))
break;
}
}
@@ -503,7 +500,7 @@ static void WM_OT_read_homefile(wmOperatorType *ot)
static int recentfile_exec(bContext *C, wmOperator *op)
{
- int event= RNA_enum_get(op->ptr, "nr");
+ int event= RNA_int_get(op->ptr, "nr");
// XXX wm in context is not set correctly after WM_read_file -> crash
// do it before for now, but is this correct with multiple windows?
@@ -557,7 +554,7 @@ static void WM_OT_open_recentfile(wmOperatorType *ot)
ot->exec= recentfile_exec;
ot->poll= WM_operator_winactive;
- RNA_def_property(ot->srna, "nr", PROP_ENUM, PROP_NONE);
+ RNA_def_property(ot->srna, "nr", PROP_INT, PROP_UNSIGNED);
}
/* ********* main file *********** */
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 9bd55e1c5a7..835fdca52fe 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -1,5 +1,5 @@
/**
- * $Id: mywindow.c 9584 2007-01-03 13:45:03Z ton $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
index 1a1a0d0b71d..3d1b49983ed 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -1,5 +1,5 @@
/**
- * $Id: BIF_cursors.h 7739 2006-06-15 14:22:59Z broken $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*