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:
authorJoshua Leung <aligorith@gmail.com>2009-07-11 07:23:45 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-11 07:23:45 +0400
commit576a642ff9b5ca5094f5bb84ada3c5639ae01a92 (patch)
tree950a5f5ce861a8fa04fb2727e0e65a464ccbab9c
parent1105ee701ed20d6301a174fc4285de00f8e0f95e (diff)
parentb80b581bc03b6df28bd3a10118d85b78d5ca011b (diff)
NLA SoC: Merge from 2.5 soc-2009-aligorith
21470 to 21512 Next up, NLA-branch to 2.5 :)
-rw-r--r--projectfiles_vc9/blender/editors/ED_editors.vcproj4
-rw-r--r--release/ui/buttons_data_lamp.py2
-rw-r--r--release/ui/buttons_particle.py2
-rw-r--r--release/ui/buttons_scene.py3
-rw-r--r--release/ui/space_sequencer.py2
-rw-r--r--source/blender/blenfont/BLF_api.h7
-rw-r--r--source/blender/blenfont/intern/blf.c9
-rw-r--r--source/blender/blenfont/intern/blf_font.c65
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c12
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h3
-rw-r--r--source/blender/blenkernel/intern/image.c4
-rw-r--r--source/blender/blenlib/BLI_util.h3
-rw-r--r--source/blender/blenlib/intern/util.c16
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/blenloader/intern/writefile.c5
-rw-r--r--source/blender/editors/include/ED_transform.h5
-rw-r--r--source/blender/editors/interface/interface.c35
-rw-r--r--source/blender/editors/interface/interface_handlers.c2
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_layout.c85
-rw-r--r--source/blender/editors/interface/interface_regions.c45
-rw-r--r--source/blender/editors/interface/interface_style.c22
-rw-r--r--source/blender/editors/interface/interface_templates.c30
-rw-r--r--source/blender/editors/interface/view2d.c9
-rw-r--r--source/blender/editors/interface/view2d_ops.c11
-rw-r--r--source/blender/editors/mesh/editmesh.c8
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c27
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c47
-rw-r--r--source/blender/editors/mesh/mesh_ops.c3
-rw-r--r--source/blender/editors/object/editgroup.c2
-rw-r--r--source/blender/editors/object/object_edit.c101
-rw-r--r--source/blender/editors/object/object_intern.h2
-rw-r--r--source/blender/editors/object/object_ops.c10
-rw-r--r--source/blender/editors/screen/screen_ops.c158
-rw-r--r--source/blender/editors/space_file/file_draw.c146
-rw-r--r--source/blender/editors/space_file/file_header.c187
-rw-r--r--source/blender/editors/space_file/file_intern.h14
-rw-r--r--source/blender/editors/space_file/file_ops.c154
-rw-r--r--source/blender/editors/space_file/filesel.c56
-rw-r--r--source/blender/editors/space_file/space_file.c4
-rw-r--r--source/blender/editors/space_image/image_draw.c13
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c15
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c8
-rw-r--r--source/blender/editors/space_text/text_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c323
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c21
-rw-r--r--source/blender/editors/transform/transform_ops.c18
-rw-r--r--source/blender/editors/transform/transform_orientations.c38
-rw-r--r--source/blender/makesdna/DNA_image_types.h7
-rw-r--r--source/blender/makesdna/DNA_scene_types.h13
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h9
-rw-r--r--source/blender/makesrna/RNA_access.h17
-rw-r--r--source/blender/makesrna/RNA_define.h7
-rw-r--r--source/blender/makesrna/RNA_types.h2
-rw-r--r--source/blender/makesrna/intern/makesrna.c20
-rw-r--r--source/blender/makesrna/intern/rna_access.c68
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c47
-rw-r--r--source/blender/makesrna/intern/rna_define.c40
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_particle.c123
-rw-r--r--source/blender/makesrna/intern/rna_rna.c9
-rw-r--r--source/blender/makesrna/intern/rna_scene.c13
-rw-r--r--source/blender/makesrna/intern/rna_space.c23
-rw-r--r--source/blender/makesrna/intern/rna_ui.c2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c21
-rw-r--r--source/blender/python/generic/Mathutils.h7
-rw-r--r--source/blender/python/intern/bpy_rna.c131
-rw-r--r--source/blender/python/intern/bpy_util.c3
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c3
-rw-r--r--source/blender/windowmanager/intern/wm_files.c4
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
72 files changed, 1274 insertions, 1046 deletions
diff --git a/projectfiles_vc9/blender/editors/ED_editors.vcproj b/projectfiles_vc9/blender/editors/ED_editors.vcproj
index da998311b7b..92b6f627a15 100644
--- a/projectfiles_vc9/blender/editors/ED_editors.vcproj
+++ b/projectfiles_vc9/blender/editors/ED_editors.vcproj
@@ -747,10 +747,6 @@
>
</File>
<File
- RelativePath="..\..\..\source\blender\editors\space_file\file_header.c"
- >
- </File>
- <File
RelativePath="..\..\..\source\blender\editors\space_file\file_intern.h"
>
</File>
diff --git a/release/ui/buttons_data_lamp.py b/release/ui/buttons_data_lamp.py
index e56f19b1dec..cf0ede8ec3b 100644
--- a/release/ui/buttons_data_lamp.py
+++ b/release/ui/buttons_data_lamp.py
@@ -48,7 +48,7 @@ class DATA_PT_lamp(DataButtonsPanel):
lamp = context.lamp
- layout.itemR(lamp, "type", expand=True)
+ layout.itemR(lamp, "type")
split = layout.split()
diff --git a/release/ui/buttons_particle.py b/release/ui/buttons_particle.py
index 652f46d9675..ef7ede15d6e 100644
--- a/release/ui/buttons_particle.py
+++ b/release/ui/buttons_particle.py
@@ -20,7 +20,7 @@ class ParticleButtonsPanel(bpy.types.Panel):
class PARTICLE_PT_particles(ParticleButtonsPanel):
__idname__= "PARTICLE_PT_particles"
- __label__ = " "
+ __no_header__ = True
def poll(self, context):
return (context.particle_system or context.object)
diff --git a/release/ui/buttons_scene.py b/release/ui/buttons_scene.py
index 7e1f05d774e..a774b887df5 100644
--- a/release/ui/buttons_scene.py
+++ b/release/ui/buttons_scene.py
@@ -35,6 +35,8 @@ class RENDER_PT_output(RenderButtonsPanel):
layout = self.layout
rd = context.scene.render_data
+ layout.itemR(rd, "display_mode", text="Display")
+
layout.itemR(rd, "output_path")
split = layout.split()
@@ -54,7 +56,6 @@ class RENDER_PT_output(RenderButtonsPanel):
col.itemR(rd, "placeholders")
col.itemR(rd, "no_overwrite")
-
layout.itemR(rd, "file_format", text="Format")
split = layout.split()
diff --git a/release/ui/space_sequencer.py b/release/ui/space_sequencer.py
index ae668926582..702c2ff20f2 100644
--- a/release/ui/space_sequencer.py
+++ b/release/ui/space_sequencer.py
@@ -242,7 +242,7 @@ class SEQUENCER_MT_strip(bpy.types.Menu):
layout.itemO("SEQUENCER_OT_mute")
layout.itemO("SEQUENCER_OT_unmute")
- layout.item_enumO("SEQUENCER_OT_mute", property="type", value='UNSELECTED', text="Mute Deselected Strips")
+ layout.item_booleanO("SEQUENCER_OT_mute", "unselected", 1, text="Mute Deselected Strips")
layout.itemO("SEQUENCER_OT_snap")
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index c373fde5693..99934a80143 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -90,7 +90,6 @@ void BLF_default_rotation(float angle);
void BLF_rotation(float angle);
void BLF_clipping(float xmin, float ymin, float xmax, float ymax);
void BLF_blur(int size);
-void BLF_kerning(float space);
void BLF_enable(int option);
void BLF_disable(int option);
@@ -137,10 +136,8 @@ void BLF_dir_free(char **dirs, int count);
/* font->flags. */
#define BLF_ROTATION (1<<0)
#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)
+#define BLF_SHADOW (1<<2)
+#define BLF_KERNING_DEFAULT (1<<3)
/* font->mode. */
#define BLF_MODE_TEXTURE 0
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index a7e599fabf9..9a249c2f241 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -505,15 +505,6 @@ void BLF_mode(int mode)
font->mode= mode;
}
-void BLF_kerning(float space)
-{
- FontBLF *font;
-
- font= global_font[global_font_cur];
- if (font)
- font->kerning= space;
-}
-
void BLF_shadow(int level, float r, float g, float b, float a)
{
FontBLF *font;
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index a3c5232cc76..affc35ea11e 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -101,8 +101,8 @@ void blf_font_draw(FontBLF *font, char *str)
GlyphBLF *g, *g_prev;
FT_Vector delta;
FT_UInt glyph_index, g_prev_index;
- float pen_x, pen_y, old_pen_x;
- int i, has_kerning;
+ int pen_x, pen_y;
+ int i, has_kerning, st;
if (!font->glyph_cache)
return;
@@ -139,33 +139,21 @@ void blf_font_draw(FontBLF *font, char *str)
else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data))
g= blf_glyph_add(font, glyph_index, c);
- if ((font->flags & BLF_FONT_KERNING) && has_kerning && g_prev) {
- old_pen_x= pen_x;
+ if (has_kerning && g_prev) {
delta.x= 0;
delta.y= 0;
- if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) {
- pen_x += delta.x >> 6;
-
- if (font->flags & BLF_OVERLAP_CHAR) {
- if (pen_x < old_pen_x)
- pen_x= old_pen_x;
- }
- }
- }
+ if (font->flags & BLF_KERNING_DEFAULT)
+ st= FT_Get_Kerning(font->face, g_prev_index, glyph_index, ft_kerning_default, &delta);
+ else
+ st= FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta);
- if (font->flags & BLF_USER_KERNING) {
- old_pen_x= pen_x;
- pen_x += font->kerning;
-
- if (font->flags & BLF_OVERLAP_CHAR) {
- if (pen_x < old_pen_x)
- pen_x= old_pen_x;
- }
+ if (st == 0)
+ pen_x += delta.x >> 6;
}
/* do not return this loop if clipped, we want every character tested */
- blf_glyph_render(font, g, pen_x, pen_y);
+ blf_glyph_render(font, g, (float)pen_x, (float)pen_y);
pen_x += g->advance;
g_prev= g;
@@ -180,8 +168,8 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
FT_Vector delta;
FT_UInt glyph_index, g_prev_index;
rctf gbox;
- float pen_x, pen_y, old_pen_x;
- int i, has_kerning;
+ int pen_x, pen_y;
+ int i, has_kerning, st;
if (!font->glyph_cache)
return;
@@ -223,29 +211,17 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data))
g= blf_glyph_add(font, glyph_index, c);
- if ((font->flags & BLF_FONT_KERNING) && has_kerning && g_prev) {
- old_pen_x= pen_x;
+ if (has_kerning && g_prev) {
delta.x= 0;
delta.y= 0;
- if (FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta) == 0) {
- pen_x += delta.x >> 6;
-
- if (font->flags & BLF_OVERLAP_CHAR) {
- if (pen_x < old_pen_x)
- pen_x= old_pen_x;
- }
- }
- }
+ if (font->flags & BLF_KERNING_DEFAULT)
+ st= FT_Get_Kerning(font->face, g_prev_index, glyph_index, ft_kerning_default, &delta);
+ else
+ st= FT_Get_Kerning(font->face, g_prev_index, glyph_index, FT_KERNING_UNFITTED, &delta);
- if (font->flags & BLF_USER_KERNING) {
- old_pen_x= pen_x;
- pen_x += font->kerning;
-
- if (font->flags & BLF_OVERLAP_CHAR) {
- if (pen_x < old_pen_x)
- pen_x= old_pen_x;
- }
+ if (st == 0)
+ pen_x += delta.x >> 6;
}
gbox.xmin= g->box.xmin + pen_x;
@@ -329,10 +305,9 @@ void blf_font_fill(FontBLF *font)
font->clip_rec.xmax= 0.0f;
font->clip_rec.ymin= 0.0f;
font->clip_rec.ymax= 0.0f;
- font->flags= BLF_USER_KERNING | BLF_FONT_KERNING;
+ font->flags= 0;
font->dpi= 0;
font->size= 0;
- font->kerning= 0.0f;
font->cache.first= NULL;
font->cache.last= NULL;
font->glyph_cache= NULL;
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index a637774d7bf..d2767d6ffb1 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -213,11 +213,7 @@ GlyphBLF *blf_glyph_texture_add(FontBLF *font, FT_UInt index, unsigned int c)
else
do_new= 1;
- if (font->flags & BLF_FONT_KERNING)
- err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_BITMAP);
- else
- err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
-
+ err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
if (err)
return(NULL);
@@ -332,11 +328,7 @@ GlyphBLF *blf_glyph_bitmap_add(FontBLF *font, FT_UInt index, unsigned int c)
else
do_new= 1;
- if (font->flags & BLF_FONT_KERNING)
- err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_BITMAP);
- else
- err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
-
+ err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
if (err)
return(NULL);
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 5382ac19aae..64d95986867 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -177,9 +177,6 @@ typedef struct FontBLF {
/* font size. */
int size;
- /* kerning space, user setting. */
- float kerning;
-
/* max texture size. */
int max_tex_size;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index ef0984bf93d..754ec06f23f 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -253,6 +253,10 @@ void free_image(Image *ima)
if (ima->preview) {
BKE_previewimg_free(&ima->preview);
}
+ if (ima->render_text) {
+ MEM_freeN(ima->render_text);
+ ima->render_text= NULL;
+ }
}
/* only image block itself */
diff --git a/source/blender/blenlib/BLI_util.h b/source/blender/blenlib/BLI_util.h
index a138ea780ea..d323f701ba5 100644
--- a/source/blender/blenlib/BLI_util.h
+++ b/source/blender/blenlib/BLI_util.h
@@ -72,6 +72,9 @@ void BLI_cleanup_dir(const char *relabase, char *dir); /* same as above but adds
/* go back one directory */
int BLI_parent_dir(char *path);
+/* return whether directory is root and thus has no parent dir */
+int BLI_has_parent(char *path);
+
/**
* Blender's path code replacement function.
* Bases @a path strings leading with "//" by the
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index 838648ebfd7..a236defc515 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -494,6 +494,22 @@ void BLI_makestringcode(const char *relfile, char *file)
}
}
+int BLI_has_parent(char *path)
+{
+ int len;
+ int slashes = 0;
+ BLI_clean(path);
+ BLI_add_slash(path);
+
+ len = strlen(path)-1;
+ while (len) {
+ if ((path[len] == '\\') || (path[len] == '/'))
+ slashes++;
+ len--;
+ }
+ return slashes > 1;
+}
+
int BLI_parent_dir(char *path)
{
#ifdef WIN32
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c475ed5a949..846e54526b8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2720,6 +2720,7 @@ static void direct_link_image(FileData *fd, Image *ima)
ima->anim= NULL;
ima->rr= NULL;
ima->repbind= NULL;
+ ima->render_text= newdataadr(fd, ima->render_text);
ima->packedfile = direct_link_packedfile(fd, ima->packedfile);
ima->preview = direct_link_preview_image(fd, ima->preview);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index bfdd89e38b1..4b52da83019 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1480,7 +1480,10 @@ static void write_images(WriteData *wd, ListBase *idbase)
write_previews(wd, ima->preview);
- }
+ /* exception: render text only saved in undo files (wd->current) */
+ if (ima->render_text && wd->current)
+ writedata(wd, DATA, IMA_RW_MAXTEXT, ima->render_text);
+ }
ima= ima->id.next;
}
/* flush helps the compression for undo-save */
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index adcf2cfc024..d2185854a95 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -1,5 +1,5 @@
/**
- * $Id$
+ * $Id: ED_transform.h 21450 2009-07-09 02:45:48Z theeth $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -38,6 +38,7 @@ struct wmEvent;
struct bContext;
struct Object;
struct uiLayout;
+struct EnumPropertyItem;
void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *keymap, int spaceid);
void transform_operatortypes(void);
@@ -114,7 +115,7 @@ int BIF_menuselectTransformOrientation(void);
void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
void BIF_selectTransformOrientationValue(struct bContext *C, int orientation);
-void BIF_menuTransformOrientation(struct bContext *C, struct uiLayout *layout, void *arg);
+struct EnumPropertyItem *BIF_enumTransformOrientation(struct bContext *C);
char * BIF_menustringTransformOrientation(const struct bContext *C, char *title); /* the returned value was allocated and needs to be freed after use */
int BIF_countTransformOrientation(const struct bContext *C);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index a76fdcbf39d..6f86e3e809a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1615,6 +1615,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
block= MEM_callocN(sizeof(uiBlock), "uiBlock");
block->active= 1;
block->dt= dt;
+ block->evil_C= (void*)C; // XXX
BLI_strncpy(block->name, name, sizeof(block->name));
if(region)
@@ -2113,17 +2114,19 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
/* use rna values if parameters are not specified */
if(!str) {
if(type == MENU && proptype == PROP_ENUM) {
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
DynStr *dynstr;
- int i, totitem, value;
+ int i, totitem, value, free;
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
value= RNA_property_enum_get(ptr, prop);
dynstr= BLI_dynstr_new();
BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop));
for(i=0; i<totitem; i++) {
- if(item[i].icon)
+ if(!item[i].identifier[0])
+ BLI_dynstr_append(dynstr, "|%l");
+ else if(item[i].icon)
BLI_dynstr_appendf(dynstr, "|%s %%i%d %%x%d", item[i].name, item[i].icon, item[i].value);
else
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
@@ -2134,15 +2137,18 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
str= BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);
+ if(free)
+ MEM_freeN(item);
+
freestr= 1;
}
else if(type == ROW && proptype == PROP_ENUM) {
- const EnumPropertyItem *item;
- int i, totitem;
+ EnumPropertyItem *item;
+ int i, totitem, free;
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
- if(item[i].value == (int)max) {
+ if(item[i].identifier[0] && item[i].value == (int)max) {
str= (char*)item[i].name;
icon= item[i].icon;
}
@@ -2150,6 +2156,8 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
if(!str)
str= (char*)RNA_property_ui_name(prop);
+ if(free)
+ MEM_freeN(item);
}
else {
str= (char*)RNA_property_ui_name(prop);
@@ -2159,18 +2167,21 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
if(!tip) {
if(type == ROW && proptype == PROP_ENUM) {
- const EnumPropertyItem *item;
- int i, totitem;
+ EnumPropertyItem *item;
+ int i, totitem, free;
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
- if(item[i].value == (int)max) {
+ if(item[i].identifier[0] && item[i].value == (int)max) {
if(item[i].description[0])
tip= (char*)item[i].description;
break;
}
}
+
+ if(free)
+ MEM_freeN(item);
}
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ee86b612332..e0ce6a7a83f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3434,7 +3434,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
data= MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData");
data->window= CTX_wm_window(C);
data->region= ar;
- if( ELEM(but->type, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp
+ if( ELEM3(but->type, BUT_CURVE, SEARCH_MENU, TEX) ); // XXX curve is temp
else data->interactive= 1;
data->state = BUTTON_STATE_INIT;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 1b16155c7e6..8c254419ec3 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -290,6 +290,8 @@ struct uiBlock {
int tooltipdisabled; // to avoid tooltip after click
int active; // to keep blocks while drawing and free them afterwards
+
+ void *evil_C; // XXX hack for dynamic operator enums
};
typedef struct uiSafetyRct {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 0bf64f75552..77af58bacc1 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -429,16 +429,19 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon
static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h)
{
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
const char *identifier;
char *name;
- int a, totitem, itemw, icon, value;
+ int a, totitem, itemw, icon, value, free;
identifier= RNA_property_identifier(prop);
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
for(a=0; a<totitem; a++) {
+ if(!item[a].identifier[0])
+ continue;
+
name= (!uiname || uiname[0])? (char*)item[a].name: "";
icon= item[a].icon;
value= item[a].value;
@@ -452,6 +455,9 @@ static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr,
uiDefButR(block, ROW, 0, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
}
uiBlockSetCurLayout(block, layout);
+
+ if(free)
+ MEM_freeN(item);
}
/* create label + button for RNA property */
@@ -542,7 +548,7 @@ void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, IDPropert
}
}
-static char *ui_menu_enumpropname(char *opname, char *propname, int retval)
+static char *ui_menu_enumpropname(uiLayout *layout, char *opname, char *propname, int retval)
{
wmOperatorType *ot= WM_operatortype_find(opname);
PointerRNA ptr;
@@ -555,15 +561,18 @@ static char *ui_menu_enumpropname(char *opname, char *propname, int retval)
prop= RNA_struct_find_property(&ptr, propname);
if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(&ptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- if(item[i].value==retval)
- return (char*)item[i].name;
+ EnumPropertyItem *item;
+ int totitem, free;
+ const char *name;
+
+ RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, &totitem, &free);
+ if(RNA_enum_name(item, retval, &name)) {
+ if(free) MEM_freeN(item);
+ return (char*)name;
}
+
+ if(free)
+ MEM_freeN(item);
}
return "";
@@ -577,7 +586,7 @@ void uiItemEnumO(uiLayout *layout, char *name, int icon, char *opname, char *pro
RNA_enum_set(&ptr, propname, value);
if(!name)
- name= ui_menu_enumpropname(opname, propname, value);
+ name= ui_menu_enumpropname(layout, opname, propname, value);
uiItemFullO(layout, name, icon, opname, ptr.data, layout->root->opcontext);
}
@@ -597,13 +606,19 @@ void uiItemsEnumO(uiLayout *layout, char *opname, char *propname)
prop= RNA_struct_find_property(&ptr, propname);
if(prop && RNA_property_type(prop) == PROP_ENUM) {
- const EnumPropertyItem *item;
- int totitem, i;
+ EnumPropertyItem *item;
+ int totitem, i, free;
- RNA_property_enum_items(&ptr, prop, &item, &totitem);
+ RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++)
- uiItemEnumO(layout, (char*)item[i].name, item[i].icon, opname, propname, item[i].value);
+ if(item[i].identifier[0])
+ uiItemEnumO(layout, (char*)item[i].name, item[i].icon, opname, propname, item[i].value);
+ else
+ uiItemS(layout);
+
+ if(free)
+ MEM_freeN(item);
}
}
@@ -614,18 +629,22 @@ void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, ch
/* for getting the enum */
PropertyRNA *prop;
- const EnumPropertyItem *item;
- int value;
+ EnumPropertyItem *item;
+ int value, free;
WM_operator_properties_create(&ptr, opname);
/* enum lookup */
if((prop= RNA_struct_find_property(&ptr, propname))) {
- RNA_property_enum_items(&ptr, prop, &item, NULL);
+ RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
if(RNA_enum_value_from_id(item, value_str, &value)==0) {
+ if(free) MEM_freeN(item);
printf("uiItemEnumO_string: %s.%s, enum %s not found.\n", RNA_struct_identifier(ptr.type), propname, value_str);
return;
}
+
+ if(free)
+ MEM_freeN(item);
}
else {
printf("uiItemEnumO_string: %s.%s not found.\n", RNA_struct_identifier(ptr.type), propname);
@@ -636,7 +655,7 @@ void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, ch
/* same as uiItemEnumO */
if(!name)
- name= ui_menu_enumpropname(opname, propname, value);
+ name= ui_menu_enumpropname(layout, opname, propname, value);
uiItemFullO(layout, name, icon, opname, ptr.data, layout->root->opcontext);
}
@@ -841,8 +860,8 @@ void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr,
void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, char *value)
{
PropertyRNA *prop;
- const EnumPropertyItem *item;
- int ivalue, a;
+ EnumPropertyItem *item;
+ int ivalue, a, free;
if(!ptr->data || !propname)
return;
@@ -855,9 +874,10 @@ void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRN
return;
}
- RNA_property_enum_items(ptr, prop, &item, NULL);
+ RNA_property_enum_items(layout->root->block->evil_C, ptr, prop, &item, NULL, &free);
if(!RNA_enum_value_from_id(item, value, &ivalue)) {
+ if(free) MEM_freeN(item);
ui_item_disabled(layout, propname);
printf("uiItemEnumR: enum property value not found: %s\n", value);
return;
@@ -869,6 +889,9 @@ void uiItemEnumR_string(uiLayout *layout, char *name, int icon, struct PointerRN
break;
}
}
+
+ if(free)
+ MEM_freeN(item);
}
void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname)
@@ -883,13 +906,19 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname)
}
if(RNA_property_type(prop) == PROP_ENUM) {
- const EnumPropertyItem *item;
- int totitem, i;
+ EnumPropertyItem *item;
+ int totitem, i, free;
- RNA_property_enum_items(ptr, prop, &item, &totitem);
+ RNA_property_enum_items(layout->root->block->evil_C, ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++)
- uiItemEnumR(layout, (char*)item[i].name, 0, ptr, propname, item[i].value);
+ if(item[i].identifier[0])
+ uiItemEnumR(layout, (char*)item[i].name, 0, ptr, propname, item[i].value);
+ else
+ uiItemS(layout);
+
+ if(free)
+ MEM_freeN(item);
}
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 27fb0731d67..e0c6fbd7134 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1460,11 +1460,10 @@ static void update_picker_hex(uiBlock *block, float *rgb)
// this updates button strings, is hackish... but button pointers are on stack of caller function
for(bt= block->buttons.first; bt; bt= bt->next) {
- if(strcmp(bt->str, "Hex: ")==0) {
+ if(strcmp(bt->str, "Hex: ")==0)
strcpy(bt->poin, col);
- ui_check_but(bt);
- break;
- }
+
+ ui_check_but(bt);
}
}
@@ -1506,6 +1505,8 @@ void ui_update_block_buts_hsv(uiBlock *block, float *hsv)
ui_set_but_val(bt, hsv[2]);
}
}
+
+ ui_check_but(bt);
}
}
@@ -1547,6 +1548,8 @@ static void ui_update_block_buts_hex(uiBlock *block, char *hexcol)
ui_set_but_val(bt, v);
}
}
+
+ ui_check_but(bt);
}
}
@@ -2438,40 +2441,6 @@ typedef struct uiMenuInfo {
/************************ Menu Definitions to uiBlocks ***********************/
-const char *ui_menu_enumpropname(char *opname, const char *propname, int retval)
-{
- wmOperatorType *ot= WM_operatortype_find(opname);
- PointerRNA ptr;
- PropertyRNA *prop;
-
- if(!ot || !ot->srna)
- return "";
-
- RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
- prop= RNA_struct_find_property(&ptr, propname);
-
- if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(&ptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- if(item[i].value==retval)
- return item[i].name;
- }
- }
-
- return "";
-}
-
-typedef struct MenuItemLevel {
- int opcontext;
- char *opname;
- char *propname;
- PointerRNA rnapoin;
-} MenuItemLevel;
-
static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle, void *arg_info)
{
uiBlock *block;
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index e8fba38f793..57f35f71927 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -89,10 +89,11 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
BLI_addtail(styles, style);
BLI_strncpy(style->name, name, MAX_STYLE_NAME);
+ style->panelzoom= 1.0;
+
style->paneltitle.uifont_id= UIFONT_DEFAULT;
style->paneltitle.points= 13;
- style->paneltitle.kerning= 0.0;
- style->paneltitle.overlap= 0;
+ style->paneltitle.kerning= 0;
style->paneltitle.shadow= 5;
style->paneltitle.shadx= 2;
style->paneltitle.shady= -2;
@@ -101,8 +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.kerning= 0;
style->grouplabel.shadow= 3;
style->grouplabel.shadx= 1;
style->grouplabel.shady= -1;
@@ -110,8 +110,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.kerning= 0;
style->widgetlabel.shadow= 3;
style->widgetlabel.shadx= 1;
style->widgetlabel.shady= -1;
@@ -120,7 +119,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
style->widget.uifont_id= UIFONT_DEFAULT;
style->widget.points= 11;
- style->widget.kerning= 0.0;
+ style->widget.kerning= 0;
style->widget.shadowalpha= 0.25f;
style->columnspace= 5;
@@ -174,15 +173,15 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
BLF_shadow_offset(fs->shadx, fs->shady);
}
- if (fs->overlap)
- BLF_enable(BLF_OVERLAP_CHAR);
+ if (fs->kerning == 1)
+ BLF_enable(BLF_KERNING_DEFAULT);
BLF_draw(str);
BLF_disable(BLF_CLIPPING);
if (fs->shadow)
BLF_disable(BLF_SHADOW);
- if (fs->overlap)
- BLF_disable(BLF_OVERLAP_CHAR);
+ if (fs->kerning == 1)
+ BLF_disable(BLF_KERNING_DEFAULT);
}
/* ************** helpers ************************ */
@@ -263,6 +262,5 @@ void uiStyleFontSet(uiFontStyle *fs)
BLF_set(font->blf_id);
BLF_size(fs->points, U.dpi);
- BLF_kerning(fs->kerning);
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 5fd84ad3c9f..91fbd24f8a6 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -757,7 +757,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
box= uiLayoutBox(col);
row= uiLayoutRow(box, 0);
- block= uiLayoutFreeBlock(box);
+ block= uiLayoutGetBlock(box);
subrow= uiLayoutRow(row, 0);
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
@@ -772,27 +772,19 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiDefIconButBitS(block, ICONTOG, CONSTRAINT_EXPAND, B_CONSTRAINT_TEST, ICON_TRIA_RIGHT, xco-10, yco, 20, 20, &con->flag, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Constraint");
/* name */
- if ((con->flag & CONSTRAINT_EXPAND) && (proxy_protected==0)) {
- /* XXX if (con->flag & CONSTRAINT_DISABLE)
- uiBlockSetCol(block, TH_REDALERT);*/
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
+ uiBlockSetEmboss(block, UI_EMBOSS);
+
+ /* XXX if (con->flag & CONSTRAINT_DISABLE)
+ uiBlockSetCol(block, TH_REDALERT);*/
+
+ uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
+
+ if(proxy_protected == 0) {
but = uiDefBut(block, TEX, B_CONSTRAINT_TEST, "", xco+120, yco, 85, 18, con->name, 0.0, 29.0, 0.0, 0.0, "Constraint name");
uiButSetFunc(but, verify_constraint_name_func, con, NULL);
- }
- else {
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- /* XXX if (con->flag & CONSTRAINT_DISABLE)
- uiBlockSetCol(block, TH_REDALERT);*/
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, xco+120, yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, "");
}
+ else
+ uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, xco+120, yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, "");
// XXX uiBlockSetCol(block, TH_AUTO);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 6ed5d6609c4..c3a0b2a2cdd 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -155,7 +155,8 @@ static void view2d_masks(View2D *v2d)
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
{
short tot_changed= 0;
-
+ uiStyle *style= U.uistyles.first;
+
/* initialise data if there is a need for such */
if ((v2d->flag & V2D_IS_INITIALISED) == 0) {
/* set initialised flag so that View2D doesn't get reinitialised next time again */
@@ -267,7 +268,11 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->tot.ymax= 0.0f;
v2d->tot.ymin= -winy;
- v2d->cur= v2d->tot;
+ v2d->cur.xmin= 0.0f;
+ v2d->cur.xmax= winx*style->panelzoom;
+
+ v2d->cur.ymax= 0.0f;
+ v2d->cur.ymin= -winy*style->panelzoom;
}
break;
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 101d89da618..54ab0d9ef61 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -1273,6 +1273,7 @@ void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
static int reset_exec(bContext *C, wmOperator *op)
{
+ uiStyle *style= U.uistyles.first;
ARegion *ar= CTX_wm_region(C);
View2D *v2d= &ar->v2d;
int winx, winy;
@@ -1283,26 +1284,26 @@ static int reset_exec(bContext *C, wmOperator *op)
v2d->cur.xmax= v2d->cur.xmin + winx;
v2d->cur.ymax= v2d->cur.ymin + winy;
-
+
/* align */
if(v2d->align) {
/* posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
v2d->cur.xmax= 0.0f;
- v2d->cur.xmin= v2d->winx;
+ v2d->cur.xmin= v2d->winx*style->panelzoom;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
- v2d->cur.xmax= v2d->cur.xmax - v2d->cur.xmin;
+ v2d->cur.xmax= (v2d->cur.xmax - v2d->cur.xmin)*style->panelzoom;
v2d->cur.xmin= 0.0f;
}
/* - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
v2d->cur.ymax= 0.0f;
- v2d->cur.ymin= -v2d->winy;
+ v2d->cur.ymin= -v2d->winy*style->panelzoom;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
- v2d->cur.ymax= v2d->cur.ymax - v2d->cur.ymin;
+ v2d->cur.ymax= (v2d->cur.ymax - v2d->cur.ymin)*style->panelzoom;
v2d->cur.ymin= 0.0f;
}
}
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index a680fb5d07a..cdd51a72f4f 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -1606,13 +1606,13 @@ static int mesh_separate_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Base *base= CTX_data_active_base(C);
- int retval= 0;
+ int retval= 0, type= RNA_enum_get(op->ptr, "type");
- if(RNA_enum_is_equal(op->ptr, "type", "SELECTED"))
+ if(type == 0)
retval= mesh_separate_selected(scene, base);
- else if(RNA_enum_is_equal(op->ptr, "type", "MATERIAL"))
+ else if(type == 1)
retval= mesh_separate_material (scene, base);
- else if(RNA_enum_is_equal(op->ptr, "type", "LOOSE"))
+ else if(type == 2)
retval= mesh_separate_loose(scene, base);
if(retval) {
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index ca0f73ece68..2995e2d895b 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -1227,12 +1227,29 @@ static int select_similar_exec(bContext *C, wmOperator *op)
return similar_face_select_exec(C, op);
}
-static EnumPropertyItem *select_similar_type_itemf(PointerRNA *ptr)
+static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr, int *free)
{
- /* XXX need context! */
- return prop_simface_types;
- return prop_simvertex_types;
- return prop_simedge_types;
+ Object *obedit= CTX_data_edit_object(C);
+
+ if(obedit && obedit->type == OB_MESH) {
+ EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
+ EnumPropertyItem *item= NULL;
+ int totitem= 0;
+
+ if(em->selectmode & SCE_SELECT_VERTEX)
+ RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
+ else if(em->selectmode & SCE_SELECT_EDGE)
+ RNA_enum_items_add(&item, &totitem, prop_simedge_types);
+ else if(em->selectmode & SCE_SELECT_FACE)
+ RNA_enum_items_add(&item, &totitem, prop_simface_types);
+ RNA_enum_item_end(&item, &totitem);
+
+ *free= 1;
+
+ return item;
+ }
+
+ return NULL;
}
void MESH_OT_select_similar(wmOperatorType *ot)
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 4377f459081..682b1ee4a64 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -5799,29 +5799,38 @@ static EnumPropertyItem merge_type_items[]= {
{5, "COLLAPSE", 0, "Collapse", ""},
{0, NULL, 0, NULL, NULL}};
-static EnumPropertyItem *merge_type_itemf(PointerRNA *ptr)
+static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *free)
{
- /* XXX need context here */
-#if 0
- Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
- EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
- if(em->selectmode & SCE_SELECT_VERTEX)
- if(em->selected.first && em->selected.last &&
- ((EditSelection*)em->selected.first)->type == EDITVERT && ((EditSelection*)em->selected.last)->type == EDITVERT)
- event = pupmenu("Merge %t|At First %x6|At Last%x1|At Center%x3|At Cursor%x4|Collapse%x2");
- else if (em->selected.first && ((EditSelection*)em->selected.first)->type == EDITVERT)
- event = pupmenu("Merge %t|At First %x6|At Center%x3|At Cursor%x4|Collapse%x2");
- else if (em->selected.last && ((EditSelection*)em->selected.last)->type == EDITVERT)
- event = pupmenu("Merge %t|At Last %x1|At Center%x3|At Cursor%x4|Collapse%x2");
- else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2");
- else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2");
+ if(obedit && obedit->type == OB_MESH) {
+ EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
+ EnumPropertyItem *item= NULL;
+ int totitem= 0;
- BKE_mesh_end_editmesh(obedit->data, em);
-#endif
+ if(em->selectmode & SCE_SELECT_VERTEX) {
+ if(em->selected.first && em->selected.last &&
+ ((EditSelection*)em->selected.first)->type == EDITVERT && ((EditSelection*)em->selected.last)->type == EDITVERT) {
+ RNA_enum_item_add(&item, &totitem, &merge_type_items[0]);
+ RNA_enum_item_add(&item, &totitem, &merge_type_items[1]);
+ }
+ else if(em->selected.first && ((EditSelection*)em->selected.first)->type == EDITVERT)
+ RNA_enum_item_add(&item, &totitem, &merge_type_items[1]);
+ else if(em->selected.last && ((EditSelection*)em->selected.last)->type == EDITVERT)
+ RNA_enum_item_add(&item, &totitem, &merge_type_items[0]);
+ }
+
+ RNA_enum_item_add(&item, &totitem, &merge_type_items[2]);
+ RNA_enum_item_add(&item, &totitem, &merge_type_items[3]);
+ RNA_enum_item_add(&item, &totitem, &merge_type_items[4]);
+ RNA_enum_item_end(&item, &totitem);
+
+ *free= 1;
+
+ return item;
+ }
- return merge_type_items;
+ return NULL;
}
void MESH_OT_merge(wmOperatorType *ot)
@@ -5841,7 +5850,7 @@ void MESH_OT_merge(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "type", merge_type_items, 6, "Type", "Merge method to use.");
+ prop= RNA_def_enum(ot->srna, "type", merge_type_items, 3, "Type", "Merge method to use.");
RNA_def_enum_funcs(prop, merge_type_itemf);
RNA_def_boolean(ot->srna, "uvs", 0, "UVs", "Move UVs according to merge.");
}
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 6bc2f240859..cfe8dd4352d 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -75,7 +75,7 @@ static int vertex_specials_invoke(bContext *C, wmOperator *op, wmEvent *event)
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles");
- uiItemO(layout, "Merge...", 0, "MESH_OT_merge"); // mergmenu(em)
+ uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth");
uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path");
//uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape");
@@ -387,6 +387,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
WM_keymap_add_item(keymap, "MESH_OT_colors_mirror",EIGHTKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "MESH_OT_rip",VKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
/* add/remove */
WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/object/editgroup.c b/source/blender/editors/object/editgroup.c
index b49e2040b03..5943b36a6b0 100644
--- a/source/blender/editors/object/editgroup.c
+++ b/source/blender/editors/object/editgroup.c
@@ -161,7 +161,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Remove Selected From active group";
+ ot->name= "Remove Selected From Active Group";
ot->description = "Remove the object from an object group that contains the active object.";
ot->idname= "GROUP_OT_objects_remove_active";
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 11f6b443912..9ea8907e172 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -243,16 +243,18 @@ void ED_object_base_init_from_view(bContext *C, Base *base)
/* ******************* add object operator ****************** */
static EnumPropertyItem prop_object_types[] = {
- {OB_EMPTY, "EMPTY", 0, "Empty", ""},
{OB_MESH, "MESH", 0, "Mesh", ""},
{OB_CURVE, "CURVE", 0, "Curve", ""},
{OB_SURF, "SURFACE", 0, "Surface", ""},
- {OB_FONT, "TEXT", 0, "Text", ""},
{OB_MBALL, "META", 0, "Meta", ""},
- {OB_LAMP, "LAMP", 0, "Lamp", ""},
- {OB_CAMERA, "CAMERA", 0, "Camera", ""},
+ {OB_FONT, "TEXT", 0, "Text", ""},
+ {0, "", 0, NULL, NULL},
{OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
{OB_LATTICE, "LATTICE", 0, "Lattice", ""},
+ {OB_EMPTY, "EMPTY", 0, "Empty", ""},
+ {0, "", 0, NULL, NULL},
+ {OB_CAMERA, "CAMERA", 0, "Camera", ""},
+ {OB_LAMP, "LAMP", 0, "Lamp", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -327,6 +329,7 @@ static EnumPropertyItem prop_mesh_types[] = {
{4, "ICOSPHERE", 0, "Icosphere", ""},
{5, "CYLINDER", 0, "Cylinder", ""},
{6, "CONE", 0, "Cone", ""},
+ {0, "", 0, NULL, NULL},
{7, "GRID", 0, "Grid", ""},
{8, "MONKEY", 0, "Monkey", ""},
{0, NULL, 0, NULL, NULL}
@@ -619,16 +622,18 @@ static int object_primitive_add_invoke(bContext *C, wmOperator *op, wmEvent *eve
uiPopupMenu *pup= uiPupMenuBegin(C, "Add Object", 0);
uiLayout *layout= uiPupMenuLayout(pup);
- uiItemMenuEnumO(layout, NULL, ICON_OUTLINER_OB_MESH, "OBJECT_OT_mesh_add", "type");
- uiItemMenuEnumO(layout, NULL, ICON_OUTLINER_OB_CURVE, "OBJECT_OT_curve_add", "type");
- uiItemMenuEnumO(layout, NULL, ICON_OUTLINER_OB_SURFACE, "OBJECT_OT_surface_add", "type");
- uiItemO(layout, NULL, ICON_OUTLINER_OB_FONT, "OBJECT_OT_text_add");
+ uiItemMenuEnumO(layout, "Mesh", ICON_OUTLINER_OB_MESH, "OBJECT_OT_mesh_add", "type");
+ uiItemMenuEnumO(layout, "Curve", ICON_OUTLINER_OB_CURVE, "OBJECT_OT_curve_add", "type");
+ uiItemMenuEnumO(layout, "Surface", ICON_OUTLINER_OB_SURFACE, "OBJECT_OT_surface_add", "type");
uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_META, "OBJECT_OT_object_add", "type", OB_MBALL);
+ uiItemO(layout, "Text", ICON_OUTLINER_OB_FONT, "OBJECT_OT_text_add");
+ uiItemS(layout);
+ uiItemO(layout, "Armature", ICON_OUTLINER_OB_ARMATURE, "OBJECT_OT_armature_add");
+ uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_LATTICE, "OBJECT_OT_object_add", "type", OB_LATTICE);
+ uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_EMPTY, "OBJECT_OT_object_add", "type", OB_EMPTY);
+ uiItemS(layout);
uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_CAMERA, "OBJECT_OT_object_add", "type", OB_CAMERA);
uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_LAMP, "OBJECT_OT_object_add", "type", OB_LAMP);
- uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_EMPTY, "OBJECT_OT_object_add", "type", OB_EMPTY);
- uiItemO(layout, NULL, ICON_OUTLINER_OB_ARMATURE, "OBJECT_OT_armature_add");
- uiItemEnumO(layout, NULL, ICON_OUTLINER_OB_LATTICE, "OBJECT_OT_object_add", "type", OB_LATTICE);
uiPupMenuEnd(C, pup);
@@ -699,8 +704,8 @@ void OBJECT_OT_delete(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Delete Objects";
- ot->description = "Delete the object.";
+ ot->name= "Delete";
+ ot->description = "Delete selected objects.";
ot->idname= "OBJECT_OT_delete";
/* api callbacks */
@@ -1374,20 +1379,21 @@ static EnumPropertyItem prop_clear_parent_types[] = {
/* note, poll should check for editable scene */
static int parent_clear_exec(bContext *C, wmOperator *op)
{
+ int type= RNA_enum_get(op->ptr, "type");
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(RNA_enum_is_equal(op->ptr, "type", "CLEAR")) {
+ if(type == 0) {
ob->parent= NULL;
}
- if(RNA_enum_is_equal(op->ptr, "type", "CLEAR_KEEP_TRANSFORM")) {
+ else if(type == 1) {
ob->parent= NULL;
ob->track= NULL;
ED_object_apply_obmat(ob);
}
- if(RNA_enum_is_equal(op->ptr, "type", "CLEAR_INVERSE")) {
+ else if(type == 2)
Mat4One(ob->parentinv);
- }
+
ob->recalc |= OB_RECALC;
}
CTX_DATA_END;
@@ -1402,7 +1408,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
void OBJECT_OT_parent_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear parent";
+ ot->name= "Clear Parent";
ot->description = "Clear the object's parenting.";
ot->idname= "OBJECT_OT_parent_clear";
@@ -1430,6 +1436,8 @@ static EnumPropertyItem prop_clear_track_types[] = {
/* note, poll should check for editable scene */
static int object_track_clear_exec(bContext *C, wmOperator *op)
{
+ int type= RNA_enum_get(op->ptr, "type");
+
if(CTX_data_edit_object(C)) {
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
return OPERATOR_CANCELLED;
@@ -1438,9 +1446,8 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
ob->track= NULL;
ob->recalc |= OB_RECALC;
- if(RNA_enum_is_equal(op->ptr, "type", "CLEAR_KEEP_TRANSFORM")) {
+ if(type == 1)
ED_object_apply_obmat(ob);
- }
}
CTX_DATA_END;
@@ -1890,7 +1897,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Object Location";
+ ot->name= "Clear Location";
ot->description = "Clear the object's location.";
ot->idname= "OBJECT_OT_location_clear";
@@ -1934,7 +1941,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Object Rotation";
+ ot->name= "Clear Rotation";
ot->description = "Clear the object's rotation.";
ot->idname= "OBJECT_OT_rotation_clear";
@@ -1982,7 +1989,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Object Scale";
+ ot->name= "Clear Scale";
ot->description = "Clear the object's scale.";
ot->idname= "OBJECT_OT_scale_clear";
@@ -2028,7 +2035,7 @@ void OBJECT_OT_origin_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear Object Origin";
+ ot->name= "Clear Origin";
ot->description = "Clear the object's origin.";
ot->idname= "OBJECT_OT_origin_clear";
@@ -2071,12 +2078,11 @@ void OBJECT_OT_restrictview_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Clear restrict view";
+ ot->name= "Clear Restrict View";
ot->description = "Reveal the object by setting the restrictview flag.";
ot->idname= "OBJECT_OT_restrictview_clear";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
ot->exec= object_restrictview_clear_exec;
ot->poll= ED_operator_view3d_active;
@@ -2084,19 +2090,14 @@ void OBJECT_OT_restrictview_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static EnumPropertyItem prop_set_restrictview_types[] = {
- {0, "SELECTED", 0, "Selected", ""},
- {1, "UNSELECTED", 0, "Unselected ", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
static int object_restrictview_set_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
short changed = 0;
+ int unselected= RNA_boolean_get(op->ptr, "unselected");
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if(RNA_enum_is_equal(op->ptr, "type", "SELECTED")){
+ if(!unselected) {
if (base->flag & SELECT){
base->flag &= ~SELECT;
base->object->flag = base->flag;
@@ -2107,7 +2108,7 @@ static int object_restrictview_set_exec(bContext *C, wmOperator *op)
}
}
}
- else if (RNA_enum_is_equal(op->ptr, "type", "UNSELECTED")){
+ else {
if (!(base->flag & SELECT)){
base->object->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
@@ -2129,19 +2130,18 @@ static int object_restrictview_set_exec(bContext *C, wmOperator *op)
void OBJECT_OT_restrictview_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Set restrict view";
+ ot->name= "Set Restrict View";
ot->description = "Hide the object by setting the restrictview flag.";
ot->idname= "OBJECT_OT_restrictview_set";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
ot->exec= object_restrictview_set_exec;
ot->poll= ED_operator_view3d_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_enum(ot->srna, "type", prop_set_restrictview_types, 0, "Type", "");
+ RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects.");
}
/* ************* Slow Parent ******************* */
@@ -2638,7 +2638,7 @@ static int parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
void OBJECT_OT_parent_set(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make parent";
+ ot->name= "Make Parent";
ot->description = "Set the object's parenting.";
ot->idname= "OBJECT_OT_parent_set";
@@ -2665,8 +2665,9 @@ static EnumPropertyItem prop_make_track_types[] = {
static int track_set_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
+ int type= RNA_enum_get(op->ptr, "type");
- if(RNA_enum_is_equal(op->ptr, "type", "TRACKTO")){
+ if(type == 1) {
bConstraint *con;
bTrackToConstraint *data;
@@ -2690,7 +2691,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
}
- else if(RNA_enum_is_equal(op->ptr, "type", "LOCKTRACK")){
+ else if(type == 2) {
bConstraint *con;
bLockTrackConstraint *data;
@@ -2714,7 +2715,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
}
- else if(RNA_enum_is_equal(op->ptr, "type", "OLDTRACK")){
+ else {
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
if(base!=BASACT) {
base->object->track= BASACT->object;
@@ -2792,7 +2793,7 @@ static void make_object_duplilist_real(Scene *scene, View3D *v3d, Base *base)
}
-static int object_dupli_set_real_exec(bContext *C, wmOperator *op)
+static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
ScrArea *sa= CTX_wm_area(C);
@@ -2812,17 +2813,17 @@ static int object_dupli_set_real_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void OBJECT_OT_dupli_set_real(wmOperatorType *ot)
+void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Make Dupli Real";
+ ot->name= "Make Duplicates Real";
ot->description = "Make dupli objects attached to this object real.";
- ot->idname= "OBJECT_OT_dupli_set_real";
+ ot->idname= "OBJECT_OT_duplicates_make_real";
/* api callbacks */
ot->invoke= WM_operator_confirm;
- ot->exec= object_dupli_set_real_exec;
+ ot->exec= object_duplicates_make_real_exec;
ot->poll= ED_operator_scene_editable;
@@ -5961,7 +5962,8 @@ static int duplicate_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C);
- int dupflag= U.dupflag;
+ int linked= RNA_boolean_get(op->ptr, "linked");
+ int dupflag= (linked)? 0: U.dupflag;
clear_id_newpoins();
clear_sca_new_poins(); /* sensor/contr/act */
@@ -6003,8 +6005,8 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Duplicate Objects";
- ot->description = "Duplicate the objects.";
+ ot->name= "Duplicate";
+ ot->description = "Duplicate selected objects.";
ot->idname= "OBJECT_OT_duplicate";
/* api callbacks */
@@ -6017,6 +6019,7 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* to give to transform */
+ RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data.");
RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
}
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 12776c08d4f..2173e79ac66 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -59,7 +59,7 @@ void OBJECT_OT_restrictview_clear(struct wmOperatorType *ot);
void OBJECT_OT_slowparent_set(struct wmOperatorType *ot);
void OBJECT_OT_slowparent_clear(struct wmOperatorType *ot);
void OBJECT_OT_center_set(struct wmOperatorType *ot);
-void OBJECT_OT_dupli_set_real(struct wmOperatorType *ot);
+void OBJECT_OT_duplicates_make_real(struct wmOperatorType *ot);
void OBJECT_OT_object_add(struct wmOperatorType *ot);
void OBJECT_OT_duplicate(struct wmOperatorType *ot);
void OBJECT_OT_delete(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 3a9973b7ec5..50c14673939 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -83,7 +83,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_slowparent_set);
WM_operatortype_append(OBJECT_OT_slowparent_clear);
WM_operatortype_append(OBJECT_OT_center_set);
- WM_operatortype_append(OBJECT_OT_dupli_set_real);
+ WM_operatortype_append(OBJECT_OT_duplicates_make_real);
WM_operatortype_append(OBJECT_OT_duplicate);
WM_operatortype_append(GROUP_OT_group_create);
WM_operatortype_append(GROUP_OT_objects_remove);
@@ -155,12 +155,14 @@ void ED_keymap_object(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "OBJECT_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_origin_clear", OKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_restrictview_clear", HKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_clear", HKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
WM_keymap_verify_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_primitive_add", AKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_duplicate", DKEY, KM_PRESS, KM_ALT, 0)->ptr, "linked", 1);
// XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
WM_keymap_verify_item(keymap, "ANIM_OT_insert_keyframe_menu", IKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 3379d728826..99bbe0514c9 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2314,46 +2314,54 @@ static ScrArea *find_area_showing_r_result(bContext *C)
static void screen_set_image_output(bContext *C)
{
+ Scene *scene= CTX_data_scene(C);
ScrArea *sa;
SpaceImage *sima;
- sa= find_area_showing_r_result(C);
+ if(scene->r.displaymode==R_OUTPUT_SCREEN) {
+ /* this function returns with changed context */
+ ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
+ sa= CTX_wm_area(C);
+ }
+ else {
- if(sa==NULL) {
- /* find largest open non-image area */
- sa= biggest_non_image_area(C);
- if(sa) {
- ED_area_newspace(C, sa, SPACE_IMAGE);
- sima= sa->spacedata.first;
-
- /* makes ESC go back to prev space */
- sima->flag |= SI_PREVSPACE;
- }
- else {
- /* use any area of decent size */
- sa= biggest_area(C);
- if(sa->spacetype!=SPACE_IMAGE) {
- // XXX newspace(sa, SPACE_IMAGE);
+ sa= find_area_showing_r_result(C);
+
+ if(sa==NULL) {
+ /* find largest open non-image area */
+ sa= biggest_non_image_area(C);
+ if(sa) {
+ ED_area_newspace(C, sa, SPACE_IMAGE);
sima= sa->spacedata.first;
/* makes ESC go back to prev space */
sima->flag |= SI_PREVSPACE;
}
+ else {
+ /* use any area of decent size */
+ sa= biggest_area(C);
+ if(sa->spacetype!=SPACE_IMAGE) {
+ // XXX newspace(sa, SPACE_IMAGE);
+ sima= sa->spacedata.first;
+
+ /* makes ESC go back to prev space */
+ sima->flag |= SI_PREVSPACE;
+ }
+ }
}
- }
-
+ }
sima= sa->spacedata.first;
/* get the correct image, and scale it */
sima->image= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
- if(G.displaymode==2) { // XXX
- if(sa->full==0) {
- sima->flag |= SI_FULLWINDOW;
+// if(G.displaymode==2) { // XXX
+ if(sa->full) {
+ sima->flag |= SI_FULLWINDOW|SI_PREVSPACE;
- ed_screen_fullarea(C, sa);
+// ed_screen_fullarea(C, sa);
}
- }
+// }
}
@@ -2399,6 +2407,62 @@ static void render_freejob(void *rjv)
MEM_freeN(rj);
}
+/* str is IMA_RW_MAXTEXT in size */
+static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
+{
+ char info_time_str[32]; // used to be extern to header_info.c
+ uintptr_t mem_in_use, mmap_in_use;
+ float megs_used_memory, mmap_used_memory;
+ char *spos= str;
+
+ mem_in_use= MEM_get_memory_in_use();
+ mmap_in_use= MEM_get_mapped_memory_in_use();
+
+ megs_used_memory= (mem_in_use-mmap_in_use)/(1024.0*1024.0);
+ mmap_used_memory= (mmap_in_use)/(1024.0*1024.0);
+
+ if(scene->lay & 0xFF000000)
+ spos+= sprintf(spos, "Localview | ");
+ else if(scene->r.scemode & R_SINGLE_LAYER)
+ spos+= sprintf(spos, "Single Layer | ");
+
+ spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d ", (scene->r.cfra), rs->totvert, rs->totface);
+ if(rs->tothalo) spos+= sprintf(spos, "Ha:%d ", rs->tothalo);
+ if(rs->totstrand) spos+= sprintf(spos, "St:%d ", rs->totstrand);
+ spos+= sprintf(spos, "La:%d Mem:%.2fM (%.2fM) ", rs->totlamp, megs_used_memory, mmap_used_memory);
+
+ if(rs->curfield)
+ spos+= sprintf(spos, "Field %d ", rs->curfield);
+ if(rs->curblur)
+ spos+= sprintf(spos, "Blur %d ", rs->curblur);
+
+ BLI_timestr(rs->lastframetime, info_time_str);
+ spos+= sprintf(spos, "Time:%s ", info_time_str);
+
+ if(rs->infostr)
+ spos+= sprintf(spos, "| %s ", rs->infostr);
+
+ /* very weak... but 512 characters is quite safe */
+ if(spos >= str+IMA_RW_MAXTEXT)
+ printf("WARNING! renderwin text beyond limit \n");
+
+}
+
+static void image_renderinfo_cb(void *rjv, RenderStats *rs)
+{
+ RenderJob *rj= rjv;
+
+ /* malloc OK here, stats_draw is not in tile threads */
+ if(rj->image->render_text==NULL)
+ rj->image->render_text= MEM_callocN(IMA_RW_MAXTEXT, "rendertext");
+
+ make_renderinfo_string(rs, rj->scene, rj->image->render_text);
+
+ /* make jobs timer to send notifier */
+ *(rj->do_update)= 1;
+
+}
+
/* called inside thread! */
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
{
@@ -2580,6 +2644,8 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
re= RE_NewRender(scene->id.name);
RE_test_break_cb(re, rj, render_breakjob);
RE_display_draw_cb(re, rj, image_rect_update);
+ RE_stats_draw_cb(re, rj, image_renderinfo_cb);
+
rj->re= re;
G.afbreek= 0;
@@ -2654,6 +2720,48 @@ void SCREEN_OT_render_view_cancel(struct wmOperatorType *ot)
ot->poll= ED_operator_image_active;
}
+/* *********************** show render viewer *************** */
+
+static int render_view_show_exec(bContext *C, wmOperator *unused)
+{
+ ScrArea *sa= find_area_showing_r_result(C);
+
+ /* determine if render already shows */
+ if(sa) {
+ SpaceImage *sima= sa->spacedata.first;
+
+ if(sima->flag & SI_PREVSPACE) {
+ sima->flag &= ~SI_PREVSPACE;
+
+ if(sima->flag & SI_FULLWINDOW) {
+ sima->flag &= ~SI_FULLWINDOW;
+ ED_screen_full_prevspace(C);
+ }
+ else if(sima->next) {
+ ED_area_newspace(C, sa, sima->next->spacetype);
+ ED_area_tag_redraw(sa);
+ }
+ }
+ }
+ else {
+ screen_set_image_output(C);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void SCREEN_OT_render_view_show(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Show/Hide Render View";
+ ot->idname= "SCREEN_OT_render_view_show";
+
+ /* api callbacks */
+ ot->exec= render_view_show_exec;
+ ot->poll= ED_operator_screenactive;
+}
+
+
/* **************** Assigning operatortypes to global list, adding handlers **************** */
@@ -2689,7 +2797,8 @@ void ED_operatortypes_screen(void)
/* render */
WM_operatortype_append(SCREEN_OT_render);
WM_operatortype_append(SCREEN_OT_render_view_cancel);
-
+ WM_operatortype_append(SCREEN_OT_render_view_show);
+
/* tools shared by more space types */
WM_operatortype_append(ED_OT_undo);
WM_operatortype_append(ED_OT_redo);
@@ -2750,6 +2859,7 @@ void ED_keymap_screen(wmWindowManager *wm)
/* render */
WM_keymap_add_item(keymap, "SCREEN_OT_render", F12KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_render_view_cancel", ESCKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_render_view_show", F11KEY, KM_PRESS, 0, 0);
/* frame offsets & play */
keymap= WM_keymap_listbase(wm, "Frames", 0, 0);
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 02ee8f508c1..f1f20a36b59 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -90,6 +90,8 @@ enum {
B_FS_EXEC,
B_FS_CANCEL,
B_FS_PARENT,
+ B_FS_DIRNAME,
+ B_FS_FILENAME
} eFile_ButEvents;
@@ -105,68 +107,130 @@ static void do_file_buttons(bContext *C, void *arg, int event)
case B_FS_PARENT:
file_parent_exec(C, NULL); /* file_ops.c */
break;
+ case B_FS_FILENAME:
+ file_filename_exec(C, NULL);
+ break;
+ case B_FS_DIRNAME:
+ file_directory_exec(C, NULL);
+ break;
}
}
-/* note; this function uses pixelspace (0, 0, winx, winy), not view2d */
+/* Note: This function uses pixelspace (0, 0, winx, winy), not view2d.
+ * The controls are laid out as follows:
+ *
+ * -------------------------------------------
+ * | Directory input | execute |
+ * -------------------------------------------
+ * | Filename input | + | - | cancel |
+ * -------------------------------------------
+ *
+ * The input widgets will stretch to fill any excess space.
+ * When there isn't enough space for all controls to be shown, they are
+ * hidden in this order: x/-, execute/cancel, input widgets.
+ */
void file_draw_buttons(const bContext *C, ARegion *ar)
{
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ /* Button layout. */
+ const short min_x = 10;
+ const short max_x = ar->winx - 10;
+ const short line2_y = ar->winy - IMASEL_BUTTONS_HEIGHT - 12;
+ const short line1_y = line2_y + IMASEL_BUTTONS_HEIGHT/2 + 4;
+ const short input_minw = 20;
+ const short btn_h = 21;
+ const short btn_fn_w = 14;
+ const short btn_minw = 80;
+ const short btn_margin = 20;
+ const short separator = 4;
+
+ /* Additional locals. */
+ char name[20];
+ short loadbutton;
+ short fnumbuttons;
+ short available_w = max_x - min_x;
+ short line1_w = available_w;
+ short line2_w = available_w;
+
+ uiBut* but;
+ uiBlock* block;
+ SpaceFile* sfile = (SpaceFile*) CTX_wm_space_data(C);
FileSelectParams* params = ED_fileselect_get_params(sfile);
- uiBlock *block;
- int loadbutton;
- char name[20];
- float slen;
- int filebuty1, filebuty2;
-
- float xmin = 8;
- float xmax = ar->winx - 10;
-
- filebuty1= ar->winy - IMASEL_BUTTONS_HEIGHT - 12;
- filebuty2= filebuty1 + IMASEL_BUTTONS_HEIGHT/2 + 4;
-
- /* HEADER */
+
+ /* Initialize UI block. */
sprintf(name, "win %p", ar);
block = uiBeginBlock(C, ar, name, UI_EMBOSS);
uiBlockSetHandleFunc(block, do_file_buttons, NULL);
-
- /* XXXX
- uiSetButLock( filelist_gettype(simasel->files)==FILE_MAIN && simasel->returnfunc, NULL);
- */
-
- /* space available for load/save buttons? */
- slen = UI_GetStringWidth(sfile->params->title);
- loadbutton= slen > 60 ? slen + 20 : MAX2(80, 20+UI_GetStringWidth(params->title));
- if(ar->winx > loadbutton+20) {
- if(params->title[0]==0) {
- loadbutton= 0;
- }
+
+ /* Is there enough space for the execute / cancel buttons? */
+ loadbutton = UI_GetStringWidth(sfile->params->title) + btn_margin;
+ if (loadbutton < btn_minw) {
+ loadbutton = MAX2(btn_minw,
+ btn_margin + UI_GetStringWidth(params->title));
}
- else {
- loadbutton= 0;
+
+ if (available_w <= loadbutton + separator + input_minw
+ || params->title[0] == 0) {
+ loadbutton = 0;
+ } else {
+ line1_w -= (loadbutton + separator);
+ line2_w = line1_w;
}
- uiDefBut(block, TEX, 0 /* XXX B_FS_FILENAME */,"", xmin+2, filebuty1, xmax-xmin-loadbutton-4, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
- uiDefBut(block, TEX, 0 /* XXX B_FS_DIRNAME */,"", xmin+2, filebuty2, xmax-xmin-loadbutton-4, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
+ /* Is there enough space for file number increment/decrement buttons? */
+ fnumbuttons = 2 * btn_fn_w;
+ if (!loadbutton || line2_w <= fnumbuttons + separator + input_minw) {
+ fnumbuttons = 0;
+ } else {
+ line2_w -= (fnumbuttons + separator);
+ }
+
+ /* Text input fields for directory and file. */
+ if (available_w > 0) {
+ but = uiDefBut(block, TEX, B_FS_DIRNAME, "",
+ min_x, line1_y, line1_w, btn_h,
+ params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0,
+ "File path.");
+ uiButSetCompleteFunc(but, autocomplete_directory, NULL);
+ uiDefBut(block, TEX, B_FS_FILENAME, "",
+ min_x, line2_y, line2_w, btn_h,
+ params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0,
+ "File name.");
+ }
+
+ /* Filename number increment / decrement buttons. */
+ if (fnumbuttons) {
+ uiBlockBeginAlign(block);
+ but = uiDefButO(block, BUT, "FILE_OT_filenum", 0, "-",
+ min_x + line2_w + separator, line2_y,
+ btn_fn_w, btn_h,
+ "Decrement the filename number.");
+ RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1);
+ but = uiDefButO(block, BUT, "FILE_OT_filenum", 0, "+",
+ min_x + line2_w + separator + btn_fn_w, line2_y,
+ btn_fn_w, btn_h,
+ "Increment the filename number.");
+ RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1);
+ uiBlockEndAlign(block);
+ }
+
+ /* Execute / cancel buttons. */
if(loadbutton) {
- uiDefBut(block, BUT, B_FS_EXEC, params->title, xmax-loadbutton, filebuty2, loadbutton, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
- uiDefBut(block, BUT, B_FS_CANCEL, "Cancel", xmax-loadbutton, filebuty1, loadbutton, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
+ uiDefBut(block, BUT, B_FS_EXEC, params->title,
+ max_x - loadbutton, line1_y, loadbutton, btn_h,
+ params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, params->title);
+ uiDefBut(block, BUT, B_FS_CANCEL, "Cancel",
+ max_x - loadbutton, line2_y, loadbutton, btn_h,
+ params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "Cancel.");
}
-
+
uiEndBlock(C, block);
uiDrawBlock(C, block);
}
static void draw_tile(short sx, short sy, short width, short height, int colorid, int shade)
-{
- /* TODO: BIF_ThemeColor seems to need this to show the color, not sure why? - elubie */
- //glEnable(GL_BLEND);
- //glColor4ub(0, 0, 0, 100);
- //glDisable(GL_BLEND);
- /* I think it was a missing glDisable() - ton */
-
+{
UI_ThemeColorShade(colorid, shade);
uiSetRoundBox(15);
uiRoundBox(sx, sy - height, sx + width, sy, 6);
diff --git a/source/blender/editors/space_file/file_header.c b/source/blender/editors/space_file/file_header.c
deleted file mode 100644
index 4799003d6c7..00000000000
--- a/source/blender/editors/space_file/file_header.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <string.h>
-#include <stdio.h>
-
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_windowmanager_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-
-#include "BKE_context.h"
-#include "BKE_screen.h"
-#include "BKE_global.h"
-
-#include "ED_screen.h"
-#include "ED_types.h"
-#include "ED_util.h"
-#include "ED_fileselect.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "file_intern.h"
-#include "filelist.h"
-
-#define B_SORTIMASELLIST 1
-#define B_RELOADIMASELDIR 2
-#define B_FILTERIMASELDIR 3
-#define B_HIDEDOTFILES 4
-
-/* ************************ header area region *********************** */
-
-static void do_file_header_buttons(bContext *C, void *arg, int event)
-{
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
- switch(event) {
- case B_SORTIMASELLIST:
- filelist_sort(sfile->files, sfile->params->sort);
- WM_event_add_notifier(C, NC_WINDOW, NULL);
- break;
- case B_RELOADIMASELDIR:
- WM_event_add_notifier(C, NC_WINDOW, NULL);
- break;
- case B_FILTERIMASELDIR:
- if(sfile->params) {
- if (sfile->params->flag & FILE_FILTER) {
- filelist_setfilter(sfile->files,sfile->params->filter);
- filelist_filter(sfile->files);
- } else {
- filelist_setfilter(sfile->files,0);
- filelist_filter(sfile->files);
- }
- }
- WM_event_add_notifier(C, NC_WINDOW, NULL);
- break;
- case B_HIDEDOTFILES:
- if(sfile->params) {
- filelist_free(sfile->files);
- filelist_hidedot(sfile->files, sfile->params->flag & FILE_HIDE_DOT);
- WM_event_add_notifier(C, NC_WINDOW, NULL);
- }
- break;
- }
-}
-
-
-void file_header_buttons(const bContext *C, ARegion *ar)
-{
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
- FileSelectParams* params = ED_fileselect_get_params(sfile);
-
- uiBlock *block;
- int xco, yco= 3;
- int xcotitle;
-
- block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
- uiBlockSetHandleFunc(block, do_file_header_buttons, NULL);
-
- xco= ED_area_header_standardbuttons(C, block, yco);
-
- /*
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- int xmax;
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
- "View", xco, yco-2, xmax-3, 24, "");
- xco+=XIC+xmax;
- }
- */
-
- xco += 5;
-
- uiBlockBeginAlign(block);
- uiDefIconButO(block, BUT, "FILE_OT_parent", WM_OP_INVOKE_DEFAULT, ICON_FILE_PARENT, xco+=XIC, yco, 20, 20, "Navigate to Parent Folder");
- uiDefIconButO(block, BUT, "FILE_OT_refresh", WM_OP_INVOKE_DEFAULT, ICON_FILE_REFRESH, xco+=XIC, yco, 20, 20, "Refresh List of Files");
- uiBlockEndAlign(block);
-
- xco += 5;
-
- uiBlockBeginAlign(block);
- uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_SHORTDISPLAY, 0, 0, "Displays short file description");
- uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_LONGDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_LONGDISPLAY, 0, 0, "Displays long file description");
- uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_IMGDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_IMGDISPLAY, 0, 0, "Displays files as thumbnails");
- uiBlockEndAlign(block);
-
- xco+=XIC;
-
-
- uiBlockBeginAlign(block);
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTALPHA, xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically");
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTBYEXT, xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 3.0, 0, 0, "Sorts files by extension");
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTTIME, xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 1.0, 0, 0, "Sorts files by time");
- uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTSIZE, xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 2.0, 0, 0, "Sorts files by size");
- uiBlockEndAlign(block);
-
- xco+=XIC;
- uiDefIconButBitS(block, TOG, FILE_HIDE_DOT, B_HIDEDOTFILES, ICON_GHOST,xco+=XIC,yco,XIC,YIC, &params->flag, 0, 0, 0, 0, "Hide dot files");
- xco+=XIC;
- uiDefIconButBitS(block, TOG, FILE_FILTER, B_FILTERIMASELDIR, ICON_FILTER,xco+=XIC,yco,XIC,YIC, &params->flag, 0, 0, 0, 0, "Filter files");
-
- if (params->flag & FILE_FILTER) {
- xco+=4;
- uiBlockBeginAlign(block);
- uiDefIconButBitS(block, TOG, IMAGEFILE, B_FILTERIMASELDIR, ICON_FILE_IMAGE,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show images");
- uiDefIconButBitS(block, TOG, BLENDERFILE, B_FILTERIMASELDIR, ICON_FILE_BLEND,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show .blend files");
- uiDefIconButBitS(block, TOG, MOVIEFILE, B_FILTERIMASELDIR, ICON_FILE_MOVIE,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show movies");
- uiDefIconButBitS(block, TOG, PYSCRIPTFILE, B_FILTERIMASELDIR, ICON_FILE_SCRIPT,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show python scripts");
- uiDefIconButBitS(block, TOG, FTFONTFILE, B_FILTERIMASELDIR, ICON_FILE_FONT,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show fonts");
- uiDefIconButBitS(block, TOG, SOUNDFILE, B_FILTERIMASELDIR, ICON_FILE_SOUND,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show sound files");
- uiDefIconButBitS(block, TOG, TEXTFILE, B_FILTERIMASELDIR, ICON_FILE_BLANK,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show text files");
- uiDefIconButBitS(block, TOG, FOLDERFILE, B_FILTERIMASELDIR, ICON_FILE_FOLDER,xco+=XIC,yco,XIC,YIC, &params->filter, 0, 0, 0, 0, "Show folders");
- uiBlockEndAlign(block);
- xco+=XIC;
- }
-
- xcotitle= xco;
- xco+= UI_GetStringWidth(params->title);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
-
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
-}
-
-
-
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 2f3fae47abb..dce56e05d6b 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -34,9 +34,6 @@ struct ARegion;
struct ARegionType;
struct SpaceFile;
-/* file_header.c */
-void file_header_buttons(const bContext *C, ARegion *ar);
-
/* file_ops.c */
struct ARegion *file_buttons_region(struct ScrArea *sa);
@@ -65,23 +62,34 @@ void FILE_OT_loadimages(struct wmOperatorType *ot);
void FILE_OT_exec(struct wmOperatorType *ot);
void FILE_OT_cancel(struct wmOperatorType *ot);
void FILE_OT_parent(struct wmOperatorType *ot);
+void FILE_OT_directory_new(struct wmOperatorType *ot);
+void FILE_OT_filename(struct wmOperatorType *ot);
void FILE_OT_previous(struct wmOperatorType *ot);
void FILE_OT_next(struct wmOperatorType *ot);
void FILE_OT_refresh(struct wmOperatorType *ot);
void FILE_OT_bookmark_toggle(struct wmOperatorType *ot);
void FILE_OT_filenum(struct wmOperatorType *ot);
+void FILE_OT_delete(struct wmOperatorType *ot);
int file_exec(bContext *C, struct wmOperator *unused);
int file_cancel_exec(bContext *C, struct wmOperator *unused);
int file_parent_exec(bContext *C, struct wmOperator *unused);
int file_previous_exec(bContext *C, struct wmOperator *unused);
int file_next_exec(bContext *C, struct wmOperator *unused);
+int file_filename_exec(bContext *C, struct wmOperator *unused);
+int file_directory_exec(bContext *C, struct wmOperator *unused);
+int file_directory_new_exec(bContext *C,struct wmOperator *unused);
+int file_delete_exec(bContext *C, struct wmOperator *unused);
+
int file_hilight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
+
/* filesel.c */
float file_string_width(const char* str);
float file_font_pointsize();
void file_change_dir(struct SpaceFile *sfile);
+int file_select_match(struct SpaceFile *sfile, const char *pattern);
+void autocomplete_directory(struct bContext *C, char *str, void *arg_v);
/* file_panels.c */
void file_panels_register(struct ARegionType *art);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index c4435e85749..8f1d2598c61 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -142,10 +142,10 @@ static void file_select(SpaceFile* sfile, ARegion* ar, const rcti* rect, short v
{
// XXX error("Path too long, cannot enter this directory");
} else {
+ BLI_cleanup_dir(G.sce, params->dir);
strcat(params->dir, file->relname);
- strcat(params->dir,"/");
+ BLI_add_slash(params->dir);
params->file[0] = '\0';
- BLI_cleanup_dir(G.sce, params->dir);
file_change_dir(sfile);
}
}
@@ -557,11 +557,13 @@ int file_parent_exec(bContext *C, wmOperator *unused)
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
if(sfile->params) {
- BLI_parent_dir(sfile->params->dir);
- file_change_dir(sfile);
+ if (BLI_has_parent(sfile->params->dir)) {
+ BLI_parent_dir(sfile->params->dir);
+ file_change_dir(sfile);
+ WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+ }
}
- WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -652,6 +654,101 @@ int file_next_exec(bContext *C, wmOperator *unused)
return OPERATOR_FINISHED;
}
+int file_directory_new_exec(bContext *C, wmOperator *unused)
+{
+ char tmpstr[FILE_MAX];
+ char tmpdir[FILE_MAXFILE];
+ int i = 1;
+
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+
+ if(sfile->params) {
+
+ BLI_strncpy(tmpstr, sfile->params->dir, FILE_MAX);
+ BLI_join_dirfile(tmpstr, tmpstr, "New Folder");
+ while (BLI_exists(tmpstr)) {
+ BLI_snprintf(tmpdir, FILE_MAXFILE, "New Folder(%d)", i++);
+ BLI_strncpy(tmpstr, sfile->params->dir, FILE_MAX);
+ BLI_join_dirfile(tmpstr, tmpstr, tmpdir);
+ }
+ BLI_recurdir_fileops(tmpstr);
+ if (!BLI_exists(tmpstr)) {
+ filelist_free(sfile->files);
+ filelist_parent(sfile->files);
+ BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), FILE_MAX);
+ }
+ }
+ WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+
+void FILE_OT_directory_new(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Create New Directory";
+ ot->idname= "FILE_OT_directory_new";
+
+ /* api callbacks */
+ ot->invoke= WM_operator_confirm;
+ ot->exec= file_directory_new_exec;
+ ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+}
+
+int file_directory_exec(bContext *C, wmOperator *unused)
+{
+ char tmpstr[FILE_MAX];
+
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+
+ if(sfile->params) {
+
+ if ( sfile->params->dir[0] == '~' ) {
+ if (sfile->params->dir[1] == '\0') {
+ BLI_strncpy(sfile->params->dir, BLI_gethome(), sizeof(sfile->params->dir) );
+ } else {
+ /* replace ~ with home */
+ char homestr[FILE_MAX];
+ char *d = &sfile->params->dir[1];
+
+ while ( (*d == '\\') || (*d == '/') )
+ d++;
+ BLI_strncpy(homestr, BLI_gethome(), FILE_MAX);
+ BLI_add_slash(homestr);
+ BLI_join_dirfile(tmpstr, homestr, d);
+ BLI_strncpy(sfile->params->dir, tmpstr, sizeof(sfile->params->dir));
+ }
+ }
+#ifdef WIN32
+ if (sfile->params->dir[0] == '\0')
+ get_default_root(sfile->params->dir);
+#endif
+ BLI_add_slash(sfile->params->dir);
+ file_change_dir(sfile);
+ WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+ }
+
+
+ return OPERATOR_FINISHED;
+}
+
+int file_filename_exec(bContext *C, wmOperator *unused)
+{
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+
+ if(sfile->params) {
+ if (file_select_match(sfile, sfile->params->file))
+ {
+ sfile->params->file[0] = '\0';
+ WM_event_add_notifier(C, NC_FILE|ND_PARAMS, NULL);
+ }
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+
void FILE_OT_refresh(struct wmOperatorType *ot)
{
/* identifiers */
@@ -772,3 +869,48 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100);
}
+int file_delete_poll(bContext *C)
+{
+ int poll = ED_operator_file_active(C);
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ struct direntry* file;
+
+ if(!sfile->params ) poll= 0;
+
+ if (sfile->params->active_file < 0) {
+ poll= 0;
+ } else {
+ file = filelist_file(sfile->files, sfile->params->active_file);
+ if (file && S_ISDIR(file->type)) poll= 0;
+ }
+ return poll;
+}
+
+int file_delete_exec(bContext *C, wmOperator *op)
+{
+ char str[FILE_MAX];
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ struct direntry* file;
+
+
+ file = filelist_file(sfile->files, sfile->params->active_file);
+ BLI_make_file_string(G.sce, str, sfile->params->dir, file->relname);
+ BLI_delete(str, 0, 0);
+ WM_event_add_notifier(C, NC_FILE | ND_FILELIST, NULL);
+
+ return OPERATOR_FINISHED;
+
+}
+
+void FILE_OT_delete(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Delete File";
+ ot->idname= "FILE_OT_delete";
+
+ /* api callbacks */
+ ot->invoke= WM_operator_confirm;
+ ot->exec= file_delete_exec;
+ ot->poll= file_delete_poll; /* <- important, handler is on window level */
+}
+
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 476145d11a2..d34eb29a78d 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -80,6 +80,17 @@
#include "file_intern.h"
#include "filelist.h"
+#if defined __BeOS
+static int fnmatch(const char *pattern, const char *string, int flags)
+{
+ return 0;
+}
+#elif defined WIN32 && !defined _LIBC
+ /* use fnmatch included in blenlib */
+ #include "BLI_fnmatch.h"
+#else
+ #include <fnmatch.h>
+#endif
FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)
{
@@ -290,7 +301,7 @@ FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar
void file_change_dir(struct SpaceFile *sfile)
{
- if (sfile->params) {
+ if (sfile->params && BLI_exists(sfile->params->dir)) {
filelist_setdir(sfile->files, sfile->params->dir);
if(folderlist_clear_next(sfile))
@@ -302,3 +313,46 @@ void file_change_dir(struct SpaceFile *sfile)
sfile->params->active_file = -1;
}
}
+
+int file_select_match(struct SpaceFile *sfile, const char *pattern)
+{
+ int match = 0;
+ if (strchr(pattern, '*') || strchr(pattern, '?') || strchr(pattern, '[')) {
+ int i;
+ struct direntry *file;
+ int n = filelist_numfiles(sfile->files);
+
+ for (i = 0; i < n; i++) {
+ file = filelist_file(sfile->files, i);
+ if (fnmatch(pattern, file->relname, 0) == 0) {
+ file->flags |= ACTIVE;
+ match = 1;
+ }
+ }
+ }
+ return match;
+}
+
+
+void autocomplete_directory(struct bContext *C, char *str, void *arg_v)
+{
+ char tmp[FILE_MAX];
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+
+ /* search if str matches the beginning of name */
+ if(str[0] && sfile->files) {
+ AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
+ int nentries = filelist_numfiles(sfile->files);
+ int i;
+
+ for(i= 0; i<nentries; ++i) {
+ struct direntry* file = filelist_file(sfile->files, i);
+ char* dir = filelist_dir(sfile->files);
+ if (file && S_ISDIR(file->type)) {
+ BLI_make_file_string(G.sce, tmp, dir, file->relname);
+ autocomplete_do_name(autocpl,tmp);
+ }
+ }
+ autocomplete_end(autocpl, str);
+ }
+} \ No newline at end of file
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 3167d2809c9..5af79eb2800 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -321,6 +321,8 @@ void file_operatortypes(void)
WM_operatortype_append(FILE_OT_delete_bookmark);
WM_operatortype_append(FILE_OT_hidedot);
WM_operatortype_append(FILE_OT_filenum);
+ WM_operatortype_append(FILE_OT_directory_new);
+ WM_operatortype_append(FILE_OT_delete);
}
/* NOTE: do not add .blend file reading on this level */
@@ -335,6 +337,8 @@ void file_keymap(struct wmWindowManager *wm)
WM_keymap_add_item(keymap, "FILE_OT_hidedot", HKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_previous", BACKSPACEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_next", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0);
+ /* WM_keymap_add_item(keymap, "FILE_OT_directory_new", IKEY, KM_PRESS, 0, 0); */ /* XXX needs button */
+ WM_keymap_add_item(keymap, "FILE_OT_delete", XKEY, KM_PRESS, 0, 0);
/* keys for main area */
keymap= WM_keymap_listbase(wm, "FileMain", SPACE_FILE, 0);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index e61931f2fad..e5d74e6dddd 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -127,14 +127,13 @@ static void image_verify_buffer_float(SpaceImage *sima, ImBuf *ibuf)
}
}
-static void draw_render_info(SpaceImage *sima, ARegion *ar)
+static void draw_render_info(Image *ima, ARegion *ar)
{
rcti rect;
float colf[3];
int showspare= 0; // XXX BIF_show_render_spare();
- char *str= "render text"; // XXX BIF_render_text();
- if(str==NULL)
+ if(ima->render_text==NULL)
return;
rect= ar->winrct;
@@ -152,10 +151,10 @@ static void draw_render_info(SpaceImage *sima, ARegion *ar)
if(showspare) {
UI_DrawString(12, rect.ymin + 5, "(Previous)");
- UI_DrawString(72, rect.ymin + 5, str);
+ UI_DrawString(72, rect.ymin + 5, ima->render_text);
}
else
- UI_DrawString(12, rect.ymin + 5, str);
+ UI_DrawString(12, rect.ymin + 5, ima->render_text);
}
void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf)
@@ -685,8 +684,8 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
draw_image_paint_helpers(sima, ar, scene, zoomx, zoomy);
/* render info */
- if(ibuf && show_render)
- draw_render_info(sima, ar);
+ if(ibuf && ima && show_render)
+ draw_render_info(ima, ar);
/* XXX integrate this code */
#if 0
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index a030603996c..868897b76ac 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -122,11 +122,6 @@ EnumPropertyItem sequencer_prop_effect_types[] = {
};
/* mute operator */
-EnumPropertyItem sequencer_prop_operate_types[] = { /* better name? */
- {SEQ_SELECTED, "SELECTED", 0, "Selected", ""},
- {SEQ_UNSELECTED, "UNSELECTED", 0, "Unselected ", ""},
- {0, NULL, 0, NULL, NULL}
-};
EnumPropertyItem prop_side_types[] = {
{SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""},
@@ -1491,8 +1486,7 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
if(ed==NULL)
return OPERATOR_CANCELLED;
- selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED");
-
+ selected= !RNA_boolean_get(op->ptr, "unselected");
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
@@ -1528,7 +1522,7 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_enum(ot->srna, "type", sequencer_prop_operate_types, SEQ_SELECTED, "Type", "");
+ RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips.");
}
@@ -1543,8 +1537,7 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
if(ed==NULL)
return OPERATOR_CANCELLED;
- selected= RNA_enum_is_equal(op->ptr, "type", "SELECTED");
-
+ selected= !RNA_boolean_get(op->ptr, "unselected");
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
@@ -1580,7 +1573,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_enum(ot->srna, "type", sequencer_prop_operate_types, SEQ_SELECTED, "Type", "");
+ RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "UnMute unselected rather than selected strips.");
}
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 82047272049..f561fb2ac43 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -116,11 +116,11 @@ void sequencer_keymap(wmWindowManager *wm)
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0)->ptr, "type", SEQ_CUT_SOFT);
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", SEQ_CUT_HARD);
- RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, 0, 0)->ptr, "type", SEQ_SELECTED);
- RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", SEQ_UNSELECTED);
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
- RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", SEQ_SELECTED);
- RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "type", SEQ_UNSELECTED);
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "unselected", 1);
WM_keymap_add_item(keymap, "SEQUENCER_OT_lock", LKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", HKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 48c14804b13..f58af47a6bd 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -101,7 +101,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c)
int text_font_width_character(SpaceText *st)
{
// XXX need quick BLF function, or cache it somewhere
- return (st->lheight == 12)? 7: 8;
+ return (st->lheight == 12)? 7: 9;
}
int text_font_width(SpaceText *st, char *str)
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index cdc42e4beb8..e6d3ec54d44 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -1725,6 +1725,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
return block;
}
+#if 0
void do_view3d_object_mirrormenu(bContext *C, void *arg, int event)
{
#if 0
@@ -1770,64 +1771,29 @@ static uiBlock *view3d_object_mirrormenu(bContext *C, ARegion *ar, void *arg_unu
uiTextBoundsBlock(block, 60);
return block;
}
-
-static void do_view3d_edit_object_transformmenu(bContext *C, void *arg, int event)
-{
-#if 0
- switch(event) {
- case 0: /* clear origin */
- clear_object('o');
- break;
- case 1: /* clear scale */
- clear_object('s');
- break;
- case 2: /* clear rotation */
- clear_object('r');
- break;
- case 3: /* clear location */
- clear_object('g');
- break;
- case 4:
- if(OBACT) object_apply_deform(OBACT);
- break;
- case 5: /* make duplis real */
- make_duplilist_real();
- break;
- case 6: /* apply scale/rotation or deformation */
- apply_objects_locrot();
- break;
- case 7: /* apply visual matrix to objects loc/size/rot */
- apply_objects_visual_tx();
- break;
- }
#endif
-}
-static uiBlock *view3d_edit_object_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_transformmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_object_transformmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_object_transformmenu, NULL);
-
+#if 0
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Scale/Rotation to ObData|Ctrl A, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ apply_objects_locrot();
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Visual Transform|Ctrl A, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
+ apply_objects_visual_tx();
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Deformation|Ctrl Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Duplicates Real|Ctrl Shift A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Location|Alt G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Rotation|Alt R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Scale|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Origin|Alt O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
+ if(OBACT) object_apply_deform(OBACT);
+#endif
+ uiItemO(layout, NULL, 0, "OBJECT_OT_duplicates_make_real");
+
+ uiItemS(layout);
+
+ uiItemO(layout, NULL, 0, "OBJECT_OT_location_clear");
+ uiItemO(layout, NULL, 0, "OBJECT_OT_rotation_clear");
+ uiItemO(layout, NULL, 0, "OBJECT_OT_scale_clear");
+ uiItemO(layout, NULL, 0, "OBJECT_OT_origin_clear");
}
+#if 0
static void do_view3d_edit_object_makelocalmenu(bContext *C, void *arg, int event)
{
#if 0
@@ -2064,164 +2030,49 @@ static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, ARegion *ar, void *
uiTextBoundsBlock(block, 60);
return block;
}
-
-
-static void do_view3d_edit_object_parentmenu(bContext *C, void *arg, int event)
-{
-#if 0
- switch(event) {
- case 0: /* clear parent */
- clear_parent();
- break;
- case 1: /* make parent */
- make_parent();
- break;
- }
#endif
-}
-static uiBlock *view3d_edit_object_parentmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_parentmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_object_parentmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_object_parentmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Parent...|Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
+ uiItemO(layout, "Make Parent...", 0, "OBJECT_OT_parent_set");
+ uiItemO(layout, "Clear Parent...", 0, "OBJECT_OT_parent_clear");
}
-static void do_view3d_edit_object_groupmenu(bContext *C, void *arg, int event)
+static void view3d_edit_object_groupmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
-#if 0
- switch(event) {
- case 1:
- case 2:
- case 3:
- group_operation(event);
- break;
- }
-#endif
-}
+ uiItemO(layout, NULL, 0, "GROUP_OT_group_create");
+ uiItemO(layout, NULL, 0, "GROUP_OT_objects_remove");
-static uiBlock *view3d_edit_object_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_object_groupmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_object_groupmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to Existing Group|Ctrl G, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to New Group|Ctrl G, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove from All Groups|Ctrl G, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
+ uiItemS(layout);
-static void do_view3d_edit_object_trackmenu(bContext *C, void *arg, int event)
-{
-#if 0
- switch(event) {
- case 0: /* clear track */
- clear_track();
- break;
- case 1: /* make track */
- make_track();
- break;
- }
-#endif
+ uiItemO(layout, NULL, 0, "GROUP_OT_objects_add_active");
+ uiItemO(layout, NULL, 0, "GROUP_OT_objects_remove_active");
}
-static uiBlock *view3d_edit_object_trackmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_trackmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_object_trackmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_object_trackmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Track...|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Track...|Alt T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
+ uiItemO(layout, "Make Track...", 0, "OBJECT_OT_track_set");
+ uiItemO(layout, "Clear Track...", 0, "OBJECT_OT_track_clear");
}
-static void do_view3d_edit_object_constraintsmenu(bContext *C, void *arg, int event)
+static void view3d_edit_object_constraintsmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
#if 0
- switch(event) {
- case 1: /* add constraint */
- add_constraint(0);
- break;
- case 2: /* clear constraint */
- ob_clear_constraints();
- break;
- }
-#endif
-}
-
-static uiBlock *view3d_edit_object_constraintsmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_object_constraintsmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_object_constraintsmenu, NULL);
-
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint...|Ctrl Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ add_constraint(0);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Constraints", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-
-static void do_view3d_edit_object_showhidemenu(bContext *C, void *arg, int event)
-{
-#if 0
-
- switch(event) {
-
- case 0: /* show objects */
- show_objects();
- break;
- case 1: /* hide selected objects */
- hide_objects(1);
- break;
- case 2: /* hide deselected objects */
- hide_objects(0);
- break;
- }
+ ob_clear_constraints();
#endif
}
-static uiBlock *view3d_edit_object_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_object_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_object_showhidemenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_object_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Unselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
+ uiItemO(layout, "Show Hidden", 0, "OBJECT_OT_restrictview_clear");
+ uiItemO(layout, "Hide Selected", 0, "OBJECT_OT_restrictview_set");
+ uiItemBooleanO(layout, "Hide Unselected", 0, "OBJECT_OT_restrictview_set", "unselected", 1);
}
+#if 0
#ifndef DISABLE_PYTHON
static void do_view3d_edit_object_scriptsmenu(bContext *C, void *arg, int event)
{
@@ -2251,11 +2102,12 @@ static uiBlock *view3d_edit_object_scriptsmenu(bContext *C, ARegion *ar, void *a
return block;
}
#endif /* DISABLE_PYTHON */
+#endif
+#if 0
static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
{
-#if 0
Scene *scene= CTX_data_scene(C);
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
@@ -2265,15 +2117,6 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
case 0: /* transform properties*/
// XXX mainqenter(NKEY, 1);
break;
- case 1: /* delete */
- delete_context_selected();
- break;
- case 2: /* duplicate */
- duplicate_context_selected();
- break;
- case 3: /* duplicate linked */
- adduplicate(0, 0);
- break;
case 5: /* make single user */
single_user();
break;
@@ -2292,9 +2135,6 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
case 11: /* insert keyframe */
common_insertkey();
break;
- case 15: /* Object Panel */
- add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
- break;
case 16: /* make proxy object*/
make_proxy();
break;
@@ -2302,82 +2142,75 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
common_deletekey();
break;
}
-#endif
}
+#endif
-static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_edit_objectmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- Scene *scene= CTX_data_scene(C);
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_objectmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_objectmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
+#if 0
+ Object *ob= CTX_data_active_object(C);
+
uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_object_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
+#endif
- uiDefIconTextBlockBut(block, view3d_edit_object_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Clear/Apply", 0, yco-=20, 120, 19, "");
- // XXX uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
+ uiItemMenuF(layout, "Clear/Apply", 0, view3d_edit_object_transformmenu);
+ uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu);
+
+ uiItemS(layout);
+
+#if 0
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Linked|Alt D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiItemS(layout);
+#endif
+ uiItemO(layout, NULL, 0, "OBJECT_OT_duplicate");
+ uiItemBooleanO(layout, "Duplicate Linked", 0, "OBJECT_OT_duplicate", "linked", 1);
+ uiItemO(layout, NULL, 0, "OBJECT_OT_delete");
+
+#if 0
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Proxy|Ctrl Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelinksmenu, NULL, ICON_RIGHTARROW_THIN, "Make Links", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_singleusermenu, NULL, ICON_RIGHTARROW_THIN, "Make Single User", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_makelocalmenu, NULL, ICON_RIGHTARROW_THIN, "Make Local", 0, yco-=20, 120, 19, "");
uiDefIconTextBlockBut(block, view3d_edit_object_copyattrmenu, NULL, ICON_RIGHTARROW_THIN, "Copy Attributes", 0, yco-=20, 120, 19, "");
+#endif
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_object_parentmenu, NULL, ICON_RIGHTARROW_THIN, "Parent", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_trackmenu, NULL, ICON_RIGHTARROW_THIN, "Track", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_constraintsmenu, NULL, ICON_RIGHTARROW_THIN, "Constraints", 0, yco-=20, 120, 19, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiItemS(layout);
- if (OBACT && OBACT->type == OB_MESH) {
+ uiItemMenuF(layout, "Parent", 0, view3d_edit_object_parentmenu);
+ uiItemMenuF(layout, "Track", 0, view3d_edit_object_trackmenu);
+ uiItemMenuF(layout, "Group", 0, view3d_edit_object_groupmenu);
+ uiItemMenuF(layout, "Constraints", 0, view3d_edit_object_constraintsmenu);
+
+#if 0
+ uiItemS(layout);
+
+ if(ob && ob->type == OB_MESH) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Boolean Operation...|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
}
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Join Objects|Ctrl J", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Object Type...|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
+#endif
+
+ uiItemS(layout);
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
+#if 0
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move to Layer...|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBlockBut(block, view3d_edit_object_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Objects", 0, yco-=20, 120, 19, "");
+#endif
+
+ uiItemMenuF(layout, "Show/Hide", 0, view3d_edit_object_showhidemenu);
+#if 0
#ifndef DISABLE_PYTHON
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
#endif
-
- if(ar->alignment==RGN_ALIGN_TOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
+#endif
}
-
static void view3d_edit_mesh_verticesmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
uiItemO(layout, "Merge...", 0, "MESH_OT_merge");
@@ -4630,7 +4463,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
}
else {
xmax= GetButStringLength("Object");
- uiDefPulldownBut(block, view3d_edit_objectmenu, NULL, "Object", xco,yco, xmax-3, 20, "");
+ uiDefMenuBut(block, view3d_edit_objectmenu, NULL, "Object", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
}
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 70dde481018..112847272e5 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -203,10 +203,10 @@ void view3d_keymap(wmWindowManager *wm)
/* selection*/
WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
- RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
- RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0)->ptr, "type", 1);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0)->ptr, "deselect", 1);
WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index fedf3a30181..2537982210a 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -715,12 +715,6 @@ void view3d_lasso_select(bContext *C, ViewContext *vc, short mcords[][2], short
}
-static EnumPropertyItem lasso_select_types[] = {
- {0, "SELECT", 0, "Select", ""},
- {1, "DESELECT", 0, "Deselect", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
/* lasso operator gives properties, but since old code works
with short array we convert */
@@ -747,7 +741,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
/* setup view context for argument to callbacks */
view3d_set_viewcontext(C, &vc);
- select= RNA_enum_is_equal(op->ptr, "type", "SELECT");
+ select= !RNA_boolean_get(op->ptr, "deselect");
view3d_lasso_select(C, &vc, mcords, i, select);
return OPERATOR_FINISHED;
@@ -769,7 +763,7 @@ void VIEW3D_OT_select_lasso(wmOperatorType *ot)
ot->flag= OPTYPE_UNDO;
RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
- RNA_def_enum(ot->srna, "type", lasso_select_types, 0, "Type", "");
+ RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items.");
}
@@ -1528,11 +1522,6 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
/* *****************Selection Operators******************* */
-static EnumPropertyItem prop_select_types[] = {
- {0, "EXCLUSIVE", 0, "Exclusive", ""},
- {1, "EXTEND", 0, "Extend", ""},
- {0, NULL, 0, NULL, NULL}
-};
/* ****** Border Select ****** */
void VIEW3D_OT_select_border(wmOperatorType *ot)
@@ -1558,7 +1547,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
- RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", "");
+ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everyting first.");
}
/* ****** Mouse Select ****** */
@@ -1567,7 +1556,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *obedit= CTX_data_edit_object(C);
- short extend= RNA_enum_is_equal(op->ptr, "type", "EXTEND");
+ short extend= RNA_boolean_get(op->ptr, "extend");
view3d_operator_needs_opengl(C);
@@ -1605,7 +1594,7 @@ void VIEW3D_OT_select(wmOperatorType *ot)
ot->flag= OPTYPE_UNDO;
/* properties */
- RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", "");
+ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everyting first.");
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index d77f38967b0..ee4f1b90451 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -109,10 +109,6 @@ TransformModeItem transform_modes[] =
static int select_orientation_exec(bContext *C, wmOperator *op)
{
int orientation = RNA_enum_get(op->ptr, "orientation");
- int custom_index= RNA_int_get(op->ptr, "custom_index");;
-
- if(orientation == V3D_MANIP_CUSTOM)
- orientation += custom_index;
BIF_selectTransformOrientationValue(C, orientation);
@@ -126,20 +122,26 @@ static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event
pup= uiPupMenuBegin(C, "Orientation", 0);
layout= uiPupMenuLayout(pup);
- BIF_menuTransformOrientation(C, layout, NULL);
+ uiItemsEnumO(layout, "TFM_OT_select_orientation", "orientation");
uiPupMenuEnd(C, pup);
return OPERATOR_CANCELLED;
}
+static EnumPropertyItem *select_orientation_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ *free= 1;
+ return BIF_enumTransformOrientation(C);
+}
+
void TFM_OT_select_orientation(struct wmOperatorType *ot)
{
+ PropertyRNA *prop;
static EnumPropertyItem orientation_items[]= {
{V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""},
{V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""},
{V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""},
{V3D_MANIP_VIEW, "VIEW", 0, "View", ""},
- {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", ""},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
@@ -151,8 +153,8 @@ void TFM_OT_select_orientation(struct wmOperatorType *ot)
ot->exec = select_orientation_exec;
ot->poll = ED_operator_areaactive;
- RNA_def_enum(ot->srna, "orientation", orientation_items, V3D_MANIP_CUSTOM, "Orientation", "DOC_BROKEN");
- RNA_def_int(ot->srna, "custom_index", 0, 0, INT_MAX, "Custom Index", "", 0, INT_MAX);
+ prop= RNA_def_enum(ot->srna, "orientation", orientation_items, V3D_MANIP_GLOBAL, "Orientation", "DOC_BROKEN");
+ RNA_def_enum_funcs(prop, select_orientation_itemf);
}
static void transformops_exit(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 1e065de94e1..f3b373f0e48 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -59,6 +59,8 @@
#include "UI_interface.h"
+#include "RNA_define.h"
+
#include "transform.h"
/* *********************** TransSpace ************************** */
@@ -354,19 +356,37 @@ void BIF_selectTransformOrientationValue(bContext *C, int orientation) {
v3d->twmode = orientation;
}
-void BIF_menuTransformOrientation(bContext *C, uiLayout *layout, void *arg)
+EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
{
ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
- TransformOrientation *ts;
- int i= V3D_MANIP_CUSTOM;
+ TransformOrientation *ts = transform_spaces->first;
+ EnumPropertyItem global = {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""};
+ EnumPropertyItem normal = {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""};
+ EnumPropertyItem local = {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""};
+ EnumPropertyItem view = {V3D_MANIP_VIEW, "VIEW", 0, "View", ""};
+ EnumPropertyItem sepr = {0, "", 0, NULL, NULL};
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ EnumPropertyItem *item= NULL;
+ int i = V3D_MANIP_CUSTOM, totitem= 0;
+
+ RNA_enum_item_add(&item, &totitem, &global);
+ RNA_enum_item_add(&item, &totitem, &normal);
+ RNA_enum_item_add(&item, &totitem, &local);
+ RNA_enum_item_add(&item, &totitem, &view);
+
+ if(ts)
+ RNA_enum_item_add(&item, &totitem, &sepr);
+
+ for(; ts; ts = ts->next) {
+ tmp.identifier = "CUSTOM";
+ tmp.name= ts->name;
+ tmp.value = i++;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_GLOBAL);
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_LOCAL);
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_NORMAL);
- uiItemEnumO(layout, NULL, 0, "TFM_OT_select_orientation", "orientation", V3D_MANIP_VIEW);
+ RNA_enum_item_end(&item, &totitem);
- for(ts = transform_spaces->first; ts; ts = ts->next)
- uiItemIntO(layout, ts->name, 0, "TFM_OT_select_orientation", "custom_index", i++);
+ return item;
}
char * BIF_menustringTransformOrientation(const bContext *C, char *title) {
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 371b0d75951..65e4be1173d 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -87,6 +87,9 @@ typedef struct Image {
struct PackedFile * packedfile;
struct PreviewImage * preview;
+ /* not saved in file, statistics for render result */
+ char *render_text;
+
float lastupdate;
int lastused;
short animspeed;
@@ -120,5 +123,9 @@ typedef struct Image {
/* ima->type and ima->source moved to BKE_image.h, for API */
+/* render_text maxlen */
+#define IMA_RW_MAXTEXT 512
+
+
#endif
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 6355e02a5e0..c71aa81147d 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -218,7 +218,12 @@ typedef struct RenderData {
short bufflag;
short quality;
- short rpad, rpad1, rpad2;
+ /**
+ * Render to image editor, fullscreen or to new window.
+ */
+ short displaymode;
+
+ short rpad1, rpad2;
/**
* Flags for render settings. Use bit-masking to access the settings.
@@ -652,6 +657,12 @@ typedef struct Scene {
#define R_TOUCH 0x800000 /* touch files before rendering */
#define R_SIMPLIFY 0x1000000
+/* displaymode */
+
+#define R_OUTPUT_SCREEN 0
+#define R_OUTPUT_AREA 1
+#define R_OUTPUT_WINDOW 2
+#define R_OUTPUT_FORKED 3
/* filtertype */
#define R_FILTER_BOX 0
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 771a7e43793..0709d2d58b0 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -66,9 +66,8 @@ typedef struct uiFont {
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. */
- short overlap; /* check overlaped characters. */
- short pad;
+ short kerning; /* unfitted or default kerning value. */
+ char pad[6];
short italic, bold; /* style hint */
short shadow; /* value is amount of pixels blur */
short shadx, shady; /* shadow offset in pixels */
@@ -95,6 +94,8 @@ typedef struct uiStyle {
uiFontStyle widgetlabel;
uiFontStyle widget;
+ float panelzoom;
+
short minlabelchars; /* in characters */
short minwidgetchars; /* in characters */
@@ -106,7 +107,7 @@ typedef struct uiStyle {
short panelspace;
short panelouter;
- short pad[3];
+ short pad[1];
} uiStyle;
typedef struct uiWidgetColors {
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 55084d7537c..3631d83310a 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -503,6 +503,7 @@ int RNA_struct_ui_icon(StructRNA *type);
PropertyRNA *RNA_struct_name_property(StructRNA *type);
PropertyRNA *RNA_struct_iterator_property(StructRNA *type);
+StructRNA *RNA_struct_base(StructRNA *type);
int RNA_struct_is_ID(StructRNA *type);
int RNA_struct_is_a(StructRNA *type, StructRNA *srna);
@@ -554,12 +555,12 @@ void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin,
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax);
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision);
-int RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **identifier);
-int RNA_enum_name(const EnumPropertyItem *item, const int value, const char **name);
+int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier);
+int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name);
-void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem);
-int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value);
-int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier);
+void RNA_property_enum_items(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free);
+int RNA_property_enum_value(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value);
+int RNA_property_enum_identifier(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier);
StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop);
@@ -683,11 +684,11 @@ void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name);
void RNA_enum_set(PointerRNA *ptr, const char *name, int value);
-int RNA_enum_is_equal(PointerRNA *ptr, const char *name, const char *enumname);
+int RNA_enum_is_equal(struct bContext *C, PointerRNA *ptr, const char *name, const char *enumname);
/* lower level functions that donr use a PointerRNA */
-int RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *value);
-int RNA_enum_id_from_value(const EnumPropertyItem *item, int value, const char **identifier);
+int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value);
+int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier);
void RNA_string_get(PointerRNA *ptr, const char *name, char *value);
char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen);
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 69f5b5adc37..a3fa97bf4b1 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -160,6 +160,13 @@ void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret);
void RNA_def_function_flag(FunctionRNA *func, int flag);
void RNA_def_function_ui_description(FunctionRNA *func, const char *description);
+/* Dynamic Enums
+ * strings are not freed, assumed pointing to static location. */
+
+void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item);
+void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item);
+void RNA_enum_item_end(EnumPropertyItem **items, int *totitem);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 98646acd727..dc2a2a1a1de 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -157,7 +157,7 @@ typedef struct EnumPropertyItem {
const char *description;
} EnumPropertyItem;
-typedef EnumPropertyItem *(*EnumPropertyItemFunc)(PointerRNA *ptr);
+typedef EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, int *free);
typedef struct PropertyRNA PropertyRNA;
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index fe4a809c638..61a8f8a29e9 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -119,6 +119,11 @@ static void rna_print_c_string(FILE *f, const char *str)
static char *escape[] = {"\''", "\"\"", "\??", "\\\\","\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", NULL};
int i, j;
+ if(!str) {
+ fprintf(f, "NULL");
+ return;
+ }
+
fprintf(f, "\"");
for(i=0; str[i]; i++) {
for(j=0; escape[j]; j++)
@@ -262,7 +267,8 @@ static int rna_enum_bitmask(PropertyRNA *prop)
if(eprop->item) {
for(a=0; a<eprop->totitem; a++)
- mask |= eprop->item[a].value;
+ if(eprop->item[a].identifier[0])
+ mask |= eprop->item[a].value;
}
return mask;
@@ -971,7 +977,8 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
fprintf(f, "enum {\n");
for(i=0; i<eprop->totitem; i++)
- fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier, eprop->item[i].identifier, eprop->item[i].value);
+ if(eprop->item[i].identifier[0])
+ fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier, eprop->item[i].identifier, eprop->item[i].value);
fprintf(f, "};\n\n");
}
@@ -1059,7 +1066,8 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
fprintf(f, "\tenum %s_enum {\n", prop->identifier);
for(i=0; i<eprop->totitem; i++)
- fprintf(f, "\t\t%s_%s = %d,\n", prop->identifier, eprop->item[i].identifier, eprop->item[i].value);
+ if(eprop->item[i].identifier[0])
+ fprintf(f, "\t\t%s_%s = %d,\n", prop->identifier, eprop->item[i].identifier, eprop->item[i].value);
fprintf(f, "\t};\n");
}
@@ -1577,8 +1585,9 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_print_c_string(f, eprop->item[i].name); fprintf(f, ", ");
rna_print_c_string(f, eprop->item[i].description); fprintf(f, "}, ");
- if(eprop->defaultvalue == eprop->item[i].value)
- defaultfound= 1;
+ if(eprop->item[i].identifier[0])
+ if(eprop->defaultvalue == eprop->item[i].value)
+ defaultfound= 1;
}
fprintf(f, "{0, NULL, 0, NULL, NULL}};\n\n");
@@ -1588,7 +1597,6 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
DefRNA.error= 1;
}
}
- else if(eprop->itemf);
else {
fprintf(stderr, "rna_generate_structs: %s%s.%s, enum must have items defined.\n", srna->identifier, errnest, prop->identifier);
DefRNA.error= 1;
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index cc8704dc350..f20df81d6ad 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -392,6 +392,11 @@ PropertyRNA *RNA_struct_iterator_property(StructRNA *type)
return type->iteratorproperty;
}
+StructRNA *RNA_struct_base(StructRNA *type)
+{
+ return type->base;
+}
+
int RNA_struct_is_ID(StructRNA *type)
{
return (type->flag & STRUCT_ID) != 0;
@@ -635,17 +640,19 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
return &RNA_UnknownType;
}
-void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem)
+void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free)
{
EnumPropertyRNA *eprop= (EnumPropertyRNA*)rna_ensure_property(prop);
int tot;
- if(eprop->itemf) {
- *item= eprop->itemf(ptr);
- if(totitem) {
+ *free= 0;
+
+ if(C && eprop->itemf) {
+ *item= eprop->itemf(C, ptr, free);
+
+ if(totitem)
for(tot=0; (*item)[tot].identifier; tot++);
- *totitem= tot;
- }
+ *totitem= tot;
}
else {
*item= eprop->item;
@@ -654,26 +661,30 @@ void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPrope
}
}
-int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value)
+int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value)
{
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
+ int free;
- RNA_property_enum_items(ptr, prop, &item, NULL);
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
for(; item->identifier; item++) {
- if(strcmp(item->identifier, identifier)==0) {
+ if(item->identifier[0] && strcmp(item->identifier, identifier)==0) {
*value = item->value;
return 1;
}
}
+ if(free)
+ MEM_freeN(item);
+
return 0;
}
-int RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **identifier)
+int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier)
{
for (; item->identifier; item++) {
- if(item->value==value) {
+ if(item->identifier[0] && item->value==value) {
*identifier = item->identifier;
return 1;
}
@@ -681,10 +692,10 @@ int RNA_enum_identifier(const EnumPropertyItem *item, const int value, const cha
return 0;
}
-int RNA_enum_name(const EnumPropertyItem *item, const int value, const char **name)
+int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name)
{
for (; item->identifier; item++) {
- if(item->value==value) {
+ if(item->identifier[0] && item->value==value) {
*name = item->name;
return 1;
}
@@ -692,12 +703,17 @@ int RNA_enum_name(const EnumPropertyItem *item, const int value, const char **na
return 0;
}
-int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
+int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
{
- const EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item= NULL;
+ int result, free;
- RNA_property_enum_items(ptr, prop, &item, NULL);
- return RNA_enum_identifier(item, value, identifier);
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ result= RNA_enum_identifier(item, value, identifier);
+ if(free)
+ MEM_freeN(item);
+
+ return result;
}
const char *RNA_property_ui_name(PropertyRNA *prop)
@@ -2379,18 +2395,22 @@ void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
printf("RNA_enum_set: %s.%s not found.\n", ptr->type->identifier, name);
}
-int RNA_enum_is_equal(PointerRNA *ptr, const char *name, const char *enumname)
+int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname)
{
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
+ int free;
if(prop) {
- RNA_property_enum_items(ptr, prop, &item, NULL);
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
for(; item->identifier; item++)
if(strcmp(item->identifier, enumname) == 0)
return (item->value == RNA_property_enum_get(ptr, prop));
+ if(free)
+ MEM_freeN(item);
+
printf("RNA_enum_is_equal: %s.%s item %s not found.\n", ptr->type->identifier, name, enumname);
return 0;
}
@@ -2400,7 +2420,7 @@ int RNA_enum_is_equal(PointerRNA *ptr, const char *name, const char *enumname)
}
}
-int RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *value)
+int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value)
{
for( ; item->identifier; item++) {
if(strcmp(item->identifier, identifier)==0) {
@@ -2412,7 +2432,7 @@ int RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier,
return 0;
}
-int RNA_enum_id_from_value(const EnumPropertyItem *item, int value, const char **identifier)
+int RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier)
{
for( ; item->identifier; item++) {
if(item->value==value) {
@@ -2654,7 +2674,7 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
const char *identifier;
int val = RNA_property_enum_get(ptr, prop);
- if(RNA_property_enum_identifier(ptr, prop, val, &identifier)) {
+ if(RNA_property_enum_identifier(NULL, ptr, prop, val, &identifier)) {
BLI_dynstr_appendf(dynstr, "'%s'", identifier);
}
else {
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 2a5df8f1488..56c0ca1b491 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -38,36 +38,47 @@
EnumPropertyItem constraint_type_items[] ={
{CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", 0, "Child Of", ""},
{CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", 0, "Transformation", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", 0, "Copy Location", ""},
{CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", 0, "Copy Rotation", ""},
{CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", 0, "Copy Scale", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", 0, "Limit Location", ""},
{CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", 0, "Limit Rotation", ""},
{CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", 0, "Limit Scale", ""},
{CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", 0, "Limit Distance", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", 0, "Track To", ""},
{CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", 0, "Locked Track", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_MINMAX, "FLOOR", 0, "Floor", ""},
{CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", 0, "Shrinkwrap", ""},
{CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", 0, "Follow Path", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", 0, "Clamp To", ""},
{CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", 0, "Stretch To", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_KINEMATIC, "IK", 0, "IK", ""},
{CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", 0, "Rigid Body Joint", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_ACTION, "ACTION", 0, "Action", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_PYTHON, "SCRIPT", 0, "Script", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_NULL, "NULL", 0, "Null", ""},
{0, NULL, 0, NULL, NULL}};
+EnumPropertyItem space_pchan_items[] = {
+ {0, "WORLD", 0, "World Space", ""},
+ {2, "POSE", 0, "Pose Space", ""},
+ {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", ""},
+ {1, "LOCAL", 0, "Local Space", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem space_object_items[] = {
+ {0, "WORLD", 0, "World Space", ""},
+ {1, "LOCAL", 0, "Local (Without Parent) Space", ""},
+ {0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -166,19 +177,7 @@ static void rna_Constraint_influence_update(bContext *C, PointerRNA *ptr)
rna_Constraint_update(C, ptr);
}
-static EnumPropertyItem space_pchan_items[] = {
- {0, "WORLD", 0, "World Space", ""},
- {2, "POSE", 0, "Pose Space", ""},
- {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", ""},
- {1, "LOCAL", 0, "Local Space", ""},
- {0, NULL, 0, NULL, NULL}};
-
-static EnumPropertyItem space_object_items[] = {
- {0, "WORLD", 0, "World Space", ""},
- {1, "LOCAL", 0, "Local (Without Parent) Space", ""},
- {0, NULL, 0, NULL, NULL}};
-
-static EnumPropertyItem *rna_Constraint_owner_space_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *C, PointerRNA *ptr, int *free)
{
Object *ob= (Object*)ptr->id.data;
bConstraint *con= (bConstraint*)ptr->data;
@@ -189,7 +188,7 @@ static EnumPropertyItem *rna_Constraint_owner_space_itemf(PointerRNA *ptr)
return space_object_items;
}
-static EnumPropertyItem *rna_Constraint_target_space_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *C, PointerRNA *ptr, int *free)
{
bConstraint *con= (bConstraint*)ptr->data;
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -1505,11 +1504,13 @@ void RNA_def_constraint(BlenderRNA *brna)
prop= RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "ownspace");
+ RNA_def_property_enum_items(prop, space_pchan_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in.");
prop= RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "tarspace");
+ RNA_def_property_enum_items(prop, space_pchan_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in.");
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 2916c1bcb6e..07515d3ad56 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1112,12 +1112,12 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item
switch(prop->type) {
case PROP_ENUM: {
EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
- eprop->item= item;
+ eprop->item= (EnumPropertyItem*)item;
eprop->totitem= 0;
for(i=0; item[i].identifier; i++) {
eprop->totitem++;
- if(item[i].value == eprop->defaultvalue)
+ if(item[i].identifier[0] && item[i].value == eprop->defaultvalue)
defaultfound= 1;
}
@@ -1280,7 +1280,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value)
eprop->defaultvalue= value;
for(i=0; i<eprop->totitem; i++) {
- if(eprop->item[i].value == eprop->defaultvalue)
+ if(eprop->item[i].identifier[0] && eprop->item[i].value == eprop->defaultvalue)
defaultfound= 1;
}
@@ -2262,3 +2262,37 @@ int rna_parameter_size(PropertyRNA *parm)
return sizeof(void *);
}
+/* Dynamic Enums */
+
+void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item)
+{
+ EnumPropertyItem *newitems;
+ int tot= *totitem;
+
+ if(tot == 0) {
+ *items= MEM_callocN(sizeof(EnumPropertyItem)*8, "RNA_enum_items_add");
+ }
+ else if(tot >= 8 && (tot&(tot-1)) == 0){
+ /* power of two > 8 */
+ newitems= MEM_callocN(sizeof(EnumPropertyItem)*tot*2, "RNA_enum_items_add");
+ memcpy(newitems, *items, sizeof(EnumPropertyItem)*tot);
+ MEM_freeN(*items);
+ *items= newitems;
+ }
+
+ (*items)[tot]= *item;
+ *totitem= tot+1;
+}
+
+void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item)
+{
+ for(; item->identifier; item++)
+ RNA_enum_item_add(items, totitem, item);
+}
+
+void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
+{
+ static EnumPropertyItem empty = {0, NULL, 0, NULL, NULL};
+ RNA_enum_item_add(items, totitem, &empty);
+}
+
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 401b430ebc9..b63e347e165 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -68,7 +68,7 @@ typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr);
typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value);
typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr);
typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value);
-typedef EnumPropertyItem *(*PropEnumItemFunc)(struct PointerRNA *ptr);
+typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr, int *free);
typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr);
typedef StructRNA* (*PropPointerTypeFunc)(struct PointerRNA *ptr);
typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value);
@@ -225,7 +225,7 @@ typedef struct EnumPropertyRNA {
PropEnumSetFunc set;
PropEnumItemFunc itemf;
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
int totitem;
int defaultvalue;
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 4e095cb74a3..98ed12afd5a 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -40,6 +40,57 @@
#include "WM_types.h"
#include "WM_api.h"
+EnumPropertyItem part_from_items[] = {
+ {PART_FROM_VERT, "VERT", 0, "Verts", ""},
+ {PART_FROM_FACE, "FACE", 0, "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem part_reactor_from_items[] = {
+ {PART_FROM_VERT, "VERT", 0, "Verts", ""},
+ {PART_FROM_FACE, "FACE", 0, "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
+ {PART_FROM_PARTICLE, "PARTICLE", 0, "Particle", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem part_draw_as_items[] = {
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
+ {PART_DRAW_DOT, "DOT", 0, "Point", ""},
+ {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
+ {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
+ {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem part_hair_draw_as_items[] = {
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem part_ren_as_items[] = {
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
+ {PART_DRAW_LINE, "LINE", 0, "Line", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
+ {PART_DRAW_GR, "GROUP", 0, "Group", ""},
+ {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem part_hair_ren_as_items[] = {
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
+ {PART_DRAW_GR, "GROUP", 0, "Group", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
#include "BKE_context.h"
@@ -248,85 +299,34 @@ static void rna_ParticleSystem_name_get(PointerRNA *ptr, char *str)
strcpy(str, "");
}
-static EnumPropertyItem from_items[] = {
- {PART_FROM_VERT, "VERT", 0, "Vertexes", ""},
- {PART_FROM_FACE, "FACE", 0, "Faces", ""},
- {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-static EnumPropertyItem reactor_from_items[] = {
- {PART_FROM_VERT, "VERT", 0, "Vertexes", ""},
- {PART_FROM_FACE, "FACE", 0, "Faces", ""},
- {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
- {PART_FROM_PARTICLE, "PARTICLE", 0, "Particle", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-static EnumPropertyItem *rna_Particle_from_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_Particle_from_itemf(bContext *C, PointerRNA *ptr, int *free)
{
ParticleSettings *part = ptr->id.data;
if(part->type==PART_REACTOR)
- return reactor_from_items;
+ return part_reactor_from_items;
else
- return from_items;
+ return part_from_items;
}
-static EnumPropertyItem draw_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
- {PART_DRAW_DOT, "DOT", 0, "Point", ""},
- {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
- {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
- {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-static EnumPropertyItem hair_draw_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
- {PART_DRAW_PATH, "PATH", 0, "Path", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-static EnumPropertyItem ren_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
- {PART_DRAW_LINE, "LINE", 0, "Line", ""},
- {PART_DRAW_PATH, "PATH", 0, "Path", ""},
- {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
- {PART_DRAW_GR, "GROUP", 0, "Group", ""},
- {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-static EnumPropertyItem hair_ren_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_PATH, "PATH", 0, "Path", ""},
- {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
- {PART_DRAW_GR, "GROUP", 0, "Group", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-static EnumPropertyItem *rna_Particle_draw_as_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *C, PointerRNA *ptr, int *free)
{
ParticleSettings *part = ptr->id.data;
if(part->type==PART_HAIR)
- return hair_draw_as_items;
+ return part_hair_draw_as_items;
else
- return draw_as_items;
+ return part_draw_as_items;
}
-static EnumPropertyItem *rna_Particle_ren_as_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *C, PointerRNA *ptr, int *free)
{
ParticleSettings *part = ptr->id.data;
if(part->type==PART_HAIR)
- return hair_ren_as_items;
+ return part_hair_ren_as_items;
else
- return ren_as_items;
+ return part_ren_as_items;
}
@@ -801,6 +801,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "from");
+ RNA_def_property_enum_items(prop, part_reactor_from_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
@@ -914,12 +915,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "draw_as", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "draw_as");
+ RNA_def_property_enum_items(prop, part_draw_as_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "ren_as", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "ren_as");
+ RNA_def_property_enum_items(prop, part_ren_as_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 557d472afef..0b605db20cf 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -516,6 +516,13 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr)
return ((StringPropertyRNA*)prop)->maxlength;
}
+static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data)
+{
+ EnumPropertyItem *item= (EnumPropertyItem*)data;
+
+ return (item->identifier[0] != 0);
+}
+
static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -524,7 +531,7 @@ static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, Point
rna_idproperty_check(&prop, ptr);
eprop= (EnumPropertyRNA*)prop;
- rna_iterator_array_begin(iter, (void*)eprop->item, sizeof(eprop->item[0]), eprop->totitem, NULL);
+ rna_iterator_array_begin(iter, (void*)eprop->item, sizeof(eprop->item[0]), eprop->totitem, rna_enum_check_separator);
}
static void rna_EnumPropertyItem_identifier_get(PointerRNA *ptr, char *value)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 8946530a372..6e2a6e27928 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -283,7 +283,13 @@ void rna_def_scene_render_data(BlenderRNA *brna)
{R_PLANES24, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
{R_PLANES32, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
{0, NULL, 0, NULL, NULL}};
-
+
+ static EnumPropertyItem display_mode_items[] ={
+ {R_OUTPUT_SCREEN, "SCREEN", 0, "Full Screen", "Images are rendered in full Screen"},
+ {R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in Image Editor"},
+ {R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in new Window"},
+ {0, NULL, 0, NULL, NULL}};
+
static EnumPropertyItem octree_resolution_items[] = {
{64, "OCTREE_RES_64", 0, "64", ""},
{128, "OCTREE_RES_128", 0, "128", ""},
@@ -841,6 +847,11 @@ void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Back Buffer", "Render backbuffer image");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "displaymode");
+ RNA_def_property_enum_items(prop, display_mode_items);
+ RNA_def_property_ui_text(prop, "Display", "Select where rendered images will be displayed");
+
prop= RNA_def_property(srna, "output_path", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "pic");
RNA_def_property_ui_text(prop, "Output Path", "Directory/name to save animations, # characters defines the position and length of frame numbers.");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index ded954bf563..9bf3f54e159 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -173,7 +173,7 @@ static EnumPropertyItem dc_rgb_items[] = {DC_RGB, DC_LCMS, DC_ZERO};
static EnumPropertyItem dc_alpha_items[] = {DC_RGB, DC_RGBA, DC_ALPHA, DC_LCMS, DC_ZERO};
static EnumPropertyItem dc_z_items[] = {DC_RGB, DC_Z, DC_LCMS, DC_ZERO};
-static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, PointerRNA *ptr, int *free)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
ImBuf *ibuf= ED_space_image_buffer(sima);
@@ -800,8 +800,8 @@ static void rna_def_space_text(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem font_size_items[] = {
- {12, "SCREEN_12", 0, "Screen 12", ""},
- {15, "SCREEN_15", 0, "Screen 15", ""},
+ {12, "12", 0, "12", ""},
+ {15, "15", 0, "15", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "SpaceTextEditor", "Space");
@@ -813,7 +813,7 @@ static void rna_def_space_text(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space.");
RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL);
- RNA_def_property_update(prop, NC_TEXT|NA_EDITED, NULL);
+ RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
/* display */
prop= RNA_def_property(srna, "syntax_highlight", PROP_BOOLEAN, PROP_NONE);
@@ -1004,6 +1004,21 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
srna= RNA_def_struct(brna, "FileSelectParams", NULL);
RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters.");
+ prop= RNA_def_property(srna, "title", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "title");
+ RNA_def_property_ui_text(prop, "Title", "Title for the file browser.");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "dir");
+ RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser.");
+ RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL);
+
+ prop= RNA_def_property(srna, "file", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "file");
+ RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser.");
+ RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL);
+
prop= RNA_def_property(srna, "display", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "display");
RNA_def_property_enum_items(prop, file_display_items);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 9da8c8b2df3..b10ca6c5e83 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -170,6 +170,8 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi
if(strcmp(pt->idname, dummypt.idname) == 0) {
if(pt->py_srna)
rna_Panel_unregister(C, pt->py_srna);
+ else
+ BLI_freelinkN(&art->paneltypes, pt);
break;
}
}
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 609082144e1..977c43e6b95 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -128,6 +128,11 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static EnumPropertyItem font_kerning_style[] = {
+ {0, "UNFITTED", 0, "Unfitted", "Use scaled but un-grid-fitted kerning distances."},
+ {1, "DEFAULT", 0, "Default", "Use scaled and grid-fitted kerning distances."},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "ThemeFontStyle", NULL);
RNA_def_struct_sdna(srna, "uiFontStyle");
RNA_def_struct_ui_text(srna, "Font Style", "Theme settings for Font.");
@@ -137,14 +142,10 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Points", "");
RNA_def_property_update(prop, NC_WINDOW, NULL);
- 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", "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");
+ prop= RNA_def_property(srna, "font_kerning_style", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "kerning");
+ RNA_def_property_enum_items(prop, font_kerning_style);
+ RNA_def_property_ui_text(prop, "Kerning Style", "Which style to use for font kerning.");
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "shadow", PROP_INT, PROP_NONE);
@@ -184,6 +185,10 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "uiStyle");
RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets.");
+ prop= RNA_def_property(srna, "panelzoom", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.5, 2.0);
+ RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas.");
+
prop= RNA_def_property(srna, "paneltitle", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
RNA_def_property_struct_type(prop, "ThemeFontStyle");
diff --git a/source/blender/python/generic/Mathutils.h b/source/blender/python/generic/Mathutils.h
index 6a4e28d6068..5bdd9d9cfe0 100644
--- a/source/blender/python/generic/Mathutils.h
+++ b/source/blender/python/generic/Mathutils.h
@@ -85,6 +85,13 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
#endif
typedef struct Mathutils_Callback Mathutils_Callback;
+
+typedef int (*BaseMathCheckFunc)(PyObject *);
+typedef int (*BaseMathGetFunc)(PyObject *, int, float *);
+typedef int (*BaseMathSetFunc)(PyObject *, int, float *);
+typedef int (*BaseMathGetIndexFunc)(PyObject *, int, float *, int);
+typedef int (*BaseMathSetIndexFunc)(PyObject *, int, float *, int);
+
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 */
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index bf2f41389cc..49bca247431 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -94,13 +94,14 @@ static int mathutils_rna_vector_set_index(BPy_PropertyRNA *self, int subtype, fl
}
Mathutils_Callback mathutils_rna_array_cb = {
- mathutils_rna_generic_check,
- mathutils_rna_vector_get,
- mathutils_rna_vector_set,
- mathutils_rna_vector_get_index,
- mathutils_rna_vector_set_index
+ (BaseMathCheckFunc) mathutils_rna_generic_check,
+ (BaseMathGetFunc) mathutils_rna_vector_get,
+ (BaseMathSetFunc) mathutils_rna_vector_set,
+ (BaseMathGetIndexFunc) mathutils_rna_vector_get_index,
+ (BaseMathSetIndexFunc) mathutils_rna_vector_set_index
};
+
/* bpyrna matrix callbacks */
static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
@@ -123,11 +124,11 @@ static int mathutils_rna_matrix_set(BPy_PropertyRNA *self, int subtype, float *m
}
Mathutils_Callback mathutils_rna_matrix_cb = {
- mathutils_rna_generic_check,
- mathutils_rna_matrix_get,
- mathutils_rna_matrix_set,
- NULL,
- NULL
+ (BaseMathCheckFunc) mathutils_rna_generic_check,
+ (BaseMathGetFunc) mathutils_rna_matrix_get,
+ (BaseMathSetFunc) mathutils_rna_matrix_set,
+ (BaseMathGetIndexFunc) NULL,
+ (BaseMathSetIndexFunc) NULL
};
#endif
@@ -222,10 +223,16 @@ static void pyrna_struct_dealloc( BPy_StructRNA * self )
static char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
{
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
+ char *result;
+ int free;
+
+ RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
+ result= (char*)BPy_enum_as_string(item);
+ if(free)
+ MEM_freeN(item);
- RNA_property_enum_items(ptr, prop, &item, NULL);
- return (char*)BPy_enum_as_string((EnumPropertyItem*)item);
+ return result;
}
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
@@ -308,14 +315,15 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
const char *identifier;
int val = RNA_property_enum_get(ptr, prop);
- if (RNA_property_enum_identifier(ptr, prop, val, &identifier)) {
+ if (RNA_property_enum_identifier(BPy_GetContext(), ptr, prop, val, &identifier)) {
ret = PyUnicode_FromString( identifier );
} else {
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
+ int free;
/* don't throw error here, can't trust blender 100% to give the
* right values, python code should not generate error for that */
- RNA_property_enum_items(ptr, prop, &item, NULL);
+ RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
if(item->identifier) {
ret = PyUnicode_FromString( item->identifier );
}
@@ -328,6 +336,9 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
ret = PyUnicode_FromString( "" );
}
+ if(free)
+ MEM_freeN(item);
+
/*PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val);
ret = NULL;*/
}
@@ -625,7 +636,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
return -1;
} else {
int val;
- if (RNA_property_enum_value(ptr, prop, param, &val)) {
+ if (RNA_property_enum_value(BPy_GetContext(), ptr, prop, param, &val)) {
if(data) *((int*)data)= val;
else RNA_property_enum_set(ptr, prop, val);
} else {
@@ -1817,19 +1828,23 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
const char *identifier;
int val = *(int*)data;
- if (RNA_property_enum_identifier(ptr, prop, val, &identifier)) {
+ if (RNA_property_enum_identifier(BPy_GetContext(), ptr, prop, val, &identifier)) {
ret = PyUnicode_FromString( identifier );
} else {
- const EnumPropertyItem *item;
+ EnumPropertyItem *item;
+ int free;
/* don't throw error here, can't trust blender 100% to give the
* right values, python code should not generate error for that */
- RNA_property_enum_items(ptr, prop, &item, NULL);
+ RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
if(item[0].identifier)
ret = PyUnicode_FromString( item[0].identifier );
else
ret = PyUnicode_FromString( "" );
+ if(free)
+ MEM_freeN(item);
+
/*PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val);
ret = NULL;*/
}
@@ -2172,43 +2187,52 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
/* done with rna instance */
}
-PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
+PyObject* pyrna_srna_Subtype(StructRNA *srna)
{
PyObject *newclass = NULL;
- PropertyRNA *nameprop;
- if (ptr->type==NULL) {
+ if (srna == NULL) {
newclass= NULL; /* Nothing to do */
- } else if ((newclass= RNA_struct_py_type_get(ptr->data))) {
+ } else if ((newclass= RNA_struct_py_type_get(srna))) {
Py_INCREF(newclass);
- } else if ((nameprop = RNA_struct_name_property(ptr->type))) {
+ } else {
+ StructRNA *base;
+
/* for now, return the base RNA type rather then a real module */
- /* Assume RNA_struct_py_type_get(ptr->data) was alredy checked */
+ /* Assume RNA_struct_py_type_get(srna) was alredy checked */
/* subclass equivelents
- class myClass(myBase):
some='value' # or ...
- - myClass = type(name='myClass', bases=(myBase,), dict={'some':'value'})
+ - myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
*/
- char name[256], *nameptr;
- const char *descr= RNA_struct_ui_description(ptr->type);
+ const char *descr= RNA_struct_ui_description(srna);
PyObject *args = PyTuple_New(3);
PyObject *bases = PyTuple_New(1);
+ PyObject *py_base= NULL;
PyObject *dict = PyDict_New();
PyObject *item;
-
-
- nameptr= RNA_property_string_get_alloc(ptr, nameprop, name, sizeof(name));
+
// arg 1
//PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(tp_name));
- PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(nameptr));
+ PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(RNA_struct_identifier(srna)));
// arg 2
- PyTuple_SET_ITEM(bases, 0, (PyObject *)&pyrna_struct_Type);
- Py_INCREF(&pyrna_struct_Type);
+ base= RNA_struct_base(srna);
+ if(base && base != srna) {
+ /*/printf("debug subtype %s %p\n", RNA_struct_identifier(srna), srna); */
+ py_base= pyrna_srna_Subtype(base);
+ }
+
+ if(py_base==NULL) {
+ py_base= (PyObject *)&pyrna_struct_Type;
+ Py_INCREF(py_base);
+ }
+
+ PyTuple_SET_ITEM(bases, 0, py_base);
PyTuple_SET_ITEM(args, 1, bases);
@@ -2219,6 +2243,13 @@ PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
Py_DECREF(item);
}
+ /* this isnt needed however its confusing if we get python script names in blender types,
+ * because the __module__ is used when printing the class */
+ item= PyUnicode_FromString("bpy.types"); /* just to know its an internal type */
+ PyDict_SetItemString(dict, "__module__", item);
+ Py_DECREF(item);
+
+
PyTuple_SET_ITEM(args, 2, dict); // fill with useful subclass things!
if (PyErr_Occurred()) {
@@ -2229,16 +2260,25 @@ PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
newclass = PyObject_CallObject((PyObject *)&PyType_Type, args);
Py_DECREF(args);
- if (newclass)
- pyrna_subtype_set_rna(newclass, ptr->data);
-
- if (name != nameptr)
- MEM_freeN(nameptr);
+ if (newclass) {
+ pyrna_subtype_set_rna(newclass, srna);
+ // PyObSpit("NewStructRNA Type: ", (PyObject *)newclass);
+ }
+ else {
+ /* this should not happen */
+ PyErr_Print();
+ PyErr_Clear();
+ }
}
return newclass;
}
+PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
+{
+ return pyrna_srna_Subtype((ptr->type == &RNA_Struct) ? ptr->data : ptr->type);
+}
+
/*-----------------------CreatePyObject---------------------------------*/
PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
{
@@ -2247,8 +2287,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
if (ptr->data==NULL && ptr->type==NULL) { /* Operator RNA has NULL data */
Py_RETURN_NONE;
}
-
- if (ptr->type == &RNA_Struct) { /* always return a python subtype from rna struct types */
+ else {
PyTypeObject *tp = (PyTypeObject *)pyrna_struct_Subtype(ptr);
if (tp) {
@@ -2259,10 +2298,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
pyrna = ( BPy_StructRNA * ) PyObject_NEW( BPy_StructRNA, &pyrna_struct_Type );
}
}
- else {
- pyrna = ( BPy_StructRNA * ) PyObject_NEW( BPy_StructRNA, &pyrna_struct_Type );
- }
-
+
if( !pyrna ) {
PyErr_SetString( PyExc_MemoryError, "couldn't create BPy_StructRNA object" );
return NULL;
@@ -2270,6 +2306,9 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
pyrna->ptr= *ptr;
pyrna->freeptr= 0;
+
+ // PyObSpit("NewStructRNA: ", (PyObject *)pyrna);
+
return ( PyObject * ) pyrna;
}
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index d837892fb4d..660d00a202a 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -412,7 +412,8 @@ char *BPy_enum_as_string(EnumPropertyItem *item)
char *cstring;
for (e= item; item->identifier; item++) {
- BLI_dynstr_appendf(dynstr, (e==item)?"'%s'":", '%s'", item->identifier);
+ if(item->identifier[0])
+ BLI_dynstr_appendf(dynstr, (e==item)?"'%s'":", '%s'", item->identifier);
}
cstring = BLI_dynstr_get_cstring(dynstr);
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 5ddd8f5a1a9..79830aca12f 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -158,7 +158,8 @@ void WM_cursor_wait(int val)
void WM_cursor_grab(wmWindow *win, int val)
{
- GHOST_SetCursorGrab(win->ghostwin, val);
+ if(win)
+ GHOST_SetCursorGrab(win->ghostwin, val);
}
/* afer this you can call restore too */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 29ec58befd9..51389ef890c 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -334,8 +334,8 @@ int WM_read_homefile(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
CTX_wm_window_set(C, NULL); /* exits queues */
-
- return success;
+
+ return OPERATOR_FINISHED;
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 9cec463193e..330196a7a73 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1554,7 +1554,7 @@ void wm_window_keymap(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_save_as_mainfile", F2KEY, KM_PRESS, 0, 0);
- WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
/* debug/testing */