From f51c9fa496b51859efa804544eed38e575486f5b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 31 May 2011 09:55:50 +0000 Subject: [PATCH 001/105] fix for mistake in case insensitive image load. --- release/scripts/modules/bpy_extras/image_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index 045cbc5502c..f45f9c6f225 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -89,7 +89,7 @@ def load_image(imagepath, for filepath_test in variants: if ncase_cmp: - ncase_variants = filepath_test, bpy.path.resolve_ncase(filepath) + ncase_variants = filepath_test, bpy.path.resolve_ncase(filepath_test) else: ncase_variants = (filepath_test, ) From a8a36f31bd2a50b25188de9f1b0811ef2c60c1b4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 31 May 2011 09:56:38 +0000 Subject: [PATCH 002/105] Button value reset: * shortcut key changed from numpad 0 to delete. * fix missing undo push, now it calls the operator. Patch by Damir Prebeg, thanks! --- source/blender/editors/interface/interface.c | 15 ++++++--------- .../editors/interface/interface_handlers.c | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 28a874f78de..68d669b37cb 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1670,15 +1670,12 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) void ui_set_but_default(bContext *C, uiBut *but, short all) { - /* if there is a valid property that is editable... */ - if (but->rnapoin.data && but->rnaprop && RNA_property_editable(&but->rnapoin, but->rnaprop)) { - int index = (all)? -1 : but->rnaindex; - - if(RNA_property_reset(&but->rnapoin, but->rnaprop, index)) { - /* perform updates required for this property */ - RNA_property_update(C, &but->rnapoin, but->rnaprop); - } - } + PointerRNA ptr; + + WM_operator_properties_create(&ptr, "UI_OT_reset_default_button"); + RNA_boolean_set(&ptr, "all", all); + WM_operator_name_call(C, "UI_OT_reset_default_button", WM_OP_EXEC_DEFAULT, &ptr); + WM_operator_properties_free(&ptr); } static double soft_range_round_up(double value, double max) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index be46a7c7b85..55ae6af750f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4442,8 +4442,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) } /* reset to default */ /* XXX hardcoded keymap check.... */ - else if(ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { - /* ctrl-0 = for arrays, only the active one gets done (vs whole array for just 0) */ + else if(ELEM(event->type, DELKEY, PADPERIOD) && event->val == KM_PRESS) { + /* ctrl+del - reset active button; del - reset a whole array*/ if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM))) ui_set_but_default(C, but, !event->ctrl); } From 8d2e4cf42f04c4e98eafc03f14cb8d5316dbf312 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 31 May 2011 14:06:29 +0000 Subject: [PATCH 003/105] fix [#27514] Fix Bug 27510 Color key hue flipping error (composite node) --- .../nodes/intern/CMP_nodes/CMP_colorMatte.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c index 151850105b7..55d77a902b9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c @@ -49,16 +49,24 @@ static bNodeSocketType cmp_node_color_out[]={ static void do_color_key(bNode *node, float *out, float *in) { + float h_wrap; NodeChroma *c; c=node->storage; VECCOPY(out, in); - if(fabs(in[0]-c->key[0]) < c->t1 && - fabs(in[1]-c->key[1]) < c->t2 && - fabs(in[2]-c->key[2]) < c->t3) - { + if( + /* do hue last because it needs to wrap, and does some more checks */ + + /* sat */ (fabs(in[1]-c->key[1]) < c->t2) && + /* val */ (fabs(in[2]-c->key[2]) < c->t3) && + + /* multiply by 2 because it wraps on both sides of the hue, + * otherwise 0.5 would key all hue's */ + + /* hue */ ((h_wrap= 2.0f * fabs(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1) + ) { out[3]=0.0; /*make transparent*/ } From cc7a154fac6035a48b50c0e2fe944a6871a9098f Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Tue, 31 May 2011 17:54:48 +0000 Subject: [PATCH 004/105] Material nodes were checking the nodestack->hasinput flag to determin whether the original material settings or the node input data would be used. This causes trouble when the input data is not the direct input constant of the node nor a direct link in the same tree (i.e. a group socket). Just checks if sockets are linked now (not very nice, but not hackier than the rest of that node). Fixes bug #27511. --- .../nodes/intern/SHD_nodes/SHD_material.c | 57 +++++++++++++------ source/blender/nodes/intern/SHD_util.h | 1 + 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/intern/SHD_nodes/SHD_material.c index 40dfbc0edea..8b477af0689 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_material.c @@ -85,6 +85,17 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, ShadeInput *shi; ShaderCallData *shcd= data; float col[4]; + bNodeSocket *sock; + char hasinput[NUM_MAT_IN]; + int i; + + /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily + * the constant input stack values (e.g. in case material node is inside a group). + * we just want to know if a node input uses external data or the material setting. + * this is an ugly hack, but so is this node as a whole. + */ + for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) + hasinput[i] = (sock->link != NULL); shi= shcd->shi; shi->mat= (Material *)node->id; @@ -94,17 +105,17 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, shi->har= shi->mat->har; /* write values */ - if(in[MAT_IN_COLOR]->hasinput) + if(hasinput[MAT_IN_COLOR]) nodestack_get_vec(&shi->r, SOCK_VECTOR, in[MAT_IN_COLOR]); - if(in[MAT_IN_SPEC]->hasinput) + if(hasinput[MAT_IN_SPEC]) nodestack_get_vec(&shi->specr, SOCK_VECTOR, in[MAT_IN_SPEC]); - if(in[MAT_IN_REFL]->hasinput) + if(hasinput[MAT_IN_REFL]) nodestack_get_vec(&shi->refl, SOCK_VALUE, in[MAT_IN_REFL]); /* retrieve normal */ - if(in[MAT_IN_NORMAL]->hasinput) { + if(hasinput[MAT_IN_NORMAL]) { nodestack_get_vec(shi->vn, SOCK_VECTOR, in[MAT_IN_NORMAL]); normalize_v3(shi->vn); } @@ -119,19 +130,19 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, } if (node->type == SH_NODE_MATERIAL_EXT) { - if(in[MAT_IN_MIR]->hasinput) + if(hasinput[MAT_IN_MIR]) nodestack_get_vec(&shi->mirr, SOCK_VECTOR, in[MAT_IN_MIR]); - if(in[MAT_IN_AMB]->hasinput) + if(hasinput[MAT_IN_AMB]) nodestack_get_vec(&shi->amb, SOCK_VALUE, in[MAT_IN_AMB]); - if(in[MAT_IN_EMIT]->hasinput) + if(hasinput[MAT_IN_EMIT]) nodestack_get_vec(&shi->emit, SOCK_VALUE, in[MAT_IN_EMIT]); - if(in[MAT_IN_SPECTRA]->hasinput) + if(hasinput[MAT_IN_SPECTRA]) nodestack_get_vec(&shi->spectra, SOCK_VALUE, in[MAT_IN_SPECTRA]); - if(in[MAT_IN_RAY_MIRROR]->hasinput) + if(hasinput[MAT_IN_RAY_MIRROR]) nodestack_get_vec(&shi->ray_mirror, SOCK_VALUE, in[MAT_IN_RAY_MIRROR]); - if(in[MAT_IN_ALPHA]->hasinput) + if(hasinput[MAT_IN_ALPHA]) nodestack_get_vec(&shi->alpha, SOCK_VALUE, in[MAT_IN_ALPHA]); - if(in[MAT_IN_TRANSLUCENCY]->hasinput) + if(hasinput[MAT_IN_TRANSLUCENCY]) nodestack_get_vec(&shi->translucency, SOCK_VALUE, in[MAT_IN_TRANSLUCENCY]); } @@ -203,21 +214,31 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, if(node->id) { GPUShadeInput shi; GPUShadeResult shr; + bNodeSocket *sock; + char hasinput[NUM_MAT_IN]; + int i; + + /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily + * the constant input stack values (e.g. in case material node is inside a group). + * we just want to know if a node input uses external data or the material setting. + */ + for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) + hasinput[i] = (sock->link != NULL); GPU_shadeinput_set(mat, (Material*)node->id, &shi); /* write values */ - if(in[MAT_IN_COLOR].hasinput) + if(hasinput[MAT_IN_COLOR]) shi.rgb = in[MAT_IN_COLOR].link; - if(in[MAT_IN_SPEC].hasinput) + if(hasinput[MAT_IN_SPEC]) shi.specrgb = in[MAT_IN_SPEC].link; - if(in[MAT_IN_REFL].hasinput) + if(hasinput[MAT_IN_REFL]) shi.refl = in[MAT_IN_REFL].link; /* retrieve normal */ - if(in[MAT_IN_NORMAL].hasinput) { + if(hasinput[MAT_IN_NORMAL]) { GPUNodeLink *tmp; shi.vn = in[MAT_IN_NORMAL].link; GPU_link(mat, "vec_math_normalize", shi.vn, &shi.vn, &tmp); @@ -228,11 +249,11 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn); if (node->type == SH_NODE_MATERIAL_EXT) { - if(in[MAT_IN_AMB].hasinput) + if(hasinput[MAT_IN_AMB]) shi.amb= in[MAT_IN_AMB].link; - if(in[MAT_IN_EMIT].hasinput) + if(hasinput[MAT_IN_EMIT]) shi.emit= in[MAT_IN_EMIT].link; - if(in[MAT_IN_ALPHA].hasinput) + if(hasinput[MAT_IN_ALPHA]) shi.alpha= in[MAT_IN_ALPHA].link; } diff --git a/source/blender/nodes/intern/SHD_util.h b/source/blender/nodes/intern/SHD_util.h index 4c5d56776da..e6b1377067d 100644 --- a/source/blender/nodes/intern/SHD_util.h +++ b/source/blender/nodes/intern/SHD_util.h @@ -108,6 +108,7 @@ typedef struct ShaderCallData { #define MAT_IN_RAY_MIRROR 8 #define MAT_IN_ALPHA 9 #define MAT_IN_TRANSLUCENCY 10 +#define NUM_MAT_IN 11 /* for array size */ /* output socket defines */ #define MAT_OUT_COLOR 0 From a180bfe26784a3be35476c4974f739c0baa28769 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Jun 2011 13:10:37 +0000 Subject: [PATCH 005/105] Fix #27541: f-curve generator modifier file read missed endian switch, found by Guillaume Roguez. --- source/blender/blenloader/intern/readfile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index a10c7c6e1ed..6188ee143b2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1723,6 +1723,7 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) static void direct_link_fmodifiers(FileData *fd, ListBase *list) { FModifier *fcm; + int a; for (fcm= list->first; fcm; fcm= fcm->next) { /* relink general data */ @@ -1736,6 +1737,11 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list) FMod_Generator *data= (FMod_Generator *)fcm->data; data->coefficients= newdataadr(fd, data->coefficients); + + if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + for(a = 0; a < data->arraysize; a++) + SWITCH_INT(data->coefficients[a]); + } } break; case FMODIFIER_TYPE_ENVELOPE: From 7b4aac3e347982aa98a616d18c22a3d2eddc14d2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Jun 2011 13:13:55 +0000 Subject: [PATCH 006/105] Fix #27481: windows uninstaller could remove files unrelated to blender when installing to a folder that already existed. Now the uninstaller will remove only the files it has installed, and leave any other files in the installation directory intact. --- build_files/scons/tools/btools.py | 15 +++++++++++++++ release/windows/installer/00.sconsblender.nsi | 9 ++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index accdde0d2cf..3131548aed2 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -605,9 +605,12 @@ def NSIS_Installer(target=None, source=None, env=None): doneroot = False rootdirconts = [] datafiles = '' + deldatafiles = '' + deldatadirs = '' l = len(bf_installdir) for dp,dn,df in os.walk(bf_installdir): + # install if not doneroot: for f in df: rootdirconts.append(os.path.join(dp,f)) @@ -621,6 +624,16 @@ def NSIS_Installer(target=None, source=None, env=None): outfile = os.path.join(dp,f) datafiles += ' File '+outfile + "\n" + # uninstall + deldir = dp[l+1:] + + if len(deldir)>0: + deldatadirs = "RMDir $INSTDIR\\" + deldir + "\n" + deldatadirs + deldatadirs = "RMDir /r $INSTDIR\\" + deldir + "\\__pycache__\n" + deldatadirs + + for f in df: + deldatafiles += 'Delete \"$INSTDIR\\' + os.path.join(deldir, f) + "\"\n" + #### change to suit install dir #### inst_dir = install_base_dir + env['BF_INSTALLDIR'] @@ -657,6 +670,8 @@ def NSIS_Installer(target=None, source=None, env=None): ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) ns_cnt = string.replace(ns_cnt, "[DODATAFILES]", datafiles) + ns_cnt = string.replace(ns_cnt, "[DELDATAFILES]", deldatafiles) + ns_cnt = string.replace(ns_cnt, "[DELDATADIRS]", deldatadirs) tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi") new_nsis = open(tmpnsi, 'w') diff --git a/release/windows/installer/00.sconsblender.nsi b/release/windows/installer/00.sconsblender.nsi index 42a9b1c13b6..eddd215c64d 100644 --- a/release/windows/installer/00.sconsblender.nsi +++ b/release/windows/installer/00.sconsblender.nsi @@ -205,6 +205,8 @@ Section "Uninstall" ; Remove files [DELROOTDIRCONTS] + [DELDATAFILES] + [DELDATADIRS] Delete "$INSTDIR\uninstall.exe" @@ -212,13 +214,14 @@ Section "Uninstall" RMDir /r "$BLENDERCONFIG\$SHORTVERSION" ${Endif} + ; Remove install directory if it's empty + RMDir $INSTDIR ; Remove shortcuts Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*" Delete "$DESKTOP\Blender.lnk" ; Remove all link related directories and files - RMDir /r "$SMPROGRAMS\Blender Foundation" - ; Clear out installation dir - RMDir /r "$INSTDIR" + RMDir "$SMPROGRAMS\Blender Foundation\Blender" + RMDir "$SMPROGRAMS\Blender Foundation" System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' ; Refresh icons SectionEnd From 36cbd78bc30208308bd8a63540fba7415bb6b627 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Jun 2011 14:35:14 +0000 Subject: [PATCH 007/105] Fix #27490: export key configuration gave error when trying to export properties from an unknown (e.g. removed) operator. --- release/scripts/startup/bl_ui/space_userpref_keymap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index 982e19e6234..e99cefb91b8 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -411,8 +411,8 @@ def export_properties(prefix, properties, lines=None): if lines is None: lines = [] - for pname in properties.keys(): - if not properties.is_property_hidden(pname): + for pname in properties.bl_rna.properties.keys(): + if pname != "rna_type" and not properties.is_property_hidden(pname): value = getattr(properties, pname) if isinstance(value, bpy.types.OperatorProperties): export_properties(prefix + "." + pname, value, lines) From f50fb549dbee9d5ca1aea8a9f07313f2c8cde7f4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Jun 2011 16:13:48 +0000 Subject: [PATCH 008/105] UI: template_ID now takes into account if the property is editable. --- .../editors/interface/interface_templates.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index af5a69da653..69e3a1792c6 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -332,6 +332,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str PointerRNA idptr; // ListBase *lb; // UNUSED ID *id, *idfrom; + int editable= RNA_property_editable(&template->ptr, template->prop); idptr= RNA_property_pointer_get(&template->ptr, template->prop); id= idptr.data; @@ -352,14 +353,12 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if (id) but->icon = ui_id_icon_get(C, id, 1); uiButSetFlag(but, UI_HAS_ICON|UI_ICON_PREVIEW); } - if((idfrom && idfrom->lib)) + if((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); - uiLayoutRow(layout, 1); - } else - - if(flag & UI_ID_BROWSE) { + } + else if(flag & UI_ID_BROWSE) { but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, template_id_browse_tip(type)); if(type) { but->icon= RNA_struct_ui_icon(type); @@ -368,7 +367,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetFlag(but, UI_HAS_ICON|UI_ICON_LEFT); } - if((idfrom && idfrom->lib)) + if((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); } @@ -410,7 +409,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X+10,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Displays number of users of this data. Click to make a single-user copy."); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE)); - if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib)) + if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); } @@ -433,7 +432,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } - if((idfrom && idfrom->lib)) + if((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); } @@ -449,7 +448,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); } - if((idfrom && idfrom->lib)) + if((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); } @@ -468,7 +467,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetFlag(but, UI_BUT_DISABLED); } - if((idfrom && idfrom->lib)) + if((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); } From 81982140b862c07dc1a7ddc2ce995339b1eb4547 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Jun 2011 16:17:38 +0000 Subject: [PATCH 009/105] Fix #27550: texture node editor header was still showing texture datablock selector even if there is no active texture slot or node, now it's disabled in that case. --- source/blender/blenkernel/BKE_texture.h | 2 ++ source/blender/blenkernel/intern/texture.c | 22 +++++++++++++++++++ .../blender/editors/space_node/space_node.c | 2 ++ source/blender/makesrna/intern/rna_internal.h | 2 +- source/blender/makesrna/intern/rna_lamp.c | 2 +- source/blender/makesrna/intern/rna_material.c | 16 ++++++++++++-- source/blender/makesrna/intern/rna_particle.c | 2 +- source/blender/makesrna/intern/rna_world.c | 2 +- 8 files changed, 44 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index c8fa7a5e81f..9fb93f60fd5 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -103,6 +103,8 @@ void set_current_material_texture(struct Material *ma, struct Tex *tex); void set_current_lamp_texture(struct Lamp *la, struct Tex *tex); void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex); +int has_current_material_texture(struct Material *ma); + struct TexMapping *add_mapping(void); void init_mapping(struct TexMapping *texmap); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 9cd07de31dc..64f3c111434 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1191,6 +1191,28 @@ void set_current_material_texture(Material *ma, Tex *newtex) } } +int has_current_material_texture(Material *ma) +{ + bNode *node; + + if(ma && ma->use_nodes && ma->nodetree) { + node= nodeGetActiveID(ma->nodetree, ID_TE); + + if(node) { + return 1; + } + else { + node= nodeGetActiveID(ma->nodetree, ID_MA); + if(node) + ma= (Material*)node->id; + else + ma= NULL; + } + } + + return (ma != NULL); +} + Tex *give_current_world_texture(World *world) { MTex *mtex= NULL; diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 96ce19b7601..29316c5645a 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -222,6 +222,8 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) case NC_NODE: if (wmn->action == NA_EDITED) ED_area_tag_refresh(sa); + else if (wmn->action == NA_SELECTED) + ED_area_tag_redraw(sa); break; case NC_IMAGE: diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index a9fb545ec3f..9175806e2bb 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -187,7 +187,7 @@ void rna_def_animviz_common(struct StructRNA *srna); void rna_def_motionpath_common(struct StructRNA *srna); void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable); -void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *structname_slots, const char *update); +void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *activeeditable, const char *structname, const char *structname_slots, const char *update); void rna_def_render_layer_common(struct StructRNA *srna, int scene); void rna_ID_name_get(struct PointerRNA *ptr, char *value); diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index d16e06812af..f18308591db 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -374,7 +374,7 @@ static void rna_def_lamp(BlenderRNA *brna) /* textures */ rna_def_mtex_common(brna, srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get", - "rna_Lamp_active_texture_set", "LampTextureSlot", "LampTextureSlots", "rna_Lamp_update"); + "rna_Lamp_active_texture_set", NULL, "LampTextureSlot", "LampTextureSlots", "rna_Lamp_update"); } static void rna_def_lamp_falloff(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 8c3be7290f4..b86a91967a6 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -170,6 +170,13 @@ static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value) set_current_material_texture(ma, value.data); } +static int rna_Material_active_texture_editable(PointerRNA *ptr) +{ + Material *ma= (Material*)ptr->id.data; + + return has_current_material_texture(ma); +} + static PointerRNA rna_Material_active_node_material_get(PointerRNA *ptr) { Material *ma= give_node_material((Material*)ptr->data); @@ -1841,7 +1848,8 @@ void RNA_def_material(BlenderRNA *brna) /* common */ rna_def_animdata_common(srna); rna_def_mtex_common(brna, srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get", - "rna_Material_active_texture_set", "MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update"); + "rna_Material_active_texture_set", "rna_Material_active_texture_editable", + "MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update"); /* only material has this one */ prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE); @@ -1899,7 +1907,9 @@ static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const ch RNA_def_property_flag(parm, PROP_REQUIRED); } -void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *structname_slots, const char *update) +void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, + const char *activeget, const char *activeset, const char *activeeditable, + const char *structname, const char *structname_slots, const char *update) { PropertyRNA *prop; @@ -1913,6 +1923,8 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, c prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Texture"); RNA_def_property_flag(prop, PROP_EDITABLE); + if(activeeditable) + RNA_def_property_editable_func(prop, activeeditable); RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL); RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed"); RNA_def_property_update(prop, 0, update); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 5615e7141ee..4913e98a0af 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1560,7 +1560,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get", - "rna_ParticleSettings_active_texture_set", "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset"); + "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset"); /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */ prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index b8f8f5f5ded..72b54dce473 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -494,7 +494,7 @@ void RNA_def_world(BlenderRNA *brna) rna_def_animdata_common(srna); rna_def_mtex_common(brna, srna, "rna_World_mtex_begin", "rna_World_active_texture_get", - "rna_World_active_texture_set", "WorldTextureSlot", "WorldTextureSlots", "rna_World_update"); + "rna_World_active_texture_set", NULL, "WorldTextureSlot", "WorldTextureSlots", "rna_World_update"); /* colors */ prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR); From 22ca037c58372ba976b049cbfc5119f7aa9d16fe Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Jun 2011 23:55:49 +0000 Subject: [PATCH 010/105] uninitialized variable was used when ensuring mirrored vertex groups. --- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 68d669b37cb..3e65e707682 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1668,7 +1668,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) return 0; } -void ui_set_but_default(bContext *C, uiBut *but, short all) +void ui_set_but_default(bContext *C, uiBut *UNUSED(but), short all) { PointerRNA ptr; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0d79fcc2c58..c35b742eb9e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -301,7 +301,7 @@ static void wpaint_mirror_vgroup_ensure(Object *ob, int *vgroup_mirror) flip_side_name(name, defgroup->name, FALSE); if(strcmp(name, defgroup->name) != 0) { - for (curdef= ob->defbase.first, mirrdef; curdef; curdef=curdef->next, mirrdef++) { + for (curdef= ob->defbase.first, mirrdef= 0; curdef; curdef=curdef->next, mirrdef++) { if (!strcmp(curdef->name, name)) { break; } From 97d7496c96e93d443c90264c877d33b2a091ec7f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Jun 2011 00:05:54 +0000 Subject: [PATCH 011/105] update to glew 1.6 from 1.5.8 --- extern/glew/include/GL/glew.h | 204 ++++- extern/glew/include/GL/glxew.h | 39 +- extern/glew/include/GL/wglew.h | 78 +- extern/glew/src/glew.c | 1436 +++++++++++++++++++------------- 4 files changed, 1154 insertions(+), 603 deletions(-) diff --git a/extern/glew/include/GL/glew.h b/extern/glew/include/GL/glew.h index 2d7b7478622..1775aa784dc 100644 --- a/extern/glew/include/GL/glew.h +++ b/extern/glew/include/GL/glew.h @@ -1158,11 +1158,13 @@ GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei heigh /* ---------------------------------- GLU ---------------------------------- */ +#ifndef GLEW_NO_GLU /* this is where we can safely include GLU */ -#if defined(__APPLE__) && defined(__MACH__) -#include -#else -#include +# if defined(__APPLE__) && defined(__MACH__) +# include +# else +# include +# endif #endif /* ----------------------------- GL_VERSION_1_2 ---------------------------- */ @@ -2445,6 +2447,18 @@ typedef void (GLAPIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); #endif /* GL_3DFX_texture_compression_FXT1 */ +/* ----------------------- GL_AMD_blend_minmax_factor ---------------------- */ + +#ifndef GL_AMD_blend_minmax_factor +#define GL_AMD_blend_minmax_factor 1 + +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D + +#define GLEW_AMD_blend_minmax_factor GLEW_GET_VAR(__GLEW_AMD_blend_minmax_factor) + +#endif /* GL_AMD_blend_minmax_factor */ + /* ----------------------- GL_AMD_conservative_depth ----------------------- */ #ifndef GL_AMD_conservative_depth @@ -2587,6 +2601,21 @@ typedef void (GLAPIENTRY * PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monito #endif /* GL_AMD_performance_monitor */ +/* ------------------------ GL_AMD_sample_positions ------------------------ */ + +#ifndef GL_AMD_sample_positions +#define GL_AMD_sample_positions 1 + +#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F + +typedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat* val); + +#define glSetMultisamplefvAMD GLEW_GET_FUN(__glewSetMultisamplefvAMD) + +#define GLEW_AMD_sample_positions GLEW_GET_VAR(__GLEW_AMD_sample_positions) + +#endif /* GL_AMD_sample_positions */ + /* ------------------ GL_AMD_seamless_cubemap_per_texture ------------------ */ #ifndef GL_AMD_seamless_cubemap_per_texture @@ -3262,12 +3291,6 @@ typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum t #ifndef GL_ARB_draw_instanced #define GL_ARB_draw_instanced 1 -typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount); - -#define glDrawArraysInstancedARB GLEW_GET_FUN(__glewDrawArraysInstancedARB) -#define glDrawElementsInstancedARB GLEW_GET_FUN(__glewDrawElementsInstancedARB) - #define GLEW_ARB_draw_instanced GLEW_GET_VAR(__GLEW_ARB_draw_instanced) #endif /* GL_ARB_draw_instanced */ @@ -3827,8 +3850,12 @@ typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum in #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount); typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); +#define glDrawArraysInstancedARB GLEW_GET_FUN(__glewDrawArraysInstancedARB) +#define glDrawElementsInstancedARB GLEW_GET_FUN(__glewDrawElementsInstancedARB) #define glVertexAttribDivisorARB GLEW_GET_FUN(__glewVertexAttribDivisorARB) #define GLEW_ARB_instanced_arrays GLEW_GET_VAR(__GLEW_ARB_instanced_arrays) @@ -6211,8 +6238,8 @@ typedef void (GLAPIENTRY * PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); typedef void (GLAPIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); typedef void (GLAPIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); -#define glPNTrianglesfATI GLEW_GET_FUN(__glPNTrianglewesfATI) -#define glPNTrianglesiATI GLEW_GET_FUN(__glPNTrianglewesiATI) +#define glPNTrianglesfATI GLEW_GET_FUN(__glewPNTrianglesfATI) +#define glPNTrianglesiATI GLEW_GET_FUN(__glewPNTrianglesiATI) #define GLEW_ATI_pn_triangles GLEW_GET_VAR(__GLEW_ATI_pn_triangles) @@ -7599,12 +7626,10 @@ typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLen typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); #define glFramebufferTextureEXT GLEW_GET_FUN(__glewFramebufferTextureEXT) #define glFramebufferTextureFaceEXT GLEW_GET_FUN(__glewFramebufferTextureFaceEXT) -#define glFramebufferTextureLayerEXT GLEW_GET_FUN(__glewFramebufferTextureLayerEXT) #define glProgramParameteriEXT GLEW_GET_FUN(__glewProgramParameteriEXT) #define GLEW_EXT_geometry_shader4 GLEW_GET_VAR(__GLEW_EXT_geometry_shader4) @@ -8450,6 +8475,10 @@ typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, #define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C #define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); + +#define glFramebufferTextureLayerEXT GLEW_GET_FUN(__glewFramebufferTextureLayerEXT) + #define GLEW_EXT_texture_array GLEW_GET_VAR(__GLEW_EXT_texture_array) #endif /* GL_EXT_texture_array */ @@ -9316,6 +9345,21 @@ typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight); #endif /* GL_EXT_vertex_weighting */ +/* ------------------------- GL_EXT_x11_sync_object ------------------------ */ + +#ifndef GL_EXT_x11_sync_object +#define GL_EXT_x11_sync_object 1 + +#define GL_SYNC_X11_FENCE_EXT 0x90E1 + +typedef GLsync (GLAPIENTRY * PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); + +#define glImportSyncEXT GLEW_GET_FUN(__glewImportSyncEXT) + +#define GLEW_EXT_x11_sync_object GLEW_GET_VAR(__GLEW_EXT_x11_sync_object) + +#endif /* GL_EXT_x11_sync_object */ + /* ---------------------- GL_GREMEDY_frame_terminator ---------------------- */ #ifndef GL_GREMEDY_frame_terminator @@ -10796,6 +10840,32 @@ typedef void (GLAPIENTRY * PFNGLTEXTUREBARRIERNVPROC) (void); #endif /* GL_NV_texture_expand_normal */ +/* ----------------------- GL_NV_texture_multisample ----------------------- */ + +#ifndef GL_NV_texture_multisample +#define GL_NV_texture_multisample 1 + +#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 +#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 + +typedef void (GLAPIENTRY * PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (GLAPIENTRY * PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); + +#define glTexImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage2DMultisampleCoverageNV) +#define glTexImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTexImage3DMultisampleCoverageNV) +#define glTextureImage2DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage2DMultisampleCoverageNV) +#define glTextureImage2DMultisampleNV GLEW_GET_FUN(__glewTextureImage2DMultisampleNV) +#define glTextureImage3DMultisampleCoverageNV GLEW_GET_FUN(__glewTextureImage3DMultisampleCoverageNV) +#define glTextureImage3DMultisampleNV GLEW_GET_FUN(__glewTextureImage3DMultisampleNV) + +#define GLEW_NV_texture_multisample GLEW_GET_VAR(__GLEW_NV_texture_multisample) + +#endif /* GL_NV_texture_multisample */ + /* ------------------------ GL_NV_texture_rectangle ------------------------ */ #ifndef GL_NV_texture_rectangle @@ -11505,6 +11575,71 @@ typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei #endif /* GL_NV_vertex_program4 */ +/* -------------------------- GL_NV_video_capture -------------------------- */ + +#ifndef GL_NV_video_capture +#define GL_NV_video_capture 1 + +#define GL_VIDEO_BUFFER_NV 0x9020 +#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 +#define GL_FIELD_UPPER_NV 0x9022 +#define GL_FIELD_LOWER_NV 0x9023 +#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 +#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 +#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 +#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 +#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 +#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 +#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A +#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B +#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C +#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D +#define GL_PARTIAL_SUCCESS_NV 0x902E +#define GL_SUCCESS_NV 0x902F +#define GL_FAILURE_NV 0x9030 +#define GL_YCBYCR8_422_NV 0x9031 +#define GL_YCBAYCR8A_4224_NV 0x9032 +#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 +#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 +#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 +#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 +#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 +#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 +#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 +#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A +#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B +#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C + +typedef void (GLAPIENTRY * PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +typedef void (GLAPIENTRY * PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +typedef void (GLAPIENTRY * PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint* params); +typedef GLenum (GLAPIENTRY * PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint* sequence_num, GLuint64EXT *capture_time); +typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params); + +#define glBeginVideoCaptureNV GLEW_GET_FUN(__glewBeginVideoCaptureNV) +#define glBindVideoCaptureStreamBufferNV GLEW_GET_FUN(__glewBindVideoCaptureStreamBufferNV) +#define glBindVideoCaptureStreamTextureNV GLEW_GET_FUN(__glewBindVideoCaptureStreamTextureNV) +#define glEndVideoCaptureNV GLEW_GET_FUN(__glewEndVideoCaptureNV) +#define glGetVideoCaptureStreamdvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamdvNV) +#define glGetVideoCaptureStreamfvNV GLEW_GET_FUN(__glewGetVideoCaptureStreamfvNV) +#define glGetVideoCaptureStreamivNV GLEW_GET_FUN(__glewGetVideoCaptureStreamivNV) +#define glGetVideoCaptureivNV GLEW_GET_FUN(__glewGetVideoCaptureivNV) +#define glVideoCaptureNV GLEW_GET_FUN(__glewVideoCaptureNV) +#define glVideoCaptureStreamParameterdvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterdvNV) +#define glVideoCaptureStreamParameterfvNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterfvNV) +#define glVideoCaptureStreamParameterivNV GLEW_GET_FUN(__glewVideoCaptureStreamParameterivNV) + +#define GLEW_NV_video_capture GLEW_GET_VAR(__GLEW_NV_video_capture) + +#endif /* GL_NV_video_capture */ + /* ------------------------ GL_OES_byte_coordinates ------------------------ */ #ifndef GL_OES_byte_coordinates @@ -13052,6 +13187,8 @@ GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupS GLEW_FUN_EXPORT PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD; GLEW_FUN_EXPORT PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD; +GLEW_FUN_EXPORT PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD; + GLEW_FUN_EXPORT PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD; GLEW_FUN_EXPORT PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD; @@ -13132,9 +13269,6 @@ GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBase GLEW_FUN_EXPORT PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect; -GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB; -GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB; - GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer; GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer; GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer; @@ -13234,6 +13368,8 @@ GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMPROC __glewResetHistogram; GLEW_FUN_EXPORT PFNGLRESETMINMAXPROC __glewResetMinmax; GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D; +GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB; +GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB; GLEW_FUN_EXPORT PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange; @@ -13711,8 +13847,8 @@ GLEW_FUN_EXPORT PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderCon GLEW_FUN_EXPORT PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI; GLEW_FUN_EXPORT PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI; -GLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glPNTrianglewesfATI; -GLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glPNTrianglewesiATI; +GLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI; +GLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI; GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI; GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI; @@ -14093,7 +14229,6 @@ GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT; -GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT; GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT; GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT; @@ -14214,6 +14349,8 @@ GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT; GLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT; + GLEW_FUN_EXPORT PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT; GLEW_FUN_EXPORT PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT; @@ -14311,6 +14448,8 @@ GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT; GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT; +GLEW_FUN_EXPORT PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT; + GLEW_FUN_EXPORT PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY; GLEW_FUN_EXPORT PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY; @@ -14573,6 +14712,13 @@ GLEW_FUN_EXPORT PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV; GLEW_FUN_EXPORT PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV; +GLEW_FUN_EXPORT PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV; +GLEW_FUN_EXPORT PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV; + GLEW_FUN_EXPORT PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV; GLEW_FUN_EXPORT PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV; GLEW_FUN_EXPORT PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV; @@ -14705,6 +14851,19 @@ GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV; GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV; +GLEW_FUN_EXPORT PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV; +GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV; +GLEW_FUN_EXPORT PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV; +GLEW_FUN_EXPORT PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV; +GLEW_FUN_EXPORT PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV; +GLEW_FUN_EXPORT PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV; + GLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES; GLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES; GLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES; @@ -14866,12 +15025,14 @@ GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_1; GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_tbuffer; GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_texture_compression_FXT1; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_blend_minmax_factor; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_conservative_depth; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_debug_output; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_depth_clamp_separate; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_draw_buffers_blend; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_name_gen_delete; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_performance_monitor; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_sample_positions; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_seamless_cubemap_per_texture; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_export; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_texture_texture4; @@ -15106,6 +15267,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array_bgra; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_attrib_64bit; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_shader; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_x11_sync_object; GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_frame_terminator; GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker; GLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes; @@ -15174,6 +15336,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_barrier; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_compression_vtc; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_env_combine4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_expand_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_rectangle; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader; GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader2; @@ -15191,6 +15354,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2_option; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program3; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_video_capture; GLEW_VAR_EXPORT GLboolean __GLEW_OES_byte_coordinates; GLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_paletted_texture; GLEW_VAR_EXPORT GLboolean __GLEW_OES_read_format; diff --git a/extern/glew/include/GL/glxew.h b/extern/glew/include/GL/glxew.h index 68fcac295be..2995318f691 100644 --- a/extern/glew/include/GL/glxew.h +++ b/extern/glew/include/GL/glxew.h @@ -876,6 +876,33 @@ typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer); #endif /* GLX_NV_vertex_array_range */ +/* -------------------------- GLX_NV_video_capture ------------------------- */ + +#ifndef GLX_NV_video_capture +#define GLX_NV_video_capture 1 + +#define GLX_DEVICE_ID_NV 0x20CD +#define GLX_UNIQUE_ID_NV 0x20CE +#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF + +typedef XID GLXVideoCaptureDeviceNV; + +typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements); +typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); +typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); + +#define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV) +#define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV) +#define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV) +#define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV) +#define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV) + +#define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture) + +#endif /* GLX_NV_video_capture */ + /* -------------------------- GLX_NV_video_output -------------------------- */ #ifndef GLX_NV_video_output @@ -926,8 +953,7 @@ typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, /* -------------------------- GLX_OML_sync_control ------------------------- */ -#if !defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -#include +#ifndef GLX_OML_sync_control #define GLX_OML_sync_control 1 typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator); @@ -1374,6 +1400,12 @@ extern PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV; extern PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV; extern PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV; +extern PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV; +extern PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV; +extern PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV; +extern PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV; +extern PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV; + extern PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV; extern PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV; extern PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV; @@ -1381,13 +1413,11 @@ extern PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV; extern PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV; extern PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV; -#ifdef GLX_OML_sync_control extern PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML; extern PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML; extern PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML; extern PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML; extern PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML; -#endif extern PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX; extern PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX; @@ -1480,6 +1510,7 @@ GLXEW_EXPORT GLboolean __GLXEW_NV_multisample_coverage; GLXEW_EXPORT GLboolean __GLXEW_NV_present_video; GLXEW_EXPORT GLboolean __GLXEW_NV_swap_group; GLXEW_EXPORT GLboolean __GLXEW_NV_vertex_array_range; +GLXEW_EXPORT GLboolean __GLXEW_NV_video_capture; GLXEW_EXPORT GLboolean __GLXEW_NV_video_output; GLXEW_EXPORT GLboolean __GLXEW_OML_swap_method; GLXEW_EXPORT GLboolean __GLXEW_OML_sync_control; diff --git a/extern/glew/include/GL/wglew.h b/extern/glew/include/GL/wglew.h index ab01d343a51..deb64682811 100644 --- a/extern/glew/include/GL/wglew.h +++ b/extern/glew/include/GL/wglew.h @@ -141,7 +141,7 @@ typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids); -//XXX-blender, added: typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data); +typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data); typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); #define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD) @@ -831,6 +831,37 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWO #endif /* WGL_I3D_swap_frame_usage */ +/* --------------------------- WGL_NV_DX_interop --------------------------- */ + +#ifndef WGL_NV_DX_interop +#define WGL_NV_DX_interop 1 + +#define WGL_ACCESS_READ_ONLY_NV 0x0000 +#define WGL_ACCESS_READ_WRITE_NV 0x0001 +#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002 + +typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); +typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); +typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); +typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice); +typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle); +typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); +typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); + +#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV) +#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV) +#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV) +#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV) +#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV) +#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV) +#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV) +#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV) + +#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop) + +#endif /* WGL_NV_DX_interop */ + /* --------------------------- WGL_NV_copy_image --------------------------- */ #ifndef WGL_NV_copy_image @@ -996,6 +1027,32 @@ typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); #endif /* WGL_NV_vertex_array_range */ +/* -------------------------- WGL_NV_video_capture ------------------------- */ + +#ifndef WGL_NV_video_capture +#define WGL_NV_video_capture 1 + +#define WGL_UNIQUE_ID_NV 0x20CE +#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF + +DECLARE_HANDLE(HVIDEOINPUTDEVICENV); + +typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList); +typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); + +#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV) +#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV) +#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV) +#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV) +#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV) + +#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture) + +#endif /* WGL_NV_video_capture */ + /* -------------------------- WGL_NV_video_output -------------------------- */ #ifndef WGL_NV_video_output @@ -1080,7 +1137,7 @@ WGLEW_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContext WGLEW_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD; WGLEW_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD; WGLEW_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD; -//XXX-blender, added: WGLEW_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD; +WGLEW_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD; WGLEW_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD; WGLEW_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB; @@ -1168,6 +1225,15 @@ WGLEW_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D; WGLEW_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D; WGLEW_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D; +WGLEW_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV; +WGLEW_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV; +WGLEW_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV; +WGLEW_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV; +WGLEW_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV; +WGLEW_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV; +WGLEW_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV; +WGLEW_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV; + WGLEW_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV; WGLEW_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV; @@ -1190,6 +1256,12 @@ WGLEW_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV; WGLEW_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV; WGLEW_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV; +WGLEW_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV; +WGLEW_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV; +WGLEW_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV; +WGLEW_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV; +WGLEW_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV; + WGLEW_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV; WGLEW_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV; WGLEW_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV; @@ -1237,6 +1309,7 @@ WGLEW_EXPORT GLboolean __WGLEW_I3D_genlock; WGLEW_EXPORT GLboolean __WGLEW_I3D_image_buffer; WGLEW_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock; WGLEW_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage; +WGLEW_EXPORT GLboolean __WGLEW_NV_DX_interop; WGLEW_EXPORT GLboolean __WGLEW_NV_copy_image; WGLEW_EXPORT GLboolean __WGLEW_NV_float_buffer; WGLEW_EXPORT GLboolean __WGLEW_NV_gpu_affinity; @@ -1246,6 +1319,7 @@ WGLEW_EXPORT GLboolean __WGLEW_NV_render_depth_texture; WGLEW_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle; WGLEW_EXPORT GLboolean __WGLEW_NV_swap_group; WGLEW_EXPORT GLboolean __WGLEW_NV_vertex_array_range; +WGLEW_EXPORT GLboolean __WGLEW_NV_video_capture; WGLEW_EXPORT GLboolean __WGLEW_NV_video_output; WGLEW_EXPORT GLboolean __WGLEW_OML_sync_control; diff --git a/extern/glew/src/glew.c b/extern/glew/src/glew.c index ddc97d3b445..b2244a03237 100644 --- a/extern/glew/src/glew.c +++ b/extern/glew/src/glew.c @@ -249,6 +249,26 @@ static GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuin return GL_FALSE; } +/* + * Search for name in the extensions string. Use of strstr() + * is not sufficient because extension names can be prefixes of + * other extension names. Could use strtok() but the constant + * string returned by glGetString might be in read-only memory. + */ +static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, const GLubyte *end) +{ + const GLubyte* p; + GLuint len = _glewStrLen((const GLubyte*)name); + p = start; + while (p < end) + { + GLuint n = _glewStrCLen(p, ' '); + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; + p += n+1; + } + return GL_FALSE; +} + #if !defined(_WIN32) || !defined(GLEW_MX) PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL; @@ -573,6 +593,8 @@ PFNGLGETPERFMONITORGROUPSTRINGAMDPROC __glewGetPerfMonitorGroupStringAMD = NULL; PFNGLGETPERFMONITORGROUPSAMDPROC __glewGetPerfMonitorGroupsAMD = NULL; PFNGLSELECTPERFMONITORCOUNTERSAMDPROC __glewSelectPerfMonitorCountersAMD = NULL; +PFNGLSETMULTISAMPLEFVAMDPROC __glewSetMultisamplefvAMD = NULL; + PFNGLTESSELLATIONFACTORAMDPROC __glewTessellationFactorAMD = NULL; PFNGLTESSELLATIONMODEAMDPROC __glewTessellationModeAMD = NULL; @@ -653,9 +675,6 @@ PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC __glewMultiDrawElementsBaseVertex = NULL; PFNGLDRAWARRAYSINDIRECTPROC __glewDrawArraysIndirect = NULL; PFNGLDRAWELEMENTSINDIRECTPROC __glewDrawElementsIndirect = NULL; -PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB = NULL; -PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB = NULL; - PFNGLBINDFRAMEBUFFERPROC __glewBindFramebuffer = NULL; PFNGLBINDRENDERBUFFERPROC __glewBindRenderbuffer = NULL; PFNGLBLITFRAMEBUFFERPROC __glewBlitFramebuffer = NULL; @@ -755,6 +774,8 @@ PFNGLRESETHISTOGRAMPROC __glewResetHistogram = NULL; PFNGLRESETMINMAXPROC __glewResetMinmax = NULL; PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D = NULL; +PFNGLDRAWARRAYSINSTANCEDARBPROC __glewDrawArraysInstancedARB = NULL; +PFNGLDRAWELEMENTSINSTANCEDARBPROC __glewDrawElementsInstancedARB = NULL; PFNGLVERTEXATTRIBDIVISORARBPROC __glewVertexAttribDivisorARB = NULL; PFNGLFLUSHMAPPEDBUFFERRANGEPROC __glewFlushMappedBufferRange = NULL; @@ -1232,8 +1253,8 @@ PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI = NULL; PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI = NULL; PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI = NULL; -PFNGLPNTRIANGLESFATIPROC __glPNTrianglewesfATI = NULL; -PFNGLPNTRIANGLESIATIPROC __glPNTrianglewesiATI = NULL; +PFNGLPNTRIANGLESFATIPROC __glewPNTrianglesfATI = NULL; +PFNGLPNTRIANGLESIATIPROC __glewPNTrianglesiATI = NULL; PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI = NULL; PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI = NULL; @@ -1614,7 +1635,6 @@ PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT = NULL; PFNGLFRAMEBUFFERTEXTUREEXTPROC __glewFramebufferTextureEXT = NULL; PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC __glewFramebufferTextureFaceEXT = NULL; -PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT = NULL; PFNGLPROGRAMPARAMETERIEXTPROC __glewProgramParameteriEXT = NULL; PFNGLPROGRAMENVPARAMETERS4FVEXTPROC __glewProgramEnvParameters4fvEXT = NULL; @@ -1735,6 +1755,8 @@ PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT = NULL; PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT = NULL; + PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT = NULL; PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT = NULL; @@ -1832,6 +1854,8 @@ PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT = NULL; PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT = NULL; PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT = NULL; +PFNGLIMPORTSYNCEXTPROC __glewImportSyncEXT = NULL; + PFNGLFRAMETERMINATORGREMEDYPROC __glewFrameTerminatorGREMEDY = NULL; PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY = NULL; @@ -2094,6 +2118,13 @@ PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV = NULL; PFNGLTEXTUREBARRIERNVPROC __glewTextureBarrierNV = NULL; +PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTexImage2DMultisampleCoverageNV = NULL; +PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTexImage3DMultisampleCoverageNV = NULL; +PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC __glewTextureImage2DMultisampleCoverageNV = NULL; +PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC __glewTextureImage2DMultisampleNV = NULL; +PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC __glewTextureImage3DMultisampleCoverageNV = NULL; +PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC __glewTextureImage3DMultisampleNV = NULL; + PFNGLACTIVEVARYINGNVPROC __glewActiveVaryingNV = NULL; PFNGLBEGINTRANSFORMFEEDBACKNVPROC __glewBeginTransformFeedbackNV = NULL; PFNGLBINDBUFFERBASENVPROC __glewBindBufferBaseNV = NULL; @@ -2226,6 +2257,19 @@ PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV = NULL; PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV = NULL; PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV = NULL; +PFNGLBEGINVIDEOCAPTURENVPROC __glewBeginVideoCaptureNV = NULL; +PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC __glewBindVideoCaptureStreamBufferNV = NULL; +PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC __glewBindVideoCaptureStreamTextureNV = NULL; +PFNGLENDVIDEOCAPTURENVPROC __glewEndVideoCaptureNV = NULL; +PFNGLGETVIDEOCAPTURESTREAMDVNVPROC __glewGetVideoCaptureStreamdvNV = NULL; +PFNGLGETVIDEOCAPTURESTREAMFVNVPROC __glewGetVideoCaptureStreamfvNV = NULL; +PFNGLGETVIDEOCAPTURESTREAMIVNVPROC __glewGetVideoCaptureStreamivNV = NULL; +PFNGLGETVIDEOCAPTUREIVNVPROC __glewGetVideoCaptureivNV = NULL; +PFNGLVIDEOCAPTURENVPROC __glewVideoCaptureNV = NULL; +PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC __glewVideoCaptureStreamParameterdvNV = NULL; +PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC __glewVideoCaptureStreamParameterfvNV = NULL; +PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC __glewVideoCaptureStreamParameterivNV = NULL; + PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES = NULL; PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES = NULL; PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES = NULL; @@ -2386,12 +2430,14 @@ GLboolean __GLEW_VERSION_4_1 = GL_FALSE; GLboolean __GLEW_3DFX_multisample = GL_FALSE; GLboolean __GLEW_3DFX_tbuffer = GL_FALSE; GLboolean __GLEW_3DFX_texture_compression_FXT1 = GL_FALSE; +GLboolean __GLEW_AMD_blend_minmax_factor = GL_FALSE; GLboolean __GLEW_AMD_conservative_depth = GL_FALSE; GLboolean __GLEW_AMD_debug_output = GL_FALSE; GLboolean __GLEW_AMD_depth_clamp_separate = GL_FALSE; GLboolean __GLEW_AMD_draw_buffers_blend = GL_FALSE; GLboolean __GLEW_AMD_name_gen_delete = GL_FALSE; GLboolean __GLEW_AMD_performance_monitor = GL_FALSE; +GLboolean __GLEW_AMD_sample_positions = GL_FALSE; GLboolean __GLEW_AMD_seamless_cubemap_per_texture = GL_FALSE; GLboolean __GLEW_AMD_shader_stencil_export = GL_FALSE; GLboolean __GLEW_AMD_texture_texture4 = GL_FALSE; @@ -2626,6 +2672,7 @@ GLboolean __GLEW_EXT_vertex_array_bgra = GL_FALSE; GLboolean __GLEW_EXT_vertex_attrib_64bit = GL_FALSE; GLboolean __GLEW_EXT_vertex_shader = GL_FALSE; GLboolean __GLEW_EXT_vertex_weighting = GL_FALSE; +GLboolean __GLEW_EXT_x11_sync_object = GL_FALSE; GLboolean __GLEW_GREMEDY_frame_terminator = GL_FALSE; GLboolean __GLEW_GREMEDY_string_marker = GL_FALSE; GLboolean __GLEW_HP_convolution_border_modes = GL_FALSE; @@ -2694,6 +2741,7 @@ GLboolean __GLEW_NV_texture_barrier = GL_FALSE; GLboolean __GLEW_NV_texture_compression_vtc = GL_FALSE; GLboolean __GLEW_NV_texture_env_combine4 = GL_FALSE; GLboolean __GLEW_NV_texture_expand_normal = GL_FALSE; +GLboolean __GLEW_NV_texture_multisample = GL_FALSE; GLboolean __GLEW_NV_texture_rectangle = GL_FALSE; GLboolean __GLEW_NV_texture_shader = GL_FALSE; GLboolean __GLEW_NV_texture_shader2 = GL_FALSE; @@ -2711,6 +2759,7 @@ GLboolean __GLEW_NV_vertex_program2 = GL_FALSE; GLboolean __GLEW_NV_vertex_program2_option = GL_FALSE; GLboolean __GLEW_NV_vertex_program3 = GL_FALSE; GLboolean __GLEW_NV_vertex_program4 = GL_FALSE; +GLboolean __GLEW_NV_video_capture = GL_FALSE; GLboolean __GLEW_OES_byte_coordinates = GL_FALSE; GLboolean __GLEW_OES_compressed_paletted_texture = GL_FALSE; GLboolean __GLEW_OES_read_format = GL_FALSE; @@ -3229,6 +3278,10 @@ static GLboolean _glewInit_GL_3DFX_tbuffer (GLEW_CONTEXT_ARG_DEF_INIT) #endif /* GL_3DFX_texture_compression_FXT1 */ +#ifdef GL_AMD_blend_minmax_factor + +#endif /* GL_AMD_blend_minmax_factor */ + #ifdef GL_AMD_conservative_depth #endif /* GL_AMD_conservative_depth */ @@ -3307,6 +3360,19 @@ static GLboolean _glewInit_GL_AMD_performance_monitor (GLEW_CONTEXT_ARG_DEF_INIT #endif /* GL_AMD_performance_monitor */ +#ifdef GL_AMD_sample_positions + +static GLboolean _glewInit_GL_AMD_sample_positions (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSetMultisamplefvAMD = (PFNGLSETMULTISAMPLEFVAMDPROC)glewGetProcAddress((const GLubyte*)"glSetMultisamplefvAMD")) == NULL) || r; + + return r; +} + +#endif /* GL_AMD_sample_positions */ + #ifdef GL_AMD_seamless_cubemap_per_texture #endif /* GL_AMD_seamless_cubemap_per_texture */ @@ -3666,16 +3732,6 @@ static GLboolean _glewInit_GL_ARB_draw_indirect (GLEW_CONTEXT_ARG_DEF_INIT) #ifdef GL_ARB_draw_instanced -static GLboolean _glewInit_GL_ARB_draw_instanced (GLEW_CONTEXT_ARG_DEF_INIT) -{ - GLboolean r = GL_FALSE; - - r = ((glDrawArraysInstancedARB = (PFNGLDRAWARRAYSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedARB")) == NULL) || r; - r = ((glDrawElementsInstancedARB = (PFNGLDRAWELEMENTSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedARB")) == NULL) || r; - - return r; -} - #endif /* GL_ARB_draw_instanced */ #ifdef GL_ARB_explicit_attrib_location @@ -3875,6 +3931,8 @@ static GLboolean _glewInit_GL_ARB_instanced_arrays (GLEW_CONTEXT_ARG_DEF_INIT) { GLboolean r = GL_FALSE; + r = ((glDrawArraysInstancedARB = (PFNGLDRAWARRAYSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysInstancedARB")) == NULL) || r; + r = ((glDrawElementsInstancedARB = (PFNGLDRAWELEMENTSINSTANCEDARBPROC)glewGetProcAddress((const GLubyte*)"glDrawElementsInstancedARB")) == NULL) || r; r = ((glVertexAttribDivisorARB = (PFNGLVERTEXATTRIBDIVISORARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribDivisorARB")) == NULL) || r; return r; @@ -5653,7 +5711,6 @@ static GLboolean _glewInit_GL_EXT_geometry_shader4 (GLEW_CONTEXT_ARG_DEF_INIT) r = ((glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureEXT")) == NULL) || r; r = ((glFramebufferTextureFaceEXT = (PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureFaceEXT")) == NULL) || r; - r = ((glFramebufferTextureLayerEXT = (PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerEXT")) == NULL) || r; r = ((glProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glProgramParameteriEXT")) == NULL) || r; return r; @@ -6061,6 +6118,15 @@ static GLboolean _glewInit_GL_EXT_texture3D (GLEW_CONTEXT_ARG_DEF_INIT) #ifdef GL_EXT_texture_array +static GLboolean _glewInit_GL_EXT_texture_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFramebufferTextureLayerEXT = (PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTextureLayerEXT")) == NULL) || r; + + return r; +} + #endif /* GL_EXT_texture_array */ #ifdef GL_EXT_texture_buffer_object @@ -6350,6 +6416,19 @@ static GLboolean _glewInit_GL_EXT_vertex_weighting (GLEW_CONTEXT_ARG_DEF_INIT) #endif /* GL_EXT_vertex_weighting */ +#ifdef GL_EXT_x11_sync_object + +static GLboolean _glewInit_GL_EXT_x11_sync_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glImportSyncEXT = (PFNGLIMPORTSYNCEXTPROC)glewGetProcAddress((const GLubyte*)"glImportSyncEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_x11_sync_object */ + #ifdef GL_GREMEDY_frame_terminator static GLboolean _glewInit_GL_GREMEDY_frame_terminator (GLEW_CONTEXT_ARG_DEF_INIT) @@ -7108,6 +7187,24 @@ static GLboolean _glewInit_GL_NV_texture_barrier (GLEW_CONTEXT_ARG_DEF_INIT) #endif /* GL_NV_texture_expand_normal */ +#ifdef GL_NV_texture_multisample + +static GLboolean _glewInit_GL_NV_texture_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexImage2DMultisampleCoverageNV = (PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage2DMultisampleCoverageNV")) == NULL) || r; + r = ((glTexImage3DMultisampleCoverageNV = (PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DMultisampleCoverageNV")) == NULL) || r; + r = ((glTextureImage2DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleCoverageNV")) == NULL) || r; + r = ((glTextureImage2DMultisampleNV = (PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage2DMultisampleNV")) == NULL) || r; + r = ((glTextureImage3DMultisampleCoverageNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleCoverageNV")) == NULL) || r; + r = ((glTextureImage3DMultisampleNV = (PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC)glewGetProcAddress((const GLubyte*)"glTextureImage3DMultisampleNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_texture_multisample */ + #ifdef GL_NV_texture_rectangle #endif /* GL_NV_texture_rectangle */ @@ -7357,6 +7454,30 @@ static GLboolean _glewInit_GL_NV_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT) #endif /* GL_NV_vertex_program4 */ +#ifdef GL_NV_video_capture + +static GLboolean _glewInit_GL_NV_video_capture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginVideoCaptureNV = (PFNGLBEGINVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glBeginVideoCaptureNV")) == NULL) || r; + r = ((glBindVideoCaptureStreamBufferNV = (PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamBufferNV")) == NULL) || r; + r = ((glBindVideoCaptureStreamTextureNV = (PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC)glewGetProcAddress((const GLubyte*)"glBindVideoCaptureStreamTextureNV")) == NULL) || r; + r = ((glEndVideoCaptureNV = (PFNGLENDVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glEndVideoCaptureNV")) == NULL) || r; + r = ((glGetVideoCaptureStreamdvNV = (PFNGLGETVIDEOCAPTURESTREAMDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamdvNV")) == NULL) || r; + r = ((glGetVideoCaptureStreamfvNV = (PFNGLGETVIDEOCAPTURESTREAMFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamfvNV")) == NULL) || r; + r = ((glGetVideoCaptureStreamivNV = (PFNGLGETVIDEOCAPTURESTREAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureStreamivNV")) == NULL) || r; + r = ((glGetVideoCaptureivNV = (PFNGLGETVIDEOCAPTUREIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVideoCaptureivNV")) == NULL) || r; + r = ((glVideoCaptureNV = (PFNGLVIDEOCAPTURENVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureNV")) == NULL) || r; + r = ((glVideoCaptureStreamParameterdvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterdvNV")) == NULL) || r; + r = ((glVideoCaptureStreamParameterfvNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterfvNV")) == NULL) || r; + r = ((glVideoCaptureStreamParameterivNV = (PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glVideoCaptureStreamParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_video_capture */ + #ifdef GL_OES_byte_coordinates #endif /* GL_OES_byte_coordinates */ @@ -7943,27 +8064,15 @@ static GLboolean _glewInit_GL_WIN_swap_hint (GLEW_CONTEXT_ARG_DEF_INIT) /* ------------------------------------------------------------------------- */ -/* - * Search for name in the extensions string. Use of strstr() - * is not sufficient because extension names can be prefixes of - * other extension names. Could use strtok() but the constant - * string returned by glGetString might be in read-only memory. - */ GLboolean glewGetExtension (const char* name) { - GLubyte* p; - GLubyte* end; - GLuint len = _glewStrLen((const GLubyte*)name); - p = (GLubyte*)glGetString(GL_EXTENSIONS); - if (0 == p) return GL_FALSE; - end = p + _glewStrLen(p); - while (p < end) - { - GLuint n = _glewStrCLen(p, ' '); - if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; - p += n+1; - } - return GL_FALSE; + const GLubyte* start; + const GLubyte* end; + start = (const GLubyte*)glGetString(GL_EXTENSIONS); + if (start == 0) + return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); } /* ------------------------------------------------------------------------- */ @@ -7976,6 +8085,8 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) const GLubyte* s; GLuint dot; GLint major, minor; + const GLubyte* extStart; + const GLubyte* extEnd; /* query opengl version */ s = glGetString(GL_VERSION); dot = _glewStrCLen(s, '.'); @@ -8012,6 +8123,13 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) CONST_CAST(GLEW_VERSION_1_2) = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_1) = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; } + + /* query opengl extensions string */ + extStart = glGetString(GL_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte*)""; + extEnd = extStart + _glewStrLen(extStart); + /* initialize extensions */ #ifdef GL_VERSION_1_2 if (glewExperimental || GLEW_VERSION_1_2) CONST_CAST(GLEW_VERSION_1_2) = !_glewInit_GL_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT); @@ -8051,1388 +8169,1407 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) #ifdef GL_VERSION_4_1 #endif /* GL_VERSION_4_1 */ #ifdef GL_3DFX_multisample - CONST_CAST(GLEW_3DFX_multisample) = glewGetExtension("GL_3DFX_multisample"); + CONST_CAST(GLEW_3DFX_multisample) = _glewSearchExtension("GL_3DFX_multisample", extStart, extEnd); #endif /* GL_3DFX_multisample */ #ifdef GL_3DFX_tbuffer - CONST_CAST(GLEW_3DFX_tbuffer) = glewGetExtension("GL_3DFX_tbuffer"); + CONST_CAST(GLEW_3DFX_tbuffer) = _glewSearchExtension("GL_3DFX_tbuffer", extStart, extEnd); if (glewExperimental || GLEW_3DFX_tbuffer) CONST_CAST(GLEW_3DFX_tbuffer) = !_glewInit_GL_3DFX_tbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_3DFX_tbuffer */ #ifdef GL_3DFX_texture_compression_FXT1 - CONST_CAST(GLEW_3DFX_texture_compression_FXT1) = glewGetExtension("GL_3DFX_texture_compression_FXT1"); + CONST_CAST(GLEW_3DFX_texture_compression_FXT1) = _glewSearchExtension("GL_3DFX_texture_compression_FXT1", extStart, extEnd); #endif /* GL_3DFX_texture_compression_FXT1 */ +#ifdef GL_AMD_blend_minmax_factor + CONST_CAST(GLEW_AMD_blend_minmax_factor) = _glewSearchExtension("GL_AMD_blend_minmax_factor", extStart, extEnd); +#endif /* GL_AMD_blend_minmax_factor */ #ifdef GL_AMD_conservative_depth - CONST_CAST(GLEW_AMD_conservative_depth) = glewGetExtension("GL_AMD_conservative_depth"); + CONST_CAST(GLEW_AMD_conservative_depth) = _glewSearchExtension("GL_AMD_conservative_depth", extStart, extEnd); #endif /* GL_AMD_conservative_depth */ #ifdef GL_AMD_debug_output - CONST_CAST(GLEW_AMD_debug_output) = glewGetExtension("GL_AMD_debug_output"); + CONST_CAST(GLEW_AMD_debug_output) = _glewSearchExtension("GL_AMD_debug_output", extStart, extEnd); if (glewExperimental || GLEW_AMD_debug_output) CONST_CAST(GLEW_AMD_debug_output) = !_glewInit_GL_AMD_debug_output(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_debug_output */ #ifdef GL_AMD_depth_clamp_separate - CONST_CAST(GLEW_AMD_depth_clamp_separate) = glewGetExtension("GL_AMD_depth_clamp_separate"); + CONST_CAST(GLEW_AMD_depth_clamp_separate) = _glewSearchExtension("GL_AMD_depth_clamp_separate", extStart, extEnd); #endif /* GL_AMD_depth_clamp_separate */ #ifdef GL_AMD_draw_buffers_blend - CONST_CAST(GLEW_AMD_draw_buffers_blend) = glewGetExtension("GL_AMD_draw_buffers_blend"); + CONST_CAST(GLEW_AMD_draw_buffers_blend) = _glewSearchExtension("GL_AMD_draw_buffers_blend", extStart, extEnd); if (glewExperimental || GLEW_AMD_draw_buffers_blend) CONST_CAST(GLEW_AMD_draw_buffers_blend) = !_glewInit_GL_AMD_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_draw_buffers_blend */ #ifdef GL_AMD_name_gen_delete - CONST_CAST(GLEW_AMD_name_gen_delete) = glewGetExtension("GL_AMD_name_gen_delete"); + CONST_CAST(GLEW_AMD_name_gen_delete) = _glewSearchExtension("GL_AMD_name_gen_delete", extStart, extEnd); if (glewExperimental || GLEW_AMD_name_gen_delete) CONST_CAST(GLEW_AMD_name_gen_delete) = !_glewInit_GL_AMD_name_gen_delete(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_name_gen_delete */ #ifdef GL_AMD_performance_monitor - CONST_CAST(GLEW_AMD_performance_monitor) = glewGetExtension("GL_AMD_performance_monitor"); + CONST_CAST(GLEW_AMD_performance_monitor) = _glewSearchExtension("GL_AMD_performance_monitor", extStart, extEnd); if (glewExperimental || GLEW_AMD_performance_monitor) CONST_CAST(GLEW_AMD_performance_monitor) = !_glewInit_GL_AMD_performance_monitor(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_performance_monitor */ +#ifdef GL_AMD_sample_positions + CONST_CAST(GLEW_AMD_sample_positions) = _glewSearchExtension("GL_AMD_sample_positions", extStart, extEnd); + if (glewExperimental || GLEW_AMD_sample_positions) CONST_CAST(GLEW_AMD_sample_positions) = !_glewInit_GL_AMD_sample_positions(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_AMD_sample_positions */ #ifdef GL_AMD_seamless_cubemap_per_texture - CONST_CAST(GLEW_AMD_seamless_cubemap_per_texture) = glewGetExtension("GL_AMD_seamless_cubemap_per_texture"); + CONST_CAST(GLEW_AMD_seamless_cubemap_per_texture) = _glewSearchExtension("GL_AMD_seamless_cubemap_per_texture", extStart, extEnd); #endif /* GL_AMD_seamless_cubemap_per_texture */ #ifdef GL_AMD_shader_stencil_export - CONST_CAST(GLEW_AMD_shader_stencil_export) = glewGetExtension("GL_AMD_shader_stencil_export"); + CONST_CAST(GLEW_AMD_shader_stencil_export) = _glewSearchExtension("GL_AMD_shader_stencil_export", extStart, extEnd); #endif /* GL_AMD_shader_stencil_export */ #ifdef GL_AMD_texture_texture4 - CONST_CAST(GLEW_AMD_texture_texture4) = glewGetExtension("GL_AMD_texture_texture4"); + CONST_CAST(GLEW_AMD_texture_texture4) = _glewSearchExtension("GL_AMD_texture_texture4", extStart, extEnd); #endif /* GL_AMD_texture_texture4 */ #ifdef GL_AMD_transform_feedback3_lines_triangles - CONST_CAST(GLEW_AMD_transform_feedback3_lines_triangles) = glewGetExtension("GL_AMD_transform_feedback3_lines_triangles"); + CONST_CAST(GLEW_AMD_transform_feedback3_lines_triangles) = _glewSearchExtension("GL_AMD_transform_feedback3_lines_triangles", extStart, extEnd); #endif /* GL_AMD_transform_feedback3_lines_triangles */ #ifdef GL_AMD_vertex_shader_tessellator - CONST_CAST(GLEW_AMD_vertex_shader_tessellator) = glewGetExtension("GL_AMD_vertex_shader_tessellator"); + CONST_CAST(GLEW_AMD_vertex_shader_tessellator) = _glewSearchExtension("GL_AMD_vertex_shader_tessellator", extStart, extEnd); if (glewExperimental || GLEW_AMD_vertex_shader_tessellator) CONST_CAST(GLEW_AMD_vertex_shader_tessellator) = !_glewInit_GL_AMD_vertex_shader_tessellator(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_AMD_vertex_shader_tessellator */ #ifdef GL_APPLE_aux_depth_stencil - CONST_CAST(GLEW_APPLE_aux_depth_stencil) = glewGetExtension("GL_APPLE_aux_depth_stencil"); + CONST_CAST(GLEW_APPLE_aux_depth_stencil) = _glewSearchExtension("GL_APPLE_aux_depth_stencil", extStart, extEnd); #endif /* GL_APPLE_aux_depth_stencil */ #ifdef GL_APPLE_client_storage - CONST_CAST(GLEW_APPLE_client_storage) = glewGetExtension("GL_APPLE_client_storage"); + CONST_CAST(GLEW_APPLE_client_storage) = _glewSearchExtension("GL_APPLE_client_storage", extStart, extEnd); #endif /* GL_APPLE_client_storage */ #ifdef GL_APPLE_element_array - CONST_CAST(GLEW_APPLE_element_array) = glewGetExtension("GL_APPLE_element_array"); + CONST_CAST(GLEW_APPLE_element_array) = _glewSearchExtension("GL_APPLE_element_array", extStart, extEnd); if (glewExperimental || GLEW_APPLE_element_array) CONST_CAST(GLEW_APPLE_element_array) = !_glewInit_GL_APPLE_element_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_element_array */ #ifdef GL_APPLE_fence - CONST_CAST(GLEW_APPLE_fence) = glewGetExtension("GL_APPLE_fence"); + CONST_CAST(GLEW_APPLE_fence) = _glewSearchExtension("GL_APPLE_fence", extStart, extEnd); if (glewExperimental || GLEW_APPLE_fence) CONST_CAST(GLEW_APPLE_fence) = !_glewInit_GL_APPLE_fence(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_fence */ #ifdef GL_APPLE_float_pixels - CONST_CAST(GLEW_APPLE_float_pixels) = glewGetExtension("GL_APPLE_float_pixels"); + CONST_CAST(GLEW_APPLE_float_pixels) = _glewSearchExtension("GL_APPLE_float_pixels", extStart, extEnd); #endif /* GL_APPLE_float_pixels */ #ifdef GL_APPLE_flush_buffer_range - CONST_CAST(GLEW_APPLE_flush_buffer_range) = glewGetExtension("GL_APPLE_flush_buffer_range"); + CONST_CAST(GLEW_APPLE_flush_buffer_range) = _glewSearchExtension("GL_APPLE_flush_buffer_range", extStart, extEnd); if (glewExperimental || GLEW_APPLE_flush_buffer_range) CONST_CAST(GLEW_APPLE_flush_buffer_range) = !_glewInit_GL_APPLE_flush_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_flush_buffer_range */ #ifdef GL_APPLE_object_purgeable - CONST_CAST(GLEW_APPLE_object_purgeable) = glewGetExtension("GL_APPLE_object_purgeable"); + CONST_CAST(GLEW_APPLE_object_purgeable) = _glewSearchExtension("GL_APPLE_object_purgeable", extStart, extEnd); if (glewExperimental || GLEW_APPLE_object_purgeable) CONST_CAST(GLEW_APPLE_object_purgeable) = !_glewInit_GL_APPLE_object_purgeable(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_object_purgeable */ #ifdef GL_APPLE_pixel_buffer - CONST_CAST(GLEW_APPLE_pixel_buffer) = glewGetExtension("GL_APPLE_pixel_buffer"); + CONST_CAST(GLEW_APPLE_pixel_buffer) = _glewSearchExtension("GL_APPLE_pixel_buffer", extStart, extEnd); #endif /* GL_APPLE_pixel_buffer */ #ifdef GL_APPLE_rgb_422 - CONST_CAST(GLEW_APPLE_rgb_422) = glewGetExtension("GL_APPLE_rgb_422"); + CONST_CAST(GLEW_APPLE_rgb_422) = _glewSearchExtension("GL_APPLE_rgb_422", extStart, extEnd); #endif /* GL_APPLE_rgb_422 */ #ifdef GL_APPLE_row_bytes - CONST_CAST(GLEW_APPLE_row_bytes) = glewGetExtension("GL_APPLE_row_bytes"); + CONST_CAST(GLEW_APPLE_row_bytes) = _glewSearchExtension("GL_APPLE_row_bytes", extStart, extEnd); #endif /* GL_APPLE_row_bytes */ #ifdef GL_APPLE_specular_vector - CONST_CAST(GLEW_APPLE_specular_vector) = glewGetExtension("GL_APPLE_specular_vector"); + CONST_CAST(GLEW_APPLE_specular_vector) = _glewSearchExtension("GL_APPLE_specular_vector", extStart, extEnd); #endif /* GL_APPLE_specular_vector */ #ifdef GL_APPLE_texture_range - CONST_CAST(GLEW_APPLE_texture_range) = glewGetExtension("GL_APPLE_texture_range"); + CONST_CAST(GLEW_APPLE_texture_range) = _glewSearchExtension("GL_APPLE_texture_range", extStart, extEnd); if (glewExperimental || GLEW_APPLE_texture_range) CONST_CAST(GLEW_APPLE_texture_range) = !_glewInit_GL_APPLE_texture_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_texture_range */ #ifdef GL_APPLE_transform_hint - CONST_CAST(GLEW_APPLE_transform_hint) = glewGetExtension("GL_APPLE_transform_hint"); + CONST_CAST(GLEW_APPLE_transform_hint) = _glewSearchExtension("GL_APPLE_transform_hint", extStart, extEnd); #endif /* GL_APPLE_transform_hint */ #ifdef GL_APPLE_vertex_array_object - CONST_CAST(GLEW_APPLE_vertex_array_object) = glewGetExtension("GL_APPLE_vertex_array_object"); + CONST_CAST(GLEW_APPLE_vertex_array_object) = _glewSearchExtension("GL_APPLE_vertex_array_object", extStart, extEnd); if (glewExperimental || GLEW_APPLE_vertex_array_object) CONST_CAST(GLEW_APPLE_vertex_array_object) = !_glewInit_GL_APPLE_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_vertex_array_object */ #ifdef GL_APPLE_vertex_array_range - CONST_CAST(GLEW_APPLE_vertex_array_range) = glewGetExtension("GL_APPLE_vertex_array_range"); + CONST_CAST(GLEW_APPLE_vertex_array_range) = _glewSearchExtension("GL_APPLE_vertex_array_range", extStart, extEnd); if (glewExperimental || GLEW_APPLE_vertex_array_range) CONST_CAST(GLEW_APPLE_vertex_array_range) = !_glewInit_GL_APPLE_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_vertex_array_range */ #ifdef GL_APPLE_vertex_program_evaluators - CONST_CAST(GLEW_APPLE_vertex_program_evaluators) = glewGetExtension("GL_APPLE_vertex_program_evaluators"); + CONST_CAST(GLEW_APPLE_vertex_program_evaluators) = _glewSearchExtension("GL_APPLE_vertex_program_evaluators", extStart, extEnd); if (glewExperimental || GLEW_APPLE_vertex_program_evaluators) CONST_CAST(GLEW_APPLE_vertex_program_evaluators) = !_glewInit_GL_APPLE_vertex_program_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_APPLE_vertex_program_evaluators */ #ifdef GL_APPLE_ycbcr_422 - CONST_CAST(GLEW_APPLE_ycbcr_422) = glewGetExtension("GL_APPLE_ycbcr_422"); + CONST_CAST(GLEW_APPLE_ycbcr_422) = _glewSearchExtension("GL_APPLE_ycbcr_422", extStart, extEnd); #endif /* GL_APPLE_ycbcr_422 */ #ifdef GL_ARB_ES2_compatibility - CONST_CAST(GLEW_ARB_ES2_compatibility) = glewGetExtension("GL_ARB_ES2_compatibility"); + CONST_CAST(GLEW_ARB_ES2_compatibility) = _glewSearchExtension("GL_ARB_ES2_compatibility", extStart, extEnd); if (glewExperimental || GLEW_ARB_ES2_compatibility) CONST_CAST(GLEW_ARB_ES2_compatibility) = !_glewInit_GL_ARB_ES2_compatibility(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_ES2_compatibility */ #ifdef GL_ARB_blend_func_extended - CONST_CAST(GLEW_ARB_blend_func_extended) = glewGetExtension("GL_ARB_blend_func_extended"); + CONST_CAST(GLEW_ARB_blend_func_extended) = _glewSearchExtension("GL_ARB_blend_func_extended", extStart, extEnd); if (glewExperimental || GLEW_ARB_blend_func_extended) CONST_CAST(GLEW_ARB_blend_func_extended) = !_glewInit_GL_ARB_blend_func_extended(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_blend_func_extended */ #ifdef GL_ARB_cl_event - CONST_CAST(GLEW_ARB_cl_event) = glewGetExtension("GL_ARB_cl_event"); + CONST_CAST(GLEW_ARB_cl_event) = _glewSearchExtension("GL_ARB_cl_event", extStart, extEnd); if (glewExperimental || GLEW_ARB_cl_event) CONST_CAST(GLEW_ARB_cl_event) = !_glewInit_GL_ARB_cl_event(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_cl_event */ #ifdef GL_ARB_color_buffer_float - CONST_CAST(GLEW_ARB_color_buffer_float) = glewGetExtension("GL_ARB_color_buffer_float"); + CONST_CAST(GLEW_ARB_color_buffer_float) = _glewSearchExtension("GL_ARB_color_buffer_float", extStart, extEnd); if (glewExperimental || GLEW_ARB_color_buffer_float) CONST_CAST(GLEW_ARB_color_buffer_float) = !_glewInit_GL_ARB_color_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_color_buffer_float */ #ifdef GL_ARB_compatibility - CONST_CAST(GLEW_ARB_compatibility) = glewGetExtension("GL_ARB_compatibility"); + CONST_CAST(GLEW_ARB_compatibility) = _glewSearchExtension("GL_ARB_compatibility", extStart, extEnd); #endif /* GL_ARB_compatibility */ #ifdef GL_ARB_copy_buffer - CONST_CAST(GLEW_ARB_copy_buffer) = glewGetExtension("GL_ARB_copy_buffer"); + CONST_CAST(GLEW_ARB_copy_buffer) = _glewSearchExtension("GL_ARB_copy_buffer", extStart, extEnd); if (glewExperimental || GLEW_ARB_copy_buffer) CONST_CAST(GLEW_ARB_copy_buffer) = !_glewInit_GL_ARB_copy_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_copy_buffer */ #ifdef GL_ARB_debug_output - CONST_CAST(GLEW_ARB_debug_output) = glewGetExtension("GL_ARB_debug_output"); + CONST_CAST(GLEW_ARB_debug_output) = _glewSearchExtension("GL_ARB_debug_output", extStart, extEnd); if (glewExperimental || GLEW_ARB_debug_output) CONST_CAST(GLEW_ARB_debug_output) = !_glewInit_GL_ARB_debug_output(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_debug_output */ #ifdef GL_ARB_depth_buffer_float - CONST_CAST(GLEW_ARB_depth_buffer_float) = glewGetExtension("GL_ARB_depth_buffer_float"); + CONST_CAST(GLEW_ARB_depth_buffer_float) = _glewSearchExtension("GL_ARB_depth_buffer_float", extStart, extEnd); #endif /* GL_ARB_depth_buffer_float */ #ifdef GL_ARB_depth_clamp - CONST_CAST(GLEW_ARB_depth_clamp) = glewGetExtension("GL_ARB_depth_clamp"); + CONST_CAST(GLEW_ARB_depth_clamp) = _glewSearchExtension("GL_ARB_depth_clamp", extStart, extEnd); #endif /* GL_ARB_depth_clamp */ #ifdef GL_ARB_depth_texture - CONST_CAST(GLEW_ARB_depth_texture) = glewGetExtension("GL_ARB_depth_texture"); + CONST_CAST(GLEW_ARB_depth_texture) = _glewSearchExtension("GL_ARB_depth_texture", extStart, extEnd); #endif /* GL_ARB_depth_texture */ #ifdef GL_ARB_draw_buffers - CONST_CAST(GLEW_ARB_draw_buffers) = glewGetExtension("GL_ARB_draw_buffers"); + CONST_CAST(GLEW_ARB_draw_buffers) = _glewSearchExtension("GL_ARB_draw_buffers", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_buffers) CONST_CAST(GLEW_ARB_draw_buffers) = !_glewInit_GL_ARB_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_buffers */ #ifdef GL_ARB_draw_buffers_blend - CONST_CAST(GLEW_ARB_draw_buffers_blend) = glewGetExtension("GL_ARB_draw_buffers_blend"); + CONST_CAST(GLEW_ARB_draw_buffers_blend) = _glewSearchExtension("GL_ARB_draw_buffers_blend", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_buffers_blend) CONST_CAST(GLEW_ARB_draw_buffers_blend) = !_glewInit_GL_ARB_draw_buffers_blend(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_buffers_blend */ #ifdef GL_ARB_draw_elements_base_vertex - CONST_CAST(GLEW_ARB_draw_elements_base_vertex) = glewGetExtension("GL_ARB_draw_elements_base_vertex"); + CONST_CAST(GLEW_ARB_draw_elements_base_vertex) = _glewSearchExtension("GL_ARB_draw_elements_base_vertex", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_elements_base_vertex) CONST_CAST(GLEW_ARB_draw_elements_base_vertex) = !_glewInit_GL_ARB_draw_elements_base_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_elements_base_vertex */ #ifdef GL_ARB_draw_indirect - CONST_CAST(GLEW_ARB_draw_indirect) = glewGetExtension("GL_ARB_draw_indirect"); + CONST_CAST(GLEW_ARB_draw_indirect) = _glewSearchExtension("GL_ARB_draw_indirect", extStart, extEnd); if (glewExperimental || GLEW_ARB_draw_indirect) CONST_CAST(GLEW_ARB_draw_indirect) = !_glewInit_GL_ARB_draw_indirect(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_draw_indirect */ #ifdef GL_ARB_draw_instanced - CONST_CAST(GLEW_ARB_draw_instanced) = glewGetExtension("GL_ARB_draw_instanced"); - if (glewExperimental || GLEW_ARB_draw_instanced) CONST_CAST(GLEW_ARB_draw_instanced) = !_glewInit_GL_ARB_draw_instanced(GLEW_CONTEXT_ARG_VAR_INIT); + CONST_CAST(GLEW_ARB_draw_instanced) = _glewSearchExtension("GL_ARB_draw_instanced", extStart, extEnd); #endif /* GL_ARB_draw_instanced */ #ifdef GL_ARB_explicit_attrib_location - CONST_CAST(GLEW_ARB_explicit_attrib_location) = glewGetExtension("GL_ARB_explicit_attrib_location"); + CONST_CAST(GLEW_ARB_explicit_attrib_location) = _glewSearchExtension("GL_ARB_explicit_attrib_location", extStart, extEnd); #endif /* GL_ARB_explicit_attrib_location */ #ifdef GL_ARB_fragment_coord_conventions - CONST_CAST(GLEW_ARB_fragment_coord_conventions) = glewGetExtension("GL_ARB_fragment_coord_conventions"); + CONST_CAST(GLEW_ARB_fragment_coord_conventions) = _glewSearchExtension("GL_ARB_fragment_coord_conventions", extStart, extEnd); #endif /* GL_ARB_fragment_coord_conventions */ #ifdef GL_ARB_fragment_program - CONST_CAST(GLEW_ARB_fragment_program) = glewGetExtension("GL_ARB_fragment_program"); + CONST_CAST(GLEW_ARB_fragment_program) = _glewSearchExtension("GL_ARB_fragment_program", extStart, extEnd); #endif /* GL_ARB_fragment_program */ #ifdef GL_ARB_fragment_program_shadow - CONST_CAST(GLEW_ARB_fragment_program_shadow) = glewGetExtension("GL_ARB_fragment_program_shadow"); + CONST_CAST(GLEW_ARB_fragment_program_shadow) = _glewSearchExtension("GL_ARB_fragment_program_shadow", extStart, extEnd); #endif /* GL_ARB_fragment_program_shadow */ #ifdef GL_ARB_fragment_shader - CONST_CAST(GLEW_ARB_fragment_shader) = glewGetExtension("GL_ARB_fragment_shader"); + CONST_CAST(GLEW_ARB_fragment_shader) = _glewSearchExtension("GL_ARB_fragment_shader", extStart, extEnd); #endif /* GL_ARB_fragment_shader */ #ifdef GL_ARB_framebuffer_object - CONST_CAST(GLEW_ARB_framebuffer_object) = glewGetExtension("GL_ARB_framebuffer_object"); + CONST_CAST(GLEW_ARB_framebuffer_object) = _glewSearchExtension("GL_ARB_framebuffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_framebuffer_object) CONST_CAST(GLEW_ARB_framebuffer_object) = !_glewInit_GL_ARB_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_framebuffer_object */ #ifdef GL_ARB_framebuffer_sRGB - CONST_CAST(GLEW_ARB_framebuffer_sRGB) = glewGetExtension("GL_ARB_framebuffer_sRGB"); + CONST_CAST(GLEW_ARB_framebuffer_sRGB) = _glewSearchExtension("GL_ARB_framebuffer_sRGB", extStart, extEnd); #endif /* GL_ARB_framebuffer_sRGB */ #ifdef GL_ARB_geometry_shader4 - CONST_CAST(GLEW_ARB_geometry_shader4) = glewGetExtension("GL_ARB_geometry_shader4"); + CONST_CAST(GLEW_ARB_geometry_shader4) = _glewSearchExtension("GL_ARB_geometry_shader4", extStart, extEnd); if (glewExperimental || GLEW_ARB_geometry_shader4) CONST_CAST(GLEW_ARB_geometry_shader4) = !_glewInit_GL_ARB_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_geometry_shader4 */ #ifdef GL_ARB_get_program_binary - CONST_CAST(GLEW_ARB_get_program_binary) = glewGetExtension("GL_ARB_get_program_binary"); + CONST_CAST(GLEW_ARB_get_program_binary) = _glewSearchExtension("GL_ARB_get_program_binary", extStart, extEnd); if (glewExperimental || GLEW_ARB_get_program_binary) CONST_CAST(GLEW_ARB_get_program_binary) = !_glewInit_GL_ARB_get_program_binary(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_get_program_binary */ #ifdef GL_ARB_gpu_shader5 - CONST_CAST(GLEW_ARB_gpu_shader5) = glewGetExtension("GL_ARB_gpu_shader5"); + CONST_CAST(GLEW_ARB_gpu_shader5) = _glewSearchExtension("GL_ARB_gpu_shader5", extStart, extEnd); #endif /* GL_ARB_gpu_shader5 */ #ifdef GL_ARB_gpu_shader_fp64 - CONST_CAST(GLEW_ARB_gpu_shader_fp64) = glewGetExtension("GL_ARB_gpu_shader_fp64"); + CONST_CAST(GLEW_ARB_gpu_shader_fp64) = _glewSearchExtension("GL_ARB_gpu_shader_fp64", extStart, extEnd); if (glewExperimental || GLEW_ARB_gpu_shader_fp64) CONST_CAST(GLEW_ARB_gpu_shader_fp64) = !_glewInit_GL_ARB_gpu_shader_fp64(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_gpu_shader_fp64 */ #ifdef GL_ARB_half_float_pixel - CONST_CAST(GLEW_ARB_half_float_pixel) = glewGetExtension("GL_ARB_half_float_pixel"); + CONST_CAST(GLEW_ARB_half_float_pixel) = _glewSearchExtension("GL_ARB_half_float_pixel", extStart, extEnd); #endif /* GL_ARB_half_float_pixel */ #ifdef GL_ARB_half_float_vertex - CONST_CAST(GLEW_ARB_half_float_vertex) = glewGetExtension("GL_ARB_half_float_vertex"); + CONST_CAST(GLEW_ARB_half_float_vertex) = _glewSearchExtension("GL_ARB_half_float_vertex", extStart, extEnd); #endif /* GL_ARB_half_float_vertex */ #ifdef GL_ARB_imaging - CONST_CAST(GLEW_ARB_imaging) = glewGetExtension("GL_ARB_imaging"); + CONST_CAST(GLEW_ARB_imaging) = _glewSearchExtension("GL_ARB_imaging", extStart, extEnd); if (glewExperimental || GLEW_ARB_imaging) CONST_CAST(GLEW_ARB_imaging) = !_glewInit_GL_ARB_imaging(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_imaging */ #ifdef GL_ARB_instanced_arrays - CONST_CAST(GLEW_ARB_instanced_arrays) = glewGetExtension("GL_ARB_instanced_arrays"); + CONST_CAST(GLEW_ARB_instanced_arrays) = _glewSearchExtension("GL_ARB_instanced_arrays", extStart, extEnd); if (glewExperimental || GLEW_ARB_instanced_arrays) CONST_CAST(GLEW_ARB_instanced_arrays) = !_glewInit_GL_ARB_instanced_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_instanced_arrays */ #ifdef GL_ARB_map_buffer_range - CONST_CAST(GLEW_ARB_map_buffer_range) = glewGetExtension("GL_ARB_map_buffer_range"); + CONST_CAST(GLEW_ARB_map_buffer_range) = _glewSearchExtension("GL_ARB_map_buffer_range", extStart, extEnd); if (glewExperimental || GLEW_ARB_map_buffer_range) CONST_CAST(GLEW_ARB_map_buffer_range) = !_glewInit_GL_ARB_map_buffer_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_map_buffer_range */ #ifdef GL_ARB_matrix_palette - CONST_CAST(GLEW_ARB_matrix_palette) = glewGetExtension("GL_ARB_matrix_palette"); + CONST_CAST(GLEW_ARB_matrix_palette) = _glewSearchExtension("GL_ARB_matrix_palette", extStart, extEnd); if (glewExperimental || GLEW_ARB_matrix_palette) CONST_CAST(GLEW_ARB_matrix_palette) = !_glewInit_GL_ARB_matrix_palette(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_matrix_palette */ #ifdef GL_ARB_multisample - CONST_CAST(GLEW_ARB_multisample) = glewGetExtension("GL_ARB_multisample"); + CONST_CAST(GLEW_ARB_multisample) = _glewSearchExtension("GL_ARB_multisample", extStart, extEnd); if (glewExperimental || GLEW_ARB_multisample) CONST_CAST(GLEW_ARB_multisample) = !_glewInit_GL_ARB_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_multisample */ #ifdef GL_ARB_multitexture - CONST_CAST(GLEW_ARB_multitexture) = glewGetExtension("GL_ARB_multitexture"); + CONST_CAST(GLEW_ARB_multitexture) = _glewSearchExtension("GL_ARB_multitexture", extStart, extEnd); if (glewExperimental || GLEW_ARB_multitexture) CONST_CAST(GLEW_ARB_multitexture) = !_glewInit_GL_ARB_multitexture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_multitexture */ #ifdef GL_ARB_occlusion_query - CONST_CAST(GLEW_ARB_occlusion_query) = glewGetExtension("GL_ARB_occlusion_query"); + CONST_CAST(GLEW_ARB_occlusion_query) = _glewSearchExtension("GL_ARB_occlusion_query", extStart, extEnd); if (glewExperimental || GLEW_ARB_occlusion_query) CONST_CAST(GLEW_ARB_occlusion_query) = !_glewInit_GL_ARB_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_occlusion_query */ #ifdef GL_ARB_occlusion_query2 - CONST_CAST(GLEW_ARB_occlusion_query2) = glewGetExtension("GL_ARB_occlusion_query2"); + CONST_CAST(GLEW_ARB_occlusion_query2) = _glewSearchExtension("GL_ARB_occlusion_query2", extStart, extEnd); #endif /* GL_ARB_occlusion_query2 */ #ifdef GL_ARB_pixel_buffer_object - CONST_CAST(GLEW_ARB_pixel_buffer_object) = glewGetExtension("GL_ARB_pixel_buffer_object"); + CONST_CAST(GLEW_ARB_pixel_buffer_object) = _glewSearchExtension("GL_ARB_pixel_buffer_object", extStart, extEnd); #endif /* GL_ARB_pixel_buffer_object */ #ifdef GL_ARB_point_parameters - CONST_CAST(GLEW_ARB_point_parameters) = glewGetExtension("GL_ARB_point_parameters"); + CONST_CAST(GLEW_ARB_point_parameters) = _glewSearchExtension("GL_ARB_point_parameters", extStart, extEnd); if (glewExperimental || GLEW_ARB_point_parameters) CONST_CAST(GLEW_ARB_point_parameters) = !_glewInit_GL_ARB_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_point_parameters */ #ifdef GL_ARB_point_sprite - CONST_CAST(GLEW_ARB_point_sprite) = glewGetExtension("GL_ARB_point_sprite"); + CONST_CAST(GLEW_ARB_point_sprite) = _glewSearchExtension("GL_ARB_point_sprite", extStart, extEnd); #endif /* GL_ARB_point_sprite */ #ifdef GL_ARB_provoking_vertex - CONST_CAST(GLEW_ARB_provoking_vertex) = glewGetExtension("GL_ARB_provoking_vertex"); + CONST_CAST(GLEW_ARB_provoking_vertex) = _glewSearchExtension("GL_ARB_provoking_vertex", extStart, extEnd); if (glewExperimental || GLEW_ARB_provoking_vertex) CONST_CAST(GLEW_ARB_provoking_vertex) = !_glewInit_GL_ARB_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_provoking_vertex */ #ifdef GL_ARB_robustness - CONST_CAST(GLEW_ARB_robustness) = glewGetExtension("GL_ARB_robustness"); + CONST_CAST(GLEW_ARB_robustness) = _glewSearchExtension("GL_ARB_robustness", extStart, extEnd); if (glewExperimental || GLEW_ARB_robustness) CONST_CAST(GLEW_ARB_robustness) = !_glewInit_GL_ARB_robustness(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_robustness */ #ifdef GL_ARB_sample_shading - CONST_CAST(GLEW_ARB_sample_shading) = glewGetExtension("GL_ARB_sample_shading"); + CONST_CAST(GLEW_ARB_sample_shading) = _glewSearchExtension("GL_ARB_sample_shading", extStart, extEnd); if (glewExperimental || GLEW_ARB_sample_shading) CONST_CAST(GLEW_ARB_sample_shading) = !_glewInit_GL_ARB_sample_shading(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_sample_shading */ #ifdef GL_ARB_sampler_objects - CONST_CAST(GLEW_ARB_sampler_objects) = glewGetExtension("GL_ARB_sampler_objects"); + CONST_CAST(GLEW_ARB_sampler_objects) = _glewSearchExtension("GL_ARB_sampler_objects", extStart, extEnd); if (glewExperimental || GLEW_ARB_sampler_objects) CONST_CAST(GLEW_ARB_sampler_objects) = !_glewInit_GL_ARB_sampler_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_sampler_objects */ #ifdef GL_ARB_seamless_cube_map - CONST_CAST(GLEW_ARB_seamless_cube_map) = glewGetExtension("GL_ARB_seamless_cube_map"); + CONST_CAST(GLEW_ARB_seamless_cube_map) = _glewSearchExtension("GL_ARB_seamless_cube_map", extStart, extEnd); #endif /* GL_ARB_seamless_cube_map */ #ifdef GL_ARB_separate_shader_objects - CONST_CAST(GLEW_ARB_separate_shader_objects) = glewGetExtension("GL_ARB_separate_shader_objects"); + CONST_CAST(GLEW_ARB_separate_shader_objects) = _glewSearchExtension("GL_ARB_separate_shader_objects", extStart, extEnd); if (glewExperimental || GLEW_ARB_separate_shader_objects) CONST_CAST(GLEW_ARB_separate_shader_objects) = !_glewInit_GL_ARB_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_separate_shader_objects */ #ifdef GL_ARB_shader_bit_encoding - CONST_CAST(GLEW_ARB_shader_bit_encoding) = glewGetExtension("GL_ARB_shader_bit_encoding"); + CONST_CAST(GLEW_ARB_shader_bit_encoding) = _glewSearchExtension("GL_ARB_shader_bit_encoding", extStart, extEnd); #endif /* GL_ARB_shader_bit_encoding */ #ifdef GL_ARB_shader_objects - CONST_CAST(GLEW_ARB_shader_objects) = glewGetExtension("GL_ARB_shader_objects"); + CONST_CAST(GLEW_ARB_shader_objects) = _glewSearchExtension("GL_ARB_shader_objects", extStart, extEnd); if (glewExperimental || GLEW_ARB_shader_objects) CONST_CAST(GLEW_ARB_shader_objects) = !_glewInit_GL_ARB_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shader_objects */ #ifdef GL_ARB_shader_precision - CONST_CAST(GLEW_ARB_shader_precision) = glewGetExtension("GL_ARB_shader_precision"); + CONST_CAST(GLEW_ARB_shader_precision) = _glewSearchExtension("GL_ARB_shader_precision", extStart, extEnd); #endif /* GL_ARB_shader_precision */ #ifdef GL_ARB_shader_stencil_export - CONST_CAST(GLEW_ARB_shader_stencil_export) = glewGetExtension("GL_ARB_shader_stencil_export"); + CONST_CAST(GLEW_ARB_shader_stencil_export) = _glewSearchExtension("GL_ARB_shader_stencil_export", extStart, extEnd); #endif /* GL_ARB_shader_stencil_export */ #ifdef GL_ARB_shader_subroutine - CONST_CAST(GLEW_ARB_shader_subroutine) = glewGetExtension("GL_ARB_shader_subroutine"); + CONST_CAST(GLEW_ARB_shader_subroutine) = _glewSearchExtension("GL_ARB_shader_subroutine", extStart, extEnd); if (glewExperimental || GLEW_ARB_shader_subroutine) CONST_CAST(GLEW_ARB_shader_subroutine) = !_glewInit_GL_ARB_shader_subroutine(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shader_subroutine */ #ifdef GL_ARB_shader_texture_lod - CONST_CAST(GLEW_ARB_shader_texture_lod) = glewGetExtension("GL_ARB_shader_texture_lod"); + CONST_CAST(GLEW_ARB_shader_texture_lod) = _glewSearchExtension("GL_ARB_shader_texture_lod", extStart, extEnd); #endif /* GL_ARB_shader_texture_lod */ #ifdef GL_ARB_shading_language_100 - CONST_CAST(GLEW_ARB_shading_language_100) = glewGetExtension("GL_ARB_shading_language_100"); + CONST_CAST(GLEW_ARB_shading_language_100) = _glewSearchExtension("GL_ARB_shading_language_100", extStart, extEnd); #endif /* GL_ARB_shading_language_100 */ #ifdef GL_ARB_shading_language_include - CONST_CAST(GLEW_ARB_shading_language_include) = glewGetExtension("GL_ARB_shading_language_include"); + CONST_CAST(GLEW_ARB_shading_language_include) = _glewSearchExtension("GL_ARB_shading_language_include", extStart, extEnd); if (glewExperimental || GLEW_ARB_shading_language_include) CONST_CAST(GLEW_ARB_shading_language_include) = !_glewInit_GL_ARB_shading_language_include(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_shading_language_include */ #ifdef GL_ARB_shadow - CONST_CAST(GLEW_ARB_shadow) = glewGetExtension("GL_ARB_shadow"); + CONST_CAST(GLEW_ARB_shadow) = _glewSearchExtension("GL_ARB_shadow", extStart, extEnd); #endif /* GL_ARB_shadow */ #ifdef GL_ARB_shadow_ambient - CONST_CAST(GLEW_ARB_shadow_ambient) = glewGetExtension("GL_ARB_shadow_ambient"); + CONST_CAST(GLEW_ARB_shadow_ambient) = _glewSearchExtension("GL_ARB_shadow_ambient", extStart, extEnd); #endif /* GL_ARB_shadow_ambient */ #ifdef GL_ARB_sync - CONST_CAST(GLEW_ARB_sync) = glewGetExtension("GL_ARB_sync"); + CONST_CAST(GLEW_ARB_sync) = _glewSearchExtension("GL_ARB_sync", extStart, extEnd); if (glewExperimental || GLEW_ARB_sync) CONST_CAST(GLEW_ARB_sync) = !_glewInit_GL_ARB_sync(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_sync */ #ifdef GL_ARB_tessellation_shader - CONST_CAST(GLEW_ARB_tessellation_shader) = glewGetExtension("GL_ARB_tessellation_shader"); + CONST_CAST(GLEW_ARB_tessellation_shader) = _glewSearchExtension("GL_ARB_tessellation_shader", extStart, extEnd); if (glewExperimental || GLEW_ARB_tessellation_shader) CONST_CAST(GLEW_ARB_tessellation_shader) = !_glewInit_GL_ARB_tessellation_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_tessellation_shader */ #ifdef GL_ARB_texture_border_clamp - CONST_CAST(GLEW_ARB_texture_border_clamp) = glewGetExtension("GL_ARB_texture_border_clamp"); + CONST_CAST(GLEW_ARB_texture_border_clamp) = _glewSearchExtension("GL_ARB_texture_border_clamp", extStart, extEnd); #endif /* GL_ARB_texture_border_clamp */ #ifdef GL_ARB_texture_buffer_object - CONST_CAST(GLEW_ARB_texture_buffer_object) = glewGetExtension("GL_ARB_texture_buffer_object"); + CONST_CAST(GLEW_ARB_texture_buffer_object) = _glewSearchExtension("GL_ARB_texture_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_buffer_object) CONST_CAST(GLEW_ARB_texture_buffer_object) = !_glewInit_GL_ARB_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_buffer_object */ #ifdef GL_ARB_texture_buffer_object_rgb32 - CONST_CAST(GLEW_ARB_texture_buffer_object_rgb32) = glewGetExtension("GL_ARB_texture_buffer_object_rgb32"); + CONST_CAST(GLEW_ARB_texture_buffer_object_rgb32) = _glewSearchExtension("GL_ARB_texture_buffer_object_rgb32", extStart, extEnd); #endif /* GL_ARB_texture_buffer_object_rgb32 */ #ifdef GL_ARB_texture_compression - CONST_CAST(GLEW_ARB_texture_compression) = glewGetExtension("GL_ARB_texture_compression"); + CONST_CAST(GLEW_ARB_texture_compression) = _glewSearchExtension("GL_ARB_texture_compression", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_compression) CONST_CAST(GLEW_ARB_texture_compression) = !_glewInit_GL_ARB_texture_compression(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_compression */ #ifdef GL_ARB_texture_compression_bptc - CONST_CAST(GLEW_ARB_texture_compression_bptc) = glewGetExtension("GL_ARB_texture_compression_bptc"); + CONST_CAST(GLEW_ARB_texture_compression_bptc) = _glewSearchExtension("GL_ARB_texture_compression_bptc", extStart, extEnd); #endif /* GL_ARB_texture_compression_bptc */ #ifdef GL_ARB_texture_compression_rgtc - CONST_CAST(GLEW_ARB_texture_compression_rgtc) = glewGetExtension("GL_ARB_texture_compression_rgtc"); + CONST_CAST(GLEW_ARB_texture_compression_rgtc) = _glewSearchExtension("GL_ARB_texture_compression_rgtc", extStart, extEnd); #endif /* GL_ARB_texture_compression_rgtc */ #ifdef GL_ARB_texture_cube_map - CONST_CAST(GLEW_ARB_texture_cube_map) = glewGetExtension("GL_ARB_texture_cube_map"); + CONST_CAST(GLEW_ARB_texture_cube_map) = _glewSearchExtension("GL_ARB_texture_cube_map", extStart, extEnd); #endif /* GL_ARB_texture_cube_map */ #ifdef GL_ARB_texture_cube_map_array - CONST_CAST(GLEW_ARB_texture_cube_map_array) = glewGetExtension("GL_ARB_texture_cube_map_array"); + CONST_CAST(GLEW_ARB_texture_cube_map_array) = _glewSearchExtension("GL_ARB_texture_cube_map_array", extStart, extEnd); #endif /* GL_ARB_texture_cube_map_array */ #ifdef GL_ARB_texture_env_add - CONST_CAST(GLEW_ARB_texture_env_add) = glewGetExtension("GL_ARB_texture_env_add"); + CONST_CAST(GLEW_ARB_texture_env_add) = _glewSearchExtension("GL_ARB_texture_env_add", extStart, extEnd); #endif /* GL_ARB_texture_env_add */ #ifdef GL_ARB_texture_env_combine - CONST_CAST(GLEW_ARB_texture_env_combine) = glewGetExtension("GL_ARB_texture_env_combine"); + CONST_CAST(GLEW_ARB_texture_env_combine) = _glewSearchExtension("GL_ARB_texture_env_combine", extStart, extEnd); #endif /* GL_ARB_texture_env_combine */ #ifdef GL_ARB_texture_env_crossbar - CONST_CAST(GLEW_ARB_texture_env_crossbar) = glewGetExtension("GL_ARB_texture_env_crossbar"); + CONST_CAST(GLEW_ARB_texture_env_crossbar) = _glewSearchExtension("GL_ARB_texture_env_crossbar", extStart, extEnd); #endif /* GL_ARB_texture_env_crossbar */ #ifdef GL_ARB_texture_env_dot3 - CONST_CAST(GLEW_ARB_texture_env_dot3) = glewGetExtension("GL_ARB_texture_env_dot3"); + CONST_CAST(GLEW_ARB_texture_env_dot3) = _glewSearchExtension("GL_ARB_texture_env_dot3", extStart, extEnd); #endif /* GL_ARB_texture_env_dot3 */ #ifdef GL_ARB_texture_float - CONST_CAST(GLEW_ARB_texture_float) = glewGetExtension("GL_ARB_texture_float"); + CONST_CAST(GLEW_ARB_texture_float) = _glewSearchExtension("GL_ARB_texture_float", extStart, extEnd); #endif /* GL_ARB_texture_float */ #ifdef GL_ARB_texture_gather - CONST_CAST(GLEW_ARB_texture_gather) = glewGetExtension("GL_ARB_texture_gather"); + CONST_CAST(GLEW_ARB_texture_gather) = _glewSearchExtension("GL_ARB_texture_gather", extStart, extEnd); #endif /* GL_ARB_texture_gather */ #ifdef GL_ARB_texture_mirrored_repeat - CONST_CAST(GLEW_ARB_texture_mirrored_repeat) = glewGetExtension("GL_ARB_texture_mirrored_repeat"); + CONST_CAST(GLEW_ARB_texture_mirrored_repeat) = _glewSearchExtension("GL_ARB_texture_mirrored_repeat", extStart, extEnd); #endif /* GL_ARB_texture_mirrored_repeat */ #ifdef GL_ARB_texture_multisample - CONST_CAST(GLEW_ARB_texture_multisample) = glewGetExtension("GL_ARB_texture_multisample"); + CONST_CAST(GLEW_ARB_texture_multisample) = _glewSearchExtension("GL_ARB_texture_multisample", extStart, extEnd); if (glewExperimental || GLEW_ARB_texture_multisample) CONST_CAST(GLEW_ARB_texture_multisample) = !_glewInit_GL_ARB_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_texture_multisample */ #ifdef GL_ARB_texture_non_power_of_two - CONST_CAST(GLEW_ARB_texture_non_power_of_two) = glewGetExtension("GL_ARB_texture_non_power_of_two"); + CONST_CAST(GLEW_ARB_texture_non_power_of_two) = _glewSearchExtension("GL_ARB_texture_non_power_of_two", extStart, extEnd); #endif /* GL_ARB_texture_non_power_of_two */ #ifdef GL_ARB_texture_query_lod - CONST_CAST(GLEW_ARB_texture_query_lod) = glewGetExtension("GL_ARB_texture_query_lod"); + CONST_CAST(GLEW_ARB_texture_query_lod) = _glewSearchExtension("GL_ARB_texture_query_lod", extStart, extEnd); #endif /* GL_ARB_texture_query_lod */ #ifdef GL_ARB_texture_rectangle - CONST_CAST(GLEW_ARB_texture_rectangle) = glewGetExtension("GL_ARB_texture_rectangle"); + CONST_CAST(GLEW_ARB_texture_rectangle) = _glewSearchExtension("GL_ARB_texture_rectangle", extStart, extEnd); #endif /* GL_ARB_texture_rectangle */ #ifdef GL_ARB_texture_rg - CONST_CAST(GLEW_ARB_texture_rg) = glewGetExtension("GL_ARB_texture_rg"); + CONST_CAST(GLEW_ARB_texture_rg) = _glewSearchExtension("GL_ARB_texture_rg", extStart, extEnd); #endif /* GL_ARB_texture_rg */ #ifdef GL_ARB_texture_rgb10_a2ui - CONST_CAST(GLEW_ARB_texture_rgb10_a2ui) = glewGetExtension("GL_ARB_texture_rgb10_a2ui"); + CONST_CAST(GLEW_ARB_texture_rgb10_a2ui) = _glewSearchExtension("GL_ARB_texture_rgb10_a2ui", extStart, extEnd); #endif /* GL_ARB_texture_rgb10_a2ui */ #ifdef GL_ARB_texture_swizzle - CONST_CAST(GLEW_ARB_texture_swizzle) = glewGetExtension("GL_ARB_texture_swizzle"); + CONST_CAST(GLEW_ARB_texture_swizzle) = _glewSearchExtension("GL_ARB_texture_swizzle", extStart, extEnd); #endif /* GL_ARB_texture_swizzle */ #ifdef GL_ARB_timer_query - CONST_CAST(GLEW_ARB_timer_query) = glewGetExtension("GL_ARB_timer_query"); + CONST_CAST(GLEW_ARB_timer_query) = _glewSearchExtension("GL_ARB_timer_query", extStart, extEnd); if (glewExperimental || GLEW_ARB_timer_query) CONST_CAST(GLEW_ARB_timer_query) = !_glewInit_GL_ARB_timer_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_timer_query */ #ifdef GL_ARB_transform_feedback2 - CONST_CAST(GLEW_ARB_transform_feedback2) = glewGetExtension("GL_ARB_transform_feedback2"); + CONST_CAST(GLEW_ARB_transform_feedback2) = _glewSearchExtension("GL_ARB_transform_feedback2", extStart, extEnd); if (glewExperimental || GLEW_ARB_transform_feedback2) CONST_CAST(GLEW_ARB_transform_feedback2) = !_glewInit_GL_ARB_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_transform_feedback2 */ #ifdef GL_ARB_transform_feedback3 - CONST_CAST(GLEW_ARB_transform_feedback3) = glewGetExtension("GL_ARB_transform_feedback3"); + CONST_CAST(GLEW_ARB_transform_feedback3) = _glewSearchExtension("GL_ARB_transform_feedback3", extStart, extEnd); if (glewExperimental || GLEW_ARB_transform_feedback3) CONST_CAST(GLEW_ARB_transform_feedback3) = !_glewInit_GL_ARB_transform_feedback3(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_transform_feedback3 */ #ifdef GL_ARB_transpose_matrix - CONST_CAST(GLEW_ARB_transpose_matrix) = glewGetExtension("GL_ARB_transpose_matrix"); + CONST_CAST(GLEW_ARB_transpose_matrix) = _glewSearchExtension("GL_ARB_transpose_matrix", extStart, extEnd); if (glewExperimental || GLEW_ARB_transpose_matrix) CONST_CAST(GLEW_ARB_transpose_matrix) = !_glewInit_GL_ARB_transpose_matrix(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_transpose_matrix */ #ifdef GL_ARB_uniform_buffer_object - CONST_CAST(GLEW_ARB_uniform_buffer_object) = glewGetExtension("GL_ARB_uniform_buffer_object"); + CONST_CAST(GLEW_ARB_uniform_buffer_object) = _glewSearchExtension("GL_ARB_uniform_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_uniform_buffer_object) CONST_CAST(GLEW_ARB_uniform_buffer_object) = !_glewInit_GL_ARB_uniform_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_uniform_buffer_object */ #ifdef GL_ARB_vertex_array_bgra - CONST_CAST(GLEW_ARB_vertex_array_bgra) = glewGetExtension("GL_ARB_vertex_array_bgra"); + CONST_CAST(GLEW_ARB_vertex_array_bgra) = _glewSearchExtension("GL_ARB_vertex_array_bgra", extStart, extEnd); #endif /* GL_ARB_vertex_array_bgra */ #ifdef GL_ARB_vertex_array_object - CONST_CAST(GLEW_ARB_vertex_array_object) = glewGetExtension("GL_ARB_vertex_array_object"); + CONST_CAST(GLEW_ARB_vertex_array_object) = _glewSearchExtension("GL_ARB_vertex_array_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_array_object) CONST_CAST(GLEW_ARB_vertex_array_object) = !_glewInit_GL_ARB_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_array_object */ #ifdef GL_ARB_vertex_attrib_64bit - CONST_CAST(GLEW_ARB_vertex_attrib_64bit) = glewGetExtension("GL_ARB_vertex_attrib_64bit"); + CONST_CAST(GLEW_ARB_vertex_attrib_64bit) = _glewSearchExtension("GL_ARB_vertex_attrib_64bit", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_attrib_64bit) CONST_CAST(GLEW_ARB_vertex_attrib_64bit) = !_glewInit_GL_ARB_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_attrib_64bit */ #ifdef GL_ARB_vertex_blend - CONST_CAST(GLEW_ARB_vertex_blend) = glewGetExtension("GL_ARB_vertex_blend"); + CONST_CAST(GLEW_ARB_vertex_blend) = _glewSearchExtension("GL_ARB_vertex_blend", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_blend) CONST_CAST(GLEW_ARB_vertex_blend) = !_glewInit_GL_ARB_vertex_blend(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_blend */ #ifdef GL_ARB_vertex_buffer_object - CONST_CAST(GLEW_ARB_vertex_buffer_object) = glewGetExtension("GL_ARB_vertex_buffer_object"); + CONST_CAST(GLEW_ARB_vertex_buffer_object) = _glewSearchExtension("GL_ARB_vertex_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_buffer_object) CONST_CAST(GLEW_ARB_vertex_buffer_object) = !_glewInit_GL_ARB_vertex_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_buffer_object */ #ifdef GL_ARB_vertex_program - CONST_CAST(GLEW_ARB_vertex_program) = glewGetExtension("GL_ARB_vertex_program"); + CONST_CAST(GLEW_ARB_vertex_program) = _glewSearchExtension("GL_ARB_vertex_program", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_program) CONST_CAST(GLEW_ARB_vertex_program) = !_glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_program */ #ifdef GL_ARB_vertex_shader - CONST_CAST(GLEW_ARB_vertex_shader) = glewGetExtension("GL_ARB_vertex_shader"); + CONST_CAST(GLEW_ARB_vertex_shader) = _glewSearchExtension("GL_ARB_vertex_shader", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_shader) CONST_CAST(GLEW_ARB_vertex_shader) = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_shader */ #ifdef GL_ARB_vertex_type_2_10_10_10_rev - CONST_CAST(GLEW_ARB_vertex_type_2_10_10_10_rev) = glewGetExtension("GL_ARB_vertex_type_2_10_10_10_rev"); + CONST_CAST(GLEW_ARB_vertex_type_2_10_10_10_rev) = _glewSearchExtension("GL_ARB_vertex_type_2_10_10_10_rev", extStart, extEnd); if (glewExperimental || GLEW_ARB_vertex_type_2_10_10_10_rev) CONST_CAST(GLEW_ARB_vertex_type_2_10_10_10_rev) = !_glewInit_GL_ARB_vertex_type_2_10_10_10_rev(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_vertex_type_2_10_10_10_rev */ #ifdef GL_ARB_viewport_array - CONST_CAST(GLEW_ARB_viewport_array) = glewGetExtension("GL_ARB_viewport_array"); + CONST_CAST(GLEW_ARB_viewport_array) = _glewSearchExtension("GL_ARB_viewport_array", extStart, extEnd); if (glewExperimental || GLEW_ARB_viewport_array) CONST_CAST(GLEW_ARB_viewport_array) = !_glewInit_GL_ARB_viewport_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_viewport_array */ #ifdef GL_ARB_window_pos - CONST_CAST(GLEW_ARB_window_pos) = glewGetExtension("GL_ARB_window_pos"); + CONST_CAST(GLEW_ARB_window_pos) = _glewSearchExtension("GL_ARB_window_pos", extStart, extEnd); if (glewExperimental || GLEW_ARB_window_pos) CONST_CAST(GLEW_ARB_window_pos) = !_glewInit_GL_ARB_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ARB_window_pos */ #ifdef GL_ATIX_point_sprites - CONST_CAST(GLEW_ATIX_point_sprites) = glewGetExtension("GL_ATIX_point_sprites"); + CONST_CAST(GLEW_ATIX_point_sprites) = _glewSearchExtension("GL_ATIX_point_sprites", extStart, extEnd); #endif /* GL_ATIX_point_sprites */ #ifdef GL_ATIX_texture_env_combine3 - CONST_CAST(GLEW_ATIX_texture_env_combine3) = glewGetExtension("GL_ATIX_texture_env_combine3"); + CONST_CAST(GLEW_ATIX_texture_env_combine3) = _glewSearchExtension("GL_ATIX_texture_env_combine3", extStart, extEnd); #endif /* GL_ATIX_texture_env_combine3 */ #ifdef GL_ATIX_texture_env_route - CONST_CAST(GLEW_ATIX_texture_env_route) = glewGetExtension("GL_ATIX_texture_env_route"); + CONST_CAST(GLEW_ATIX_texture_env_route) = _glewSearchExtension("GL_ATIX_texture_env_route", extStart, extEnd); #endif /* GL_ATIX_texture_env_route */ #ifdef GL_ATIX_vertex_shader_output_point_size - CONST_CAST(GLEW_ATIX_vertex_shader_output_point_size) = glewGetExtension("GL_ATIX_vertex_shader_output_point_size"); + CONST_CAST(GLEW_ATIX_vertex_shader_output_point_size) = _glewSearchExtension("GL_ATIX_vertex_shader_output_point_size", extStart, extEnd); #endif /* GL_ATIX_vertex_shader_output_point_size */ #ifdef GL_ATI_draw_buffers - CONST_CAST(GLEW_ATI_draw_buffers) = glewGetExtension("GL_ATI_draw_buffers"); + CONST_CAST(GLEW_ATI_draw_buffers) = _glewSearchExtension("GL_ATI_draw_buffers", extStart, extEnd); if (glewExperimental || GLEW_ATI_draw_buffers) CONST_CAST(GLEW_ATI_draw_buffers) = !_glewInit_GL_ATI_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_draw_buffers */ #ifdef GL_ATI_element_array - CONST_CAST(GLEW_ATI_element_array) = glewGetExtension("GL_ATI_element_array"); + CONST_CAST(GLEW_ATI_element_array) = _glewSearchExtension("GL_ATI_element_array", extStart, extEnd); if (glewExperimental || GLEW_ATI_element_array) CONST_CAST(GLEW_ATI_element_array) = !_glewInit_GL_ATI_element_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_element_array */ #ifdef GL_ATI_envmap_bumpmap - CONST_CAST(GLEW_ATI_envmap_bumpmap) = glewGetExtension("GL_ATI_envmap_bumpmap"); + CONST_CAST(GLEW_ATI_envmap_bumpmap) = _glewSearchExtension("GL_ATI_envmap_bumpmap", extStart, extEnd); if (glewExperimental || GLEW_ATI_envmap_bumpmap) CONST_CAST(GLEW_ATI_envmap_bumpmap) = !_glewInit_GL_ATI_envmap_bumpmap(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_envmap_bumpmap */ #ifdef GL_ATI_fragment_shader - CONST_CAST(GLEW_ATI_fragment_shader) = glewGetExtension("GL_ATI_fragment_shader"); + CONST_CAST(GLEW_ATI_fragment_shader) = _glewSearchExtension("GL_ATI_fragment_shader", extStart, extEnd); if (glewExperimental || GLEW_ATI_fragment_shader) CONST_CAST(GLEW_ATI_fragment_shader) = !_glewInit_GL_ATI_fragment_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_fragment_shader */ #ifdef GL_ATI_map_object_buffer - CONST_CAST(GLEW_ATI_map_object_buffer) = glewGetExtension("GL_ATI_map_object_buffer"); + CONST_CAST(GLEW_ATI_map_object_buffer) = _glewSearchExtension("GL_ATI_map_object_buffer", extStart, extEnd); if (glewExperimental || GLEW_ATI_map_object_buffer) CONST_CAST(GLEW_ATI_map_object_buffer) = !_glewInit_GL_ATI_map_object_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_map_object_buffer */ #ifdef GL_ATI_meminfo - CONST_CAST(GLEW_ATI_meminfo) = glewGetExtension("GL_ATI_meminfo"); + CONST_CAST(GLEW_ATI_meminfo) = _glewSearchExtension("GL_ATI_meminfo", extStart, extEnd); #endif /* GL_ATI_meminfo */ #ifdef GL_ATI_pn_triangles - CONST_CAST(GLEW_ATI_pn_triangles) = glewGetExtension("GL_ATI_pn_triangles"); + CONST_CAST(GLEW_ATI_pn_triangles) = _glewSearchExtension("GL_ATI_pn_triangles", extStart, extEnd); if (glewExperimental || GLEW_ATI_pn_triangles) CONST_CAST(GLEW_ATI_pn_triangles) = !_glewInit_GL_ATI_pn_triangles(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_pn_triangles */ #ifdef GL_ATI_separate_stencil - CONST_CAST(GLEW_ATI_separate_stencil) = glewGetExtension("GL_ATI_separate_stencil"); + CONST_CAST(GLEW_ATI_separate_stencil) = _glewSearchExtension("GL_ATI_separate_stencil", extStart, extEnd); if (glewExperimental || GLEW_ATI_separate_stencil) CONST_CAST(GLEW_ATI_separate_stencil) = !_glewInit_GL_ATI_separate_stencil(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_separate_stencil */ #ifdef GL_ATI_shader_texture_lod - CONST_CAST(GLEW_ATI_shader_texture_lod) = glewGetExtension("GL_ATI_shader_texture_lod"); + CONST_CAST(GLEW_ATI_shader_texture_lod) = _glewSearchExtension("GL_ATI_shader_texture_lod", extStart, extEnd); #endif /* GL_ATI_shader_texture_lod */ #ifdef GL_ATI_text_fragment_shader - CONST_CAST(GLEW_ATI_text_fragment_shader) = glewGetExtension("GL_ATI_text_fragment_shader"); + CONST_CAST(GLEW_ATI_text_fragment_shader) = _glewSearchExtension("GL_ATI_text_fragment_shader", extStart, extEnd); #endif /* GL_ATI_text_fragment_shader */ #ifdef GL_ATI_texture_compression_3dc - CONST_CAST(GLEW_ATI_texture_compression_3dc) = glewGetExtension("GL_ATI_texture_compression_3dc"); + CONST_CAST(GLEW_ATI_texture_compression_3dc) = _glewSearchExtension("GL_ATI_texture_compression_3dc", extStart, extEnd); #endif /* GL_ATI_texture_compression_3dc */ #ifdef GL_ATI_texture_env_combine3 - CONST_CAST(GLEW_ATI_texture_env_combine3) = glewGetExtension("GL_ATI_texture_env_combine3"); + CONST_CAST(GLEW_ATI_texture_env_combine3) = _glewSearchExtension("GL_ATI_texture_env_combine3", extStart, extEnd); #endif /* GL_ATI_texture_env_combine3 */ #ifdef GL_ATI_texture_float - CONST_CAST(GLEW_ATI_texture_float) = glewGetExtension("GL_ATI_texture_float"); + CONST_CAST(GLEW_ATI_texture_float) = _glewSearchExtension("GL_ATI_texture_float", extStart, extEnd); #endif /* GL_ATI_texture_float */ #ifdef GL_ATI_texture_mirror_once - CONST_CAST(GLEW_ATI_texture_mirror_once) = glewGetExtension("GL_ATI_texture_mirror_once"); + CONST_CAST(GLEW_ATI_texture_mirror_once) = _glewSearchExtension("GL_ATI_texture_mirror_once", extStart, extEnd); #endif /* GL_ATI_texture_mirror_once */ #ifdef GL_ATI_vertex_array_object - CONST_CAST(GLEW_ATI_vertex_array_object) = glewGetExtension("GL_ATI_vertex_array_object"); + CONST_CAST(GLEW_ATI_vertex_array_object) = _glewSearchExtension("GL_ATI_vertex_array_object", extStart, extEnd); if (glewExperimental || GLEW_ATI_vertex_array_object) CONST_CAST(GLEW_ATI_vertex_array_object) = !_glewInit_GL_ATI_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_vertex_array_object */ #ifdef GL_ATI_vertex_attrib_array_object - CONST_CAST(GLEW_ATI_vertex_attrib_array_object) = glewGetExtension("GL_ATI_vertex_attrib_array_object"); + CONST_CAST(GLEW_ATI_vertex_attrib_array_object) = _glewSearchExtension("GL_ATI_vertex_attrib_array_object", extStart, extEnd); if (glewExperimental || GLEW_ATI_vertex_attrib_array_object) CONST_CAST(GLEW_ATI_vertex_attrib_array_object) = !_glewInit_GL_ATI_vertex_attrib_array_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_vertex_attrib_array_object */ #ifdef GL_ATI_vertex_streams - CONST_CAST(GLEW_ATI_vertex_streams) = glewGetExtension("GL_ATI_vertex_streams"); + CONST_CAST(GLEW_ATI_vertex_streams) = _glewSearchExtension("GL_ATI_vertex_streams", extStart, extEnd); if (glewExperimental || GLEW_ATI_vertex_streams) CONST_CAST(GLEW_ATI_vertex_streams) = !_glewInit_GL_ATI_vertex_streams(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_ATI_vertex_streams */ #ifdef GL_EXT_422_pixels - CONST_CAST(GLEW_EXT_422_pixels) = glewGetExtension("GL_EXT_422_pixels"); + CONST_CAST(GLEW_EXT_422_pixels) = _glewSearchExtension("GL_EXT_422_pixels", extStart, extEnd); #endif /* GL_EXT_422_pixels */ #ifdef GL_EXT_Cg_shader - CONST_CAST(GLEW_EXT_Cg_shader) = glewGetExtension("GL_EXT_Cg_shader"); + CONST_CAST(GLEW_EXT_Cg_shader) = _glewSearchExtension("GL_EXT_Cg_shader", extStart, extEnd); #endif /* GL_EXT_Cg_shader */ #ifdef GL_EXT_abgr - CONST_CAST(GLEW_EXT_abgr) = glewGetExtension("GL_EXT_abgr"); + CONST_CAST(GLEW_EXT_abgr) = _glewSearchExtension("GL_EXT_abgr", extStart, extEnd); #endif /* GL_EXT_abgr */ #ifdef GL_EXT_bgra - CONST_CAST(GLEW_EXT_bgra) = glewGetExtension("GL_EXT_bgra"); + CONST_CAST(GLEW_EXT_bgra) = _glewSearchExtension("GL_EXT_bgra", extStart, extEnd); #endif /* GL_EXT_bgra */ #ifdef GL_EXT_bindable_uniform - CONST_CAST(GLEW_EXT_bindable_uniform) = glewGetExtension("GL_EXT_bindable_uniform"); + CONST_CAST(GLEW_EXT_bindable_uniform) = _glewSearchExtension("GL_EXT_bindable_uniform", extStart, extEnd); if (glewExperimental || GLEW_EXT_bindable_uniform) CONST_CAST(GLEW_EXT_bindable_uniform) = !_glewInit_GL_EXT_bindable_uniform(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_bindable_uniform */ #ifdef GL_EXT_blend_color - CONST_CAST(GLEW_EXT_blend_color) = glewGetExtension("GL_EXT_blend_color"); + CONST_CAST(GLEW_EXT_blend_color) = _glewSearchExtension("GL_EXT_blend_color", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_color) CONST_CAST(GLEW_EXT_blend_color) = !_glewInit_GL_EXT_blend_color(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_color */ #ifdef GL_EXT_blend_equation_separate - CONST_CAST(GLEW_EXT_blend_equation_separate) = glewGetExtension("GL_EXT_blend_equation_separate"); + CONST_CAST(GLEW_EXT_blend_equation_separate) = _glewSearchExtension("GL_EXT_blend_equation_separate", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_equation_separate) CONST_CAST(GLEW_EXT_blend_equation_separate) = !_glewInit_GL_EXT_blend_equation_separate(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_equation_separate */ #ifdef GL_EXT_blend_func_separate - CONST_CAST(GLEW_EXT_blend_func_separate) = glewGetExtension("GL_EXT_blend_func_separate"); + CONST_CAST(GLEW_EXT_blend_func_separate) = _glewSearchExtension("GL_EXT_blend_func_separate", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_func_separate) CONST_CAST(GLEW_EXT_blend_func_separate) = !_glewInit_GL_EXT_blend_func_separate(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_func_separate */ #ifdef GL_EXT_blend_logic_op - CONST_CAST(GLEW_EXT_blend_logic_op) = glewGetExtension("GL_EXT_blend_logic_op"); + CONST_CAST(GLEW_EXT_blend_logic_op) = _glewSearchExtension("GL_EXT_blend_logic_op", extStart, extEnd); #endif /* GL_EXT_blend_logic_op */ #ifdef GL_EXT_blend_minmax - CONST_CAST(GLEW_EXT_blend_minmax) = glewGetExtension("GL_EXT_blend_minmax"); + CONST_CAST(GLEW_EXT_blend_minmax) = _glewSearchExtension("GL_EXT_blend_minmax", extStart, extEnd); if (glewExperimental || GLEW_EXT_blend_minmax) CONST_CAST(GLEW_EXT_blend_minmax) = !_glewInit_GL_EXT_blend_minmax(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_blend_minmax */ #ifdef GL_EXT_blend_subtract - CONST_CAST(GLEW_EXT_blend_subtract) = glewGetExtension("GL_EXT_blend_subtract"); + CONST_CAST(GLEW_EXT_blend_subtract) = _glewSearchExtension("GL_EXT_blend_subtract", extStart, extEnd); #endif /* GL_EXT_blend_subtract */ #ifdef GL_EXT_clip_volume_hint - CONST_CAST(GLEW_EXT_clip_volume_hint) = glewGetExtension("GL_EXT_clip_volume_hint"); + CONST_CAST(GLEW_EXT_clip_volume_hint) = _glewSearchExtension("GL_EXT_clip_volume_hint", extStart, extEnd); #endif /* GL_EXT_clip_volume_hint */ #ifdef GL_EXT_cmyka - CONST_CAST(GLEW_EXT_cmyka) = glewGetExtension("GL_EXT_cmyka"); + CONST_CAST(GLEW_EXT_cmyka) = _glewSearchExtension("GL_EXT_cmyka", extStart, extEnd); #endif /* GL_EXT_cmyka */ #ifdef GL_EXT_color_subtable - CONST_CAST(GLEW_EXT_color_subtable) = glewGetExtension("GL_EXT_color_subtable"); + CONST_CAST(GLEW_EXT_color_subtable) = _glewSearchExtension("GL_EXT_color_subtable", extStart, extEnd); if (glewExperimental || GLEW_EXT_color_subtable) CONST_CAST(GLEW_EXT_color_subtable) = !_glewInit_GL_EXT_color_subtable(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_color_subtable */ #ifdef GL_EXT_compiled_vertex_array - CONST_CAST(GLEW_EXT_compiled_vertex_array) = glewGetExtension("GL_EXT_compiled_vertex_array"); + CONST_CAST(GLEW_EXT_compiled_vertex_array) = _glewSearchExtension("GL_EXT_compiled_vertex_array", extStart, extEnd); if (glewExperimental || GLEW_EXT_compiled_vertex_array) CONST_CAST(GLEW_EXT_compiled_vertex_array) = !_glewInit_GL_EXT_compiled_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_compiled_vertex_array */ #ifdef GL_EXT_convolution - CONST_CAST(GLEW_EXT_convolution) = glewGetExtension("GL_EXT_convolution"); + CONST_CAST(GLEW_EXT_convolution) = _glewSearchExtension("GL_EXT_convolution", extStart, extEnd); if (glewExperimental || GLEW_EXT_convolution) CONST_CAST(GLEW_EXT_convolution) = !_glewInit_GL_EXT_convolution(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_convolution */ #ifdef GL_EXT_coordinate_frame - CONST_CAST(GLEW_EXT_coordinate_frame) = glewGetExtension("GL_EXT_coordinate_frame"); + CONST_CAST(GLEW_EXT_coordinate_frame) = _glewSearchExtension("GL_EXT_coordinate_frame", extStart, extEnd); if (glewExperimental || GLEW_EXT_coordinate_frame) CONST_CAST(GLEW_EXT_coordinate_frame) = !_glewInit_GL_EXT_coordinate_frame(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_coordinate_frame */ #ifdef GL_EXT_copy_texture - CONST_CAST(GLEW_EXT_copy_texture) = glewGetExtension("GL_EXT_copy_texture"); + CONST_CAST(GLEW_EXT_copy_texture) = _glewSearchExtension("GL_EXT_copy_texture", extStart, extEnd); if (glewExperimental || GLEW_EXT_copy_texture) CONST_CAST(GLEW_EXT_copy_texture) = !_glewInit_GL_EXT_copy_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_copy_texture */ #ifdef GL_EXT_cull_vertex - CONST_CAST(GLEW_EXT_cull_vertex) = glewGetExtension("GL_EXT_cull_vertex"); + CONST_CAST(GLEW_EXT_cull_vertex) = _glewSearchExtension("GL_EXT_cull_vertex", extStart, extEnd); if (glewExperimental || GLEW_EXT_cull_vertex) CONST_CAST(GLEW_EXT_cull_vertex) = !_glewInit_GL_EXT_cull_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_cull_vertex */ #ifdef GL_EXT_depth_bounds_test - CONST_CAST(GLEW_EXT_depth_bounds_test) = glewGetExtension("GL_EXT_depth_bounds_test"); + CONST_CAST(GLEW_EXT_depth_bounds_test) = _glewSearchExtension("GL_EXT_depth_bounds_test", extStart, extEnd); if (glewExperimental || GLEW_EXT_depth_bounds_test) CONST_CAST(GLEW_EXT_depth_bounds_test) = !_glewInit_GL_EXT_depth_bounds_test(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_depth_bounds_test */ #ifdef GL_EXT_direct_state_access - CONST_CAST(GLEW_EXT_direct_state_access) = glewGetExtension("GL_EXT_direct_state_access"); + CONST_CAST(GLEW_EXT_direct_state_access) = _glewSearchExtension("GL_EXT_direct_state_access", extStart, extEnd); if (glewExperimental || GLEW_EXT_direct_state_access) CONST_CAST(GLEW_EXT_direct_state_access) = !_glewInit_GL_EXT_direct_state_access(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_direct_state_access */ #ifdef GL_EXT_draw_buffers2 - CONST_CAST(GLEW_EXT_draw_buffers2) = glewGetExtension("GL_EXT_draw_buffers2"); + CONST_CAST(GLEW_EXT_draw_buffers2) = _glewSearchExtension("GL_EXT_draw_buffers2", extStart, extEnd); if (glewExperimental || GLEW_EXT_draw_buffers2) CONST_CAST(GLEW_EXT_draw_buffers2) = !_glewInit_GL_EXT_draw_buffers2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_draw_buffers2 */ #ifdef GL_EXT_draw_instanced - CONST_CAST(GLEW_EXT_draw_instanced) = glewGetExtension("GL_EXT_draw_instanced"); + CONST_CAST(GLEW_EXT_draw_instanced) = _glewSearchExtension("GL_EXT_draw_instanced", extStart, extEnd); if (glewExperimental || GLEW_EXT_draw_instanced) CONST_CAST(GLEW_EXT_draw_instanced) = !_glewInit_GL_EXT_draw_instanced(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_draw_instanced */ #ifdef GL_EXT_draw_range_elements - CONST_CAST(GLEW_EXT_draw_range_elements) = glewGetExtension("GL_EXT_draw_range_elements"); + CONST_CAST(GLEW_EXT_draw_range_elements) = _glewSearchExtension("GL_EXT_draw_range_elements", extStart, extEnd); if (glewExperimental || GLEW_EXT_draw_range_elements) CONST_CAST(GLEW_EXT_draw_range_elements) = !_glewInit_GL_EXT_draw_range_elements(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_draw_range_elements */ #ifdef GL_EXT_fog_coord - CONST_CAST(GLEW_EXT_fog_coord) = glewGetExtension("GL_EXT_fog_coord"); + CONST_CAST(GLEW_EXT_fog_coord) = _glewSearchExtension("GL_EXT_fog_coord", extStart, extEnd); if (glewExperimental || GLEW_EXT_fog_coord) CONST_CAST(GLEW_EXT_fog_coord) = !_glewInit_GL_EXT_fog_coord(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_fog_coord */ #ifdef GL_EXT_fragment_lighting - CONST_CAST(GLEW_EXT_fragment_lighting) = glewGetExtension("GL_EXT_fragment_lighting"); + CONST_CAST(GLEW_EXT_fragment_lighting) = _glewSearchExtension("GL_EXT_fragment_lighting", extStart, extEnd); if (glewExperimental || GLEW_EXT_fragment_lighting) CONST_CAST(GLEW_EXT_fragment_lighting) = !_glewInit_GL_EXT_fragment_lighting(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_fragment_lighting */ #ifdef GL_EXT_framebuffer_blit - CONST_CAST(GLEW_EXT_framebuffer_blit) = glewGetExtension("GL_EXT_framebuffer_blit"); + CONST_CAST(GLEW_EXT_framebuffer_blit) = _glewSearchExtension("GL_EXT_framebuffer_blit", extStart, extEnd); if (glewExperimental || GLEW_EXT_framebuffer_blit) CONST_CAST(GLEW_EXT_framebuffer_blit) = !_glewInit_GL_EXT_framebuffer_blit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_framebuffer_blit */ #ifdef GL_EXT_framebuffer_multisample - CONST_CAST(GLEW_EXT_framebuffer_multisample) = glewGetExtension("GL_EXT_framebuffer_multisample"); + CONST_CAST(GLEW_EXT_framebuffer_multisample) = _glewSearchExtension("GL_EXT_framebuffer_multisample", extStart, extEnd); if (glewExperimental || GLEW_EXT_framebuffer_multisample) CONST_CAST(GLEW_EXT_framebuffer_multisample) = !_glewInit_GL_EXT_framebuffer_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_framebuffer_multisample */ #ifdef GL_EXT_framebuffer_object - CONST_CAST(GLEW_EXT_framebuffer_object) = glewGetExtension("GL_EXT_framebuffer_object"); + CONST_CAST(GLEW_EXT_framebuffer_object) = _glewSearchExtension("GL_EXT_framebuffer_object", extStart, extEnd); if (glewExperimental || GLEW_EXT_framebuffer_object) CONST_CAST(GLEW_EXT_framebuffer_object) = !_glewInit_GL_EXT_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_framebuffer_object */ #ifdef GL_EXT_framebuffer_sRGB - CONST_CAST(GLEW_EXT_framebuffer_sRGB) = glewGetExtension("GL_EXT_framebuffer_sRGB"); + CONST_CAST(GLEW_EXT_framebuffer_sRGB) = _glewSearchExtension("GL_EXT_framebuffer_sRGB", extStart, extEnd); #endif /* GL_EXT_framebuffer_sRGB */ #ifdef GL_EXT_geometry_shader4 - CONST_CAST(GLEW_EXT_geometry_shader4) = glewGetExtension("GL_EXT_geometry_shader4"); + CONST_CAST(GLEW_EXT_geometry_shader4) = _glewSearchExtension("GL_EXT_geometry_shader4", extStart, extEnd); if (glewExperimental || GLEW_EXT_geometry_shader4) CONST_CAST(GLEW_EXT_geometry_shader4) = !_glewInit_GL_EXT_geometry_shader4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_geometry_shader4 */ #ifdef GL_EXT_gpu_program_parameters - CONST_CAST(GLEW_EXT_gpu_program_parameters) = glewGetExtension("GL_EXT_gpu_program_parameters"); + CONST_CAST(GLEW_EXT_gpu_program_parameters) = _glewSearchExtension("GL_EXT_gpu_program_parameters", extStart, extEnd); if (glewExperimental || GLEW_EXT_gpu_program_parameters) CONST_CAST(GLEW_EXT_gpu_program_parameters) = !_glewInit_GL_EXT_gpu_program_parameters(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_gpu_program_parameters */ #ifdef GL_EXT_gpu_shader4 - CONST_CAST(GLEW_EXT_gpu_shader4) = glewGetExtension("GL_EXT_gpu_shader4"); + CONST_CAST(GLEW_EXT_gpu_shader4) = _glewSearchExtension("GL_EXT_gpu_shader4", extStart, extEnd); if (glewExperimental || GLEW_EXT_gpu_shader4) CONST_CAST(GLEW_EXT_gpu_shader4) = !_glewInit_GL_EXT_gpu_shader4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_gpu_shader4 */ #ifdef GL_EXT_histogram - CONST_CAST(GLEW_EXT_histogram) = glewGetExtension("GL_EXT_histogram"); + CONST_CAST(GLEW_EXT_histogram) = _glewSearchExtension("GL_EXT_histogram", extStart, extEnd); if (glewExperimental || GLEW_EXT_histogram) CONST_CAST(GLEW_EXT_histogram) = !_glewInit_GL_EXT_histogram(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_histogram */ #ifdef GL_EXT_index_array_formats - CONST_CAST(GLEW_EXT_index_array_formats) = glewGetExtension("GL_EXT_index_array_formats"); + CONST_CAST(GLEW_EXT_index_array_formats) = _glewSearchExtension("GL_EXT_index_array_formats", extStart, extEnd); #endif /* GL_EXT_index_array_formats */ #ifdef GL_EXT_index_func - CONST_CAST(GLEW_EXT_index_func) = glewGetExtension("GL_EXT_index_func"); + CONST_CAST(GLEW_EXT_index_func) = _glewSearchExtension("GL_EXT_index_func", extStart, extEnd); if (glewExperimental || GLEW_EXT_index_func) CONST_CAST(GLEW_EXT_index_func) = !_glewInit_GL_EXT_index_func(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_index_func */ #ifdef GL_EXT_index_material - CONST_CAST(GLEW_EXT_index_material) = glewGetExtension("GL_EXT_index_material"); + CONST_CAST(GLEW_EXT_index_material) = _glewSearchExtension("GL_EXT_index_material", extStart, extEnd); if (glewExperimental || GLEW_EXT_index_material) CONST_CAST(GLEW_EXT_index_material) = !_glewInit_GL_EXT_index_material(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_index_material */ #ifdef GL_EXT_index_texture - CONST_CAST(GLEW_EXT_index_texture) = glewGetExtension("GL_EXT_index_texture"); + CONST_CAST(GLEW_EXT_index_texture) = _glewSearchExtension("GL_EXT_index_texture", extStart, extEnd); #endif /* GL_EXT_index_texture */ #ifdef GL_EXT_light_texture - CONST_CAST(GLEW_EXT_light_texture) = glewGetExtension("GL_EXT_light_texture"); + CONST_CAST(GLEW_EXT_light_texture) = _glewSearchExtension("GL_EXT_light_texture", extStart, extEnd); if (glewExperimental || GLEW_EXT_light_texture) CONST_CAST(GLEW_EXT_light_texture) = !_glewInit_GL_EXT_light_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_light_texture */ #ifdef GL_EXT_misc_attribute - CONST_CAST(GLEW_EXT_misc_attribute) = glewGetExtension("GL_EXT_misc_attribute"); + CONST_CAST(GLEW_EXT_misc_attribute) = _glewSearchExtension("GL_EXT_misc_attribute", extStart, extEnd); #endif /* GL_EXT_misc_attribute */ #ifdef GL_EXT_multi_draw_arrays - CONST_CAST(GLEW_EXT_multi_draw_arrays) = glewGetExtension("GL_EXT_multi_draw_arrays"); + CONST_CAST(GLEW_EXT_multi_draw_arrays) = _glewSearchExtension("GL_EXT_multi_draw_arrays", extStart, extEnd); if (glewExperimental || GLEW_EXT_multi_draw_arrays) CONST_CAST(GLEW_EXT_multi_draw_arrays) = !_glewInit_GL_EXT_multi_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_multi_draw_arrays */ #ifdef GL_EXT_multisample - CONST_CAST(GLEW_EXT_multisample) = glewGetExtension("GL_EXT_multisample"); + CONST_CAST(GLEW_EXT_multisample) = _glewSearchExtension("GL_EXT_multisample", extStart, extEnd); if (glewExperimental || GLEW_EXT_multisample) CONST_CAST(GLEW_EXT_multisample) = !_glewInit_GL_EXT_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_multisample */ #ifdef GL_EXT_packed_depth_stencil - CONST_CAST(GLEW_EXT_packed_depth_stencil) = glewGetExtension("GL_EXT_packed_depth_stencil"); + CONST_CAST(GLEW_EXT_packed_depth_stencil) = _glewSearchExtension("GL_EXT_packed_depth_stencil", extStart, extEnd); #endif /* GL_EXT_packed_depth_stencil */ #ifdef GL_EXT_packed_float - CONST_CAST(GLEW_EXT_packed_float) = glewGetExtension("GL_EXT_packed_float"); + CONST_CAST(GLEW_EXT_packed_float) = _glewSearchExtension("GL_EXT_packed_float", extStart, extEnd); #endif /* GL_EXT_packed_float */ #ifdef GL_EXT_packed_pixels - CONST_CAST(GLEW_EXT_packed_pixels) = glewGetExtension("GL_EXT_packed_pixels"); + CONST_CAST(GLEW_EXT_packed_pixels) = _glewSearchExtension("GL_EXT_packed_pixels", extStart, extEnd); #endif /* GL_EXT_packed_pixels */ #ifdef GL_EXT_paletted_texture - CONST_CAST(GLEW_EXT_paletted_texture) = glewGetExtension("GL_EXT_paletted_texture"); + CONST_CAST(GLEW_EXT_paletted_texture) = _glewSearchExtension("GL_EXT_paletted_texture", extStart, extEnd); if (glewExperimental || GLEW_EXT_paletted_texture) CONST_CAST(GLEW_EXT_paletted_texture) = !_glewInit_GL_EXT_paletted_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_paletted_texture */ #ifdef GL_EXT_pixel_buffer_object - CONST_CAST(GLEW_EXT_pixel_buffer_object) = glewGetExtension("GL_EXT_pixel_buffer_object"); + CONST_CAST(GLEW_EXT_pixel_buffer_object) = _glewSearchExtension("GL_EXT_pixel_buffer_object", extStart, extEnd); #endif /* GL_EXT_pixel_buffer_object */ #ifdef GL_EXT_pixel_transform - CONST_CAST(GLEW_EXT_pixel_transform) = glewGetExtension("GL_EXT_pixel_transform"); + CONST_CAST(GLEW_EXT_pixel_transform) = _glewSearchExtension("GL_EXT_pixel_transform", extStart, extEnd); if (glewExperimental || GLEW_EXT_pixel_transform) CONST_CAST(GLEW_EXT_pixel_transform) = !_glewInit_GL_EXT_pixel_transform(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_pixel_transform */ #ifdef GL_EXT_pixel_transform_color_table - CONST_CAST(GLEW_EXT_pixel_transform_color_table) = glewGetExtension("GL_EXT_pixel_transform_color_table"); + CONST_CAST(GLEW_EXT_pixel_transform_color_table) = _glewSearchExtension("GL_EXT_pixel_transform_color_table", extStart, extEnd); #endif /* GL_EXT_pixel_transform_color_table */ #ifdef GL_EXT_point_parameters - CONST_CAST(GLEW_EXT_point_parameters) = glewGetExtension("GL_EXT_point_parameters"); + CONST_CAST(GLEW_EXT_point_parameters) = _glewSearchExtension("GL_EXT_point_parameters", extStart, extEnd); if (glewExperimental || GLEW_EXT_point_parameters) CONST_CAST(GLEW_EXT_point_parameters) = !_glewInit_GL_EXT_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_point_parameters */ #ifdef GL_EXT_polygon_offset - CONST_CAST(GLEW_EXT_polygon_offset) = glewGetExtension("GL_EXT_polygon_offset"); + CONST_CAST(GLEW_EXT_polygon_offset) = _glewSearchExtension("GL_EXT_polygon_offset", extStart, extEnd); if (glewExperimental || GLEW_EXT_polygon_offset) CONST_CAST(GLEW_EXT_polygon_offset) = !_glewInit_GL_EXT_polygon_offset(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_polygon_offset */ #ifdef GL_EXT_provoking_vertex - CONST_CAST(GLEW_EXT_provoking_vertex) = glewGetExtension("GL_EXT_provoking_vertex"); + CONST_CAST(GLEW_EXT_provoking_vertex) = _glewSearchExtension("GL_EXT_provoking_vertex", extStart, extEnd); if (glewExperimental || GLEW_EXT_provoking_vertex) CONST_CAST(GLEW_EXT_provoking_vertex) = !_glewInit_GL_EXT_provoking_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_provoking_vertex */ #ifdef GL_EXT_rescale_normal - CONST_CAST(GLEW_EXT_rescale_normal) = glewGetExtension("GL_EXT_rescale_normal"); + CONST_CAST(GLEW_EXT_rescale_normal) = _glewSearchExtension("GL_EXT_rescale_normal", extStart, extEnd); #endif /* GL_EXT_rescale_normal */ #ifdef GL_EXT_scene_marker - CONST_CAST(GLEW_EXT_scene_marker) = glewGetExtension("GL_EXT_scene_marker"); + CONST_CAST(GLEW_EXT_scene_marker) = _glewSearchExtension("GL_EXT_scene_marker", extStart, extEnd); if (glewExperimental || GLEW_EXT_scene_marker) CONST_CAST(GLEW_EXT_scene_marker) = !_glewInit_GL_EXT_scene_marker(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_scene_marker */ #ifdef GL_EXT_secondary_color - CONST_CAST(GLEW_EXT_secondary_color) = glewGetExtension("GL_EXT_secondary_color"); + CONST_CAST(GLEW_EXT_secondary_color) = _glewSearchExtension("GL_EXT_secondary_color", extStart, extEnd); if (glewExperimental || GLEW_EXT_secondary_color) CONST_CAST(GLEW_EXT_secondary_color) = !_glewInit_GL_EXT_secondary_color(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_secondary_color */ #ifdef GL_EXT_separate_shader_objects - CONST_CAST(GLEW_EXT_separate_shader_objects) = glewGetExtension("GL_EXT_separate_shader_objects"); + CONST_CAST(GLEW_EXT_separate_shader_objects) = _glewSearchExtension("GL_EXT_separate_shader_objects", extStart, extEnd); if (glewExperimental || GLEW_EXT_separate_shader_objects) CONST_CAST(GLEW_EXT_separate_shader_objects) = !_glewInit_GL_EXT_separate_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_separate_shader_objects */ #ifdef GL_EXT_separate_specular_color - CONST_CAST(GLEW_EXT_separate_specular_color) = glewGetExtension("GL_EXT_separate_specular_color"); + CONST_CAST(GLEW_EXT_separate_specular_color) = _glewSearchExtension("GL_EXT_separate_specular_color", extStart, extEnd); #endif /* GL_EXT_separate_specular_color */ #ifdef GL_EXT_shader_image_load_store - CONST_CAST(GLEW_EXT_shader_image_load_store) = glewGetExtension("GL_EXT_shader_image_load_store"); + CONST_CAST(GLEW_EXT_shader_image_load_store) = _glewSearchExtension("GL_EXT_shader_image_load_store", extStart, extEnd); if (glewExperimental || GLEW_EXT_shader_image_load_store) CONST_CAST(GLEW_EXT_shader_image_load_store) = !_glewInit_GL_EXT_shader_image_load_store(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_shader_image_load_store */ #ifdef GL_EXT_shadow_funcs - CONST_CAST(GLEW_EXT_shadow_funcs) = glewGetExtension("GL_EXT_shadow_funcs"); + CONST_CAST(GLEW_EXT_shadow_funcs) = _glewSearchExtension("GL_EXT_shadow_funcs", extStart, extEnd); #endif /* GL_EXT_shadow_funcs */ #ifdef GL_EXT_shared_texture_palette - CONST_CAST(GLEW_EXT_shared_texture_palette) = glewGetExtension("GL_EXT_shared_texture_palette"); + CONST_CAST(GLEW_EXT_shared_texture_palette) = _glewSearchExtension("GL_EXT_shared_texture_palette", extStart, extEnd); #endif /* GL_EXT_shared_texture_palette */ #ifdef GL_EXT_stencil_clear_tag - CONST_CAST(GLEW_EXT_stencil_clear_tag) = glewGetExtension("GL_EXT_stencil_clear_tag"); + CONST_CAST(GLEW_EXT_stencil_clear_tag) = _glewSearchExtension("GL_EXT_stencil_clear_tag", extStart, extEnd); #endif /* GL_EXT_stencil_clear_tag */ #ifdef GL_EXT_stencil_two_side - CONST_CAST(GLEW_EXT_stencil_two_side) = glewGetExtension("GL_EXT_stencil_two_side"); + CONST_CAST(GLEW_EXT_stencil_two_side) = _glewSearchExtension("GL_EXT_stencil_two_side", extStart, extEnd); if (glewExperimental || GLEW_EXT_stencil_two_side) CONST_CAST(GLEW_EXT_stencil_two_side) = !_glewInit_GL_EXT_stencil_two_side(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_stencil_two_side */ #ifdef GL_EXT_stencil_wrap - CONST_CAST(GLEW_EXT_stencil_wrap) = glewGetExtension("GL_EXT_stencil_wrap"); + CONST_CAST(GLEW_EXT_stencil_wrap) = _glewSearchExtension("GL_EXT_stencil_wrap", extStart, extEnd); #endif /* GL_EXT_stencil_wrap */ #ifdef GL_EXT_subtexture - CONST_CAST(GLEW_EXT_subtexture) = glewGetExtension("GL_EXT_subtexture"); + CONST_CAST(GLEW_EXT_subtexture) = _glewSearchExtension("GL_EXT_subtexture", extStart, extEnd); if (glewExperimental || GLEW_EXT_subtexture) CONST_CAST(GLEW_EXT_subtexture) = !_glewInit_GL_EXT_subtexture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_subtexture */ #ifdef GL_EXT_texture - CONST_CAST(GLEW_EXT_texture) = glewGetExtension("GL_EXT_texture"); + CONST_CAST(GLEW_EXT_texture) = _glewSearchExtension("GL_EXT_texture", extStart, extEnd); #endif /* GL_EXT_texture */ #ifdef GL_EXT_texture3D - CONST_CAST(GLEW_EXT_texture3D) = glewGetExtension("GL_EXT_texture3D"); + CONST_CAST(GLEW_EXT_texture3D) = _glewSearchExtension("GL_EXT_texture3D", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture3D) CONST_CAST(GLEW_EXT_texture3D) = !_glewInit_GL_EXT_texture3D(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture3D */ #ifdef GL_EXT_texture_array - CONST_CAST(GLEW_EXT_texture_array) = glewGetExtension("GL_EXT_texture_array"); + CONST_CAST(GLEW_EXT_texture_array) = _glewSearchExtension("GL_EXT_texture_array", extStart, extEnd); + if (glewExperimental || GLEW_EXT_texture_array) CONST_CAST(GLEW_EXT_texture_array) = !_glewInit_GL_EXT_texture_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_array */ #ifdef GL_EXT_texture_buffer_object - CONST_CAST(GLEW_EXT_texture_buffer_object) = glewGetExtension("GL_EXT_texture_buffer_object"); + CONST_CAST(GLEW_EXT_texture_buffer_object) = _glewSearchExtension("GL_EXT_texture_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_buffer_object) CONST_CAST(GLEW_EXT_texture_buffer_object) = !_glewInit_GL_EXT_texture_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_buffer_object */ #ifdef GL_EXT_texture_compression_dxt1 - CONST_CAST(GLEW_EXT_texture_compression_dxt1) = glewGetExtension("GL_EXT_texture_compression_dxt1"); + CONST_CAST(GLEW_EXT_texture_compression_dxt1) = _glewSearchExtension("GL_EXT_texture_compression_dxt1", extStart, extEnd); #endif /* GL_EXT_texture_compression_dxt1 */ #ifdef GL_EXT_texture_compression_latc - CONST_CAST(GLEW_EXT_texture_compression_latc) = glewGetExtension("GL_EXT_texture_compression_latc"); + CONST_CAST(GLEW_EXT_texture_compression_latc) = _glewSearchExtension("GL_EXT_texture_compression_latc", extStart, extEnd); #endif /* GL_EXT_texture_compression_latc */ #ifdef GL_EXT_texture_compression_rgtc - CONST_CAST(GLEW_EXT_texture_compression_rgtc) = glewGetExtension("GL_EXT_texture_compression_rgtc"); + CONST_CAST(GLEW_EXT_texture_compression_rgtc) = _glewSearchExtension("GL_EXT_texture_compression_rgtc", extStart, extEnd); #endif /* GL_EXT_texture_compression_rgtc */ #ifdef GL_EXT_texture_compression_s3tc - CONST_CAST(GLEW_EXT_texture_compression_s3tc) = glewGetExtension("GL_EXT_texture_compression_s3tc"); + CONST_CAST(GLEW_EXT_texture_compression_s3tc) = _glewSearchExtension("GL_EXT_texture_compression_s3tc", extStart, extEnd); #endif /* GL_EXT_texture_compression_s3tc */ #ifdef GL_EXT_texture_cube_map - CONST_CAST(GLEW_EXT_texture_cube_map) = glewGetExtension("GL_EXT_texture_cube_map"); + CONST_CAST(GLEW_EXT_texture_cube_map) = _glewSearchExtension("GL_EXT_texture_cube_map", extStart, extEnd); #endif /* GL_EXT_texture_cube_map */ #ifdef GL_EXT_texture_edge_clamp - CONST_CAST(GLEW_EXT_texture_edge_clamp) = glewGetExtension("GL_EXT_texture_edge_clamp"); + CONST_CAST(GLEW_EXT_texture_edge_clamp) = _glewSearchExtension("GL_EXT_texture_edge_clamp", extStart, extEnd); #endif /* GL_EXT_texture_edge_clamp */ #ifdef GL_EXT_texture_env - CONST_CAST(GLEW_EXT_texture_env) = glewGetExtension("GL_EXT_texture_env"); + CONST_CAST(GLEW_EXT_texture_env) = _glewSearchExtension("GL_EXT_texture_env", extStart, extEnd); #endif /* GL_EXT_texture_env */ #ifdef GL_EXT_texture_env_add - CONST_CAST(GLEW_EXT_texture_env_add) = glewGetExtension("GL_EXT_texture_env_add"); + CONST_CAST(GLEW_EXT_texture_env_add) = _glewSearchExtension("GL_EXT_texture_env_add", extStart, extEnd); #endif /* GL_EXT_texture_env_add */ #ifdef GL_EXT_texture_env_combine - CONST_CAST(GLEW_EXT_texture_env_combine) = glewGetExtension("GL_EXT_texture_env_combine"); + CONST_CAST(GLEW_EXT_texture_env_combine) = _glewSearchExtension("GL_EXT_texture_env_combine", extStart, extEnd); #endif /* GL_EXT_texture_env_combine */ #ifdef GL_EXT_texture_env_dot3 - CONST_CAST(GLEW_EXT_texture_env_dot3) = glewGetExtension("GL_EXT_texture_env_dot3"); + CONST_CAST(GLEW_EXT_texture_env_dot3) = _glewSearchExtension("GL_EXT_texture_env_dot3", extStart, extEnd); #endif /* GL_EXT_texture_env_dot3 */ #ifdef GL_EXT_texture_filter_anisotropic - CONST_CAST(GLEW_EXT_texture_filter_anisotropic) = glewGetExtension("GL_EXT_texture_filter_anisotropic"); + CONST_CAST(GLEW_EXT_texture_filter_anisotropic) = _glewSearchExtension("GL_EXT_texture_filter_anisotropic", extStart, extEnd); #endif /* GL_EXT_texture_filter_anisotropic */ #ifdef GL_EXT_texture_integer - CONST_CAST(GLEW_EXT_texture_integer) = glewGetExtension("GL_EXT_texture_integer"); + CONST_CAST(GLEW_EXT_texture_integer) = _glewSearchExtension("GL_EXT_texture_integer", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_integer) CONST_CAST(GLEW_EXT_texture_integer) = !_glewInit_GL_EXT_texture_integer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_integer */ #ifdef GL_EXT_texture_lod_bias - CONST_CAST(GLEW_EXT_texture_lod_bias) = glewGetExtension("GL_EXT_texture_lod_bias"); + CONST_CAST(GLEW_EXT_texture_lod_bias) = _glewSearchExtension("GL_EXT_texture_lod_bias", extStart, extEnd); #endif /* GL_EXT_texture_lod_bias */ #ifdef GL_EXT_texture_mirror_clamp - CONST_CAST(GLEW_EXT_texture_mirror_clamp) = glewGetExtension("GL_EXT_texture_mirror_clamp"); + CONST_CAST(GLEW_EXT_texture_mirror_clamp) = _glewSearchExtension("GL_EXT_texture_mirror_clamp", extStart, extEnd); #endif /* GL_EXT_texture_mirror_clamp */ #ifdef GL_EXT_texture_object - CONST_CAST(GLEW_EXT_texture_object) = glewGetExtension("GL_EXT_texture_object"); + CONST_CAST(GLEW_EXT_texture_object) = _glewSearchExtension("GL_EXT_texture_object", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_object) CONST_CAST(GLEW_EXT_texture_object) = !_glewInit_GL_EXT_texture_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_object */ #ifdef GL_EXT_texture_perturb_normal - CONST_CAST(GLEW_EXT_texture_perturb_normal) = glewGetExtension("GL_EXT_texture_perturb_normal"); + CONST_CAST(GLEW_EXT_texture_perturb_normal) = _glewSearchExtension("GL_EXT_texture_perturb_normal", extStart, extEnd); if (glewExperimental || GLEW_EXT_texture_perturb_normal) CONST_CAST(GLEW_EXT_texture_perturb_normal) = !_glewInit_GL_EXT_texture_perturb_normal(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_texture_perturb_normal */ #ifdef GL_EXT_texture_rectangle - CONST_CAST(GLEW_EXT_texture_rectangle) = glewGetExtension("GL_EXT_texture_rectangle"); + CONST_CAST(GLEW_EXT_texture_rectangle) = _glewSearchExtension("GL_EXT_texture_rectangle", extStart, extEnd); #endif /* GL_EXT_texture_rectangle */ #ifdef GL_EXT_texture_sRGB - CONST_CAST(GLEW_EXT_texture_sRGB) = glewGetExtension("GL_EXT_texture_sRGB"); + CONST_CAST(GLEW_EXT_texture_sRGB) = _glewSearchExtension("GL_EXT_texture_sRGB", extStart, extEnd); #endif /* GL_EXT_texture_sRGB */ #ifdef GL_EXT_texture_sRGB_decode - CONST_CAST(GLEW_EXT_texture_sRGB_decode) = glewGetExtension("GL_EXT_texture_sRGB_decode"); + CONST_CAST(GLEW_EXT_texture_sRGB_decode) = _glewSearchExtension("GL_EXT_texture_sRGB_decode", extStart, extEnd); #endif /* GL_EXT_texture_sRGB_decode */ #ifdef GL_EXT_texture_shared_exponent - CONST_CAST(GLEW_EXT_texture_shared_exponent) = glewGetExtension("GL_EXT_texture_shared_exponent"); + CONST_CAST(GLEW_EXT_texture_shared_exponent) = _glewSearchExtension("GL_EXT_texture_shared_exponent", extStart, extEnd); #endif /* GL_EXT_texture_shared_exponent */ #ifdef GL_EXT_texture_snorm - CONST_CAST(GLEW_EXT_texture_snorm) = glewGetExtension("GL_EXT_texture_snorm"); + CONST_CAST(GLEW_EXT_texture_snorm) = _glewSearchExtension("GL_EXT_texture_snorm", extStart, extEnd); #endif /* GL_EXT_texture_snorm */ #ifdef GL_EXT_texture_swizzle - CONST_CAST(GLEW_EXT_texture_swizzle) = glewGetExtension("GL_EXT_texture_swizzle"); + CONST_CAST(GLEW_EXT_texture_swizzle) = _glewSearchExtension("GL_EXT_texture_swizzle", extStart, extEnd); #endif /* GL_EXT_texture_swizzle */ #ifdef GL_EXT_timer_query - CONST_CAST(GLEW_EXT_timer_query) = glewGetExtension("GL_EXT_timer_query"); + CONST_CAST(GLEW_EXT_timer_query) = _glewSearchExtension("GL_EXT_timer_query", extStart, extEnd); if (glewExperimental || GLEW_EXT_timer_query) CONST_CAST(GLEW_EXT_timer_query) = !_glewInit_GL_EXT_timer_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_timer_query */ #ifdef GL_EXT_transform_feedback - CONST_CAST(GLEW_EXT_transform_feedback) = glewGetExtension("GL_EXT_transform_feedback"); + CONST_CAST(GLEW_EXT_transform_feedback) = _glewSearchExtension("GL_EXT_transform_feedback", extStart, extEnd); if (glewExperimental || GLEW_EXT_transform_feedback) CONST_CAST(GLEW_EXT_transform_feedback) = !_glewInit_GL_EXT_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_transform_feedback */ #ifdef GL_EXT_vertex_array - CONST_CAST(GLEW_EXT_vertex_array) = glewGetExtension("GL_EXT_vertex_array"); + CONST_CAST(GLEW_EXT_vertex_array) = _glewSearchExtension("GL_EXT_vertex_array", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_array) CONST_CAST(GLEW_EXT_vertex_array) = !_glewInit_GL_EXT_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_array */ #ifdef GL_EXT_vertex_array_bgra - CONST_CAST(GLEW_EXT_vertex_array_bgra) = glewGetExtension("GL_EXT_vertex_array_bgra"); + CONST_CAST(GLEW_EXT_vertex_array_bgra) = _glewSearchExtension("GL_EXT_vertex_array_bgra", extStart, extEnd); #endif /* GL_EXT_vertex_array_bgra */ #ifdef GL_EXT_vertex_attrib_64bit - CONST_CAST(GLEW_EXT_vertex_attrib_64bit) = glewGetExtension("GL_EXT_vertex_attrib_64bit"); + CONST_CAST(GLEW_EXT_vertex_attrib_64bit) = _glewSearchExtension("GL_EXT_vertex_attrib_64bit", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_attrib_64bit) CONST_CAST(GLEW_EXT_vertex_attrib_64bit) = !_glewInit_GL_EXT_vertex_attrib_64bit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_attrib_64bit */ #ifdef GL_EXT_vertex_shader - CONST_CAST(GLEW_EXT_vertex_shader) = glewGetExtension("GL_EXT_vertex_shader"); + CONST_CAST(GLEW_EXT_vertex_shader) = _glewSearchExtension("GL_EXT_vertex_shader", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_shader) CONST_CAST(GLEW_EXT_vertex_shader) = !_glewInit_GL_EXT_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_shader */ #ifdef GL_EXT_vertex_weighting - CONST_CAST(GLEW_EXT_vertex_weighting) = glewGetExtension("GL_EXT_vertex_weighting"); + CONST_CAST(GLEW_EXT_vertex_weighting) = _glewSearchExtension("GL_EXT_vertex_weighting", extStart, extEnd); if (glewExperimental || GLEW_EXT_vertex_weighting) CONST_CAST(GLEW_EXT_vertex_weighting) = !_glewInit_GL_EXT_vertex_weighting(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_EXT_vertex_weighting */ +#ifdef GL_EXT_x11_sync_object + CONST_CAST(GLEW_EXT_x11_sync_object) = _glewSearchExtension("GL_EXT_x11_sync_object", extStart, extEnd); + if (glewExperimental || GLEW_EXT_x11_sync_object) CONST_CAST(GLEW_EXT_x11_sync_object) = !_glewInit_GL_EXT_x11_sync_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_x11_sync_object */ #ifdef GL_GREMEDY_frame_terminator - CONST_CAST(GLEW_GREMEDY_frame_terminator) = glewGetExtension("GL_GREMEDY_frame_terminator"); + CONST_CAST(GLEW_GREMEDY_frame_terminator) = _glewSearchExtension("GL_GREMEDY_frame_terminator", extStart, extEnd); if (glewExperimental || GLEW_GREMEDY_frame_terminator) CONST_CAST(GLEW_GREMEDY_frame_terminator) = !_glewInit_GL_GREMEDY_frame_terminator(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_GREMEDY_frame_terminator */ #ifdef GL_GREMEDY_string_marker - CONST_CAST(GLEW_GREMEDY_string_marker) = glewGetExtension("GL_GREMEDY_string_marker"); + CONST_CAST(GLEW_GREMEDY_string_marker) = _glewSearchExtension("GL_GREMEDY_string_marker", extStart, extEnd); if (glewExperimental || GLEW_GREMEDY_string_marker) CONST_CAST(GLEW_GREMEDY_string_marker) = !_glewInit_GL_GREMEDY_string_marker(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_GREMEDY_string_marker */ #ifdef GL_HP_convolution_border_modes - CONST_CAST(GLEW_HP_convolution_border_modes) = glewGetExtension("GL_HP_convolution_border_modes"); + CONST_CAST(GLEW_HP_convolution_border_modes) = _glewSearchExtension("GL_HP_convolution_border_modes", extStart, extEnd); #endif /* GL_HP_convolution_border_modes */ #ifdef GL_HP_image_transform - CONST_CAST(GLEW_HP_image_transform) = glewGetExtension("GL_HP_image_transform"); + CONST_CAST(GLEW_HP_image_transform) = _glewSearchExtension("GL_HP_image_transform", extStart, extEnd); if (glewExperimental || GLEW_HP_image_transform) CONST_CAST(GLEW_HP_image_transform) = !_glewInit_GL_HP_image_transform(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_HP_image_transform */ #ifdef GL_HP_occlusion_test - CONST_CAST(GLEW_HP_occlusion_test) = glewGetExtension("GL_HP_occlusion_test"); + CONST_CAST(GLEW_HP_occlusion_test) = _glewSearchExtension("GL_HP_occlusion_test", extStart, extEnd); #endif /* GL_HP_occlusion_test */ #ifdef GL_HP_texture_lighting - CONST_CAST(GLEW_HP_texture_lighting) = glewGetExtension("GL_HP_texture_lighting"); + CONST_CAST(GLEW_HP_texture_lighting) = _glewSearchExtension("GL_HP_texture_lighting", extStart, extEnd); #endif /* GL_HP_texture_lighting */ #ifdef GL_IBM_cull_vertex - CONST_CAST(GLEW_IBM_cull_vertex) = glewGetExtension("GL_IBM_cull_vertex"); + CONST_CAST(GLEW_IBM_cull_vertex) = _glewSearchExtension("GL_IBM_cull_vertex", extStart, extEnd); #endif /* GL_IBM_cull_vertex */ #ifdef GL_IBM_multimode_draw_arrays - CONST_CAST(GLEW_IBM_multimode_draw_arrays) = glewGetExtension("GL_IBM_multimode_draw_arrays"); + CONST_CAST(GLEW_IBM_multimode_draw_arrays) = _glewSearchExtension("GL_IBM_multimode_draw_arrays", extStart, extEnd); if (glewExperimental || GLEW_IBM_multimode_draw_arrays) CONST_CAST(GLEW_IBM_multimode_draw_arrays) = !_glewInit_GL_IBM_multimode_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_IBM_multimode_draw_arrays */ #ifdef GL_IBM_rasterpos_clip - CONST_CAST(GLEW_IBM_rasterpos_clip) = glewGetExtension("GL_IBM_rasterpos_clip"); + CONST_CAST(GLEW_IBM_rasterpos_clip) = _glewSearchExtension("GL_IBM_rasterpos_clip", extStart, extEnd); #endif /* GL_IBM_rasterpos_clip */ #ifdef GL_IBM_static_data - CONST_CAST(GLEW_IBM_static_data) = glewGetExtension("GL_IBM_static_data"); + CONST_CAST(GLEW_IBM_static_data) = _glewSearchExtension("GL_IBM_static_data", extStart, extEnd); #endif /* GL_IBM_static_data */ #ifdef GL_IBM_texture_mirrored_repeat - CONST_CAST(GLEW_IBM_texture_mirrored_repeat) = glewGetExtension("GL_IBM_texture_mirrored_repeat"); + CONST_CAST(GLEW_IBM_texture_mirrored_repeat) = _glewSearchExtension("GL_IBM_texture_mirrored_repeat", extStart, extEnd); #endif /* GL_IBM_texture_mirrored_repeat */ #ifdef GL_IBM_vertex_array_lists - CONST_CAST(GLEW_IBM_vertex_array_lists) = glewGetExtension("GL_IBM_vertex_array_lists"); + CONST_CAST(GLEW_IBM_vertex_array_lists) = _glewSearchExtension("GL_IBM_vertex_array_lists", extStart, extEnd); if (glewExperimental || GLEW_IBM_vertex_array_lists) CONST_CAST(GLEW_IBM_vertex_array_lists) = !_glewInit_GL_IBM_vertex_array_lists(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_IBM_vertex_array_lists */ #ifdef GL_INGR_color_clamp - CONST_CAST(GLEW_INGR_color_clamp) = glewGetExtension("GL_INGR_color_clamp"); + CONST_CAST(GLEW_INGR_color_clamp) = _glewSearchExtension("GL_INGR_color_clamp", extStart, extEnd); #endif /* GL_INGR_color_clamp */ #ifdef GL_INGR_interlace_read - CONST_CAST(GLEW_INGR_interlace_read) = glewGetExtension("GL_INGR_interlace_read"); + CONST_CAST(GLEW_INGR_interlace_read) = _glewSearchExtension("GL_INGR_interlace_read", extStart, extEnd); #endif /* GL_INGR_interlace_read */ #ifdef GL_INTEL_parallel_arrays - CONST_CAST(GLEW_INTEL_parallel_arrays) = glewGetExtension("GL_INTEL_parallel_arrays"); + CONST_CAST(GLEW_INTEL_parallel_arrays) = _glewSearchExtension("GL_INTEL_parallel_arrays", extStart, extEnd); if (glewExperimental || GLEW_INTEL_parallel_arrays) CONST_CAST(GLEW_INTEL_parallel_arrays) = !_glewInit_GL_INTEL_parallel_arrays(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_INTEL_parallel_arrays */ #ifdef GL_INTEL_texture_scissor - CONST_CAST(GLEW_INTEL_texture_scissor) = glewGetExtension("GL_INTEL_texture_scissor"); + CONST_CAST(GLEW_INTEL_texture_scissor) = _glewSearchExtension("GL_INTEL_texture_scissor", extStart, extEnd); if (glewExperimental || GLEW_INTEL_texture_scissor) CONST_CAST(GLEW_INTEL_texture_scissor) = !_glewInit_GL_INTEL_texture_scissor(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_INTEL_texture_scissor */ #ifdef GL_KTX_buffer_region - CONST_CAST(GLEW_KTX_buffer_region) = glewGetExtension("GL_KTX_buffer_region"); + CONST_CAST(GLEW_KTX_buffer_region) = _glewSearchExtension("GL_KTX_buffer_region", extStart, extEnd); if (glewExperimental || GLEW_KTX_buffer_region) CONST_CAST(GLEW_KTX_buffer_region) = !_glewInit_GL_KTX_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_KTX_buffer_region */ #ifdef GL_MESAX_texture_stack - CONST_CAST(GLEW_MESAX_texture_stack) = glewGetExtension("GL_MESAX_texture_stack"); + CONST_CAST(GLEW_MESAX_texture_stack) = _glewSearchExtension("GL_MESAX_texture_stack", extStart, extEnd); #endif /* GL_MESAX_texture_stack */ #ifdef GL_MESA_pack_invert - CONST_CAST(GLEW_MESA_pack_invert) = glewGetExtension("GL_MESA_pack_invert"); + CONST_CAST(GLEW_MESA_pack_invert) = _glewSearchExtension("GL_MESA_pack_invert", extStart, extEnd); #endif /* GL_MESA_pack_invert */ #ifdef GL_MESA_resize_buffers - CONST_CAST(GLEW_MESA_resize_buffers) = glewGetExtension("GL_MESA_resize_buffers"); + CONST_CAST(GLEW_MESA_resize_buffers) = _glewSearchExtension("GL_MESA_resize_buffers", extStart, extEnd); if (glewExperimental || GLEW_MESA_resize_buffers) CONST_CAST(GLEW_MESA_resize_buffers) = !_glewInit_GL_MESA_resize_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_MESA_resize_buffers */ #ifdef GL_MESA_window_pos - CONST_CAST(GLEW_MESA_window_pos) = glewGetExtension("GL_MESA_window_pos"); + CONST_CAST(GLEW_MESA_window_pos) = _glewSearchExtension("GL_MESA_window_pos", extStart, extEnd); if (glewExperimental || GLEW_MESA_window_pos) CONST_CAST(GLEW_MESA_window_pos) = !_glewInit_GL_MESA_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_MESA_window_pos */ #ifdef GL_MESA_ycbcr_texture - CONST_CAST(GLEW_MESA_ycbcr_texture) = glewGetExtension("GL_MESA_ycbcr_texture"); + CONST_CAST(GLEW_MESA_ycbcr_texture) = _glewSearchExtension("GL_MESA_ycbcr_texture", extStart, extEnd); #endif /* GL_MESA_ycbcr_texture */ #ifdef GL_NVX_gpu_memory_info - CONST_CAST(GLEW_NVX_gpu_memory_info) = glewGetExtension("GL_NVX_gpu_memory_info"); + CONST_CAST(GLEW_NVX_gpu_memory_info) = _glewSearchExtension("GL_NVX_gpu_memory_info", extStart, extEnd); #endif /* GL_NVX_gpu_memory_info */ #ifdef GL_NV_blend_square - CONST_CAST(GLEW_NV_blend_square) = glewGetExtension("GL_NV_blend_square"); + CONST_CAST(GLEW_NV_blend_square) = _glewSearchExtension("GL_NV_blend_square", extStart, extEnd); #endif /* GL_NV_blend_square */ #ifdef GL_NV_conditional_render - CONST_CAST(GLEW_NV_conditional_render) = glewGetExtension("GL_NV_conditional_render"); + CONST_CAST(GLEW_NV_conditional_render) = _glewSearchExtension("GL_NV_conditional_render", extStart, extEnd); if (glewExperimental || GLEW_NV_conditional_render) CONST_CAST(GLEW_NV_conditional_render) = !_glewInit_GL_NV_conditional_render(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_conditional_render */ #ifdef GL_NV_copy_depth_to_color - CONST_CAST(GLEW_NV_copy_depth_to_color) = glewGetExtension("GL_NV_copy_depth_to_color"); + CONST_CAST(GLEW_NV_copy_depth_to_color) = _glewSearchExtension("GL_NV_copy_depth_to_color", extStart, extEnd); #endif /* GL_NV_copy_depth_to_color */ #ifdef GL_NV_copy_image - CONST_CAST(GLEW_NV_copy_image) = glewGetExtension("GL_NV_copy_image"); + CONST_CAST(GLEW_NV_copy_image) = _glewSearchExtension("GL_NV_copy_image", extStart, extEnd); if (glewExperimental || GLEW_NV_copy_image) CONST_CAST(GLEW_NV_copy_image) = !_glewInit_GL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_copy_image */ #ifdef GL_NV_depth_buffer_float - CONST_CAST(GLEW_NV_depth_buffer_float) = glewGetExtension("GL_NV_depth_buffer_float"); + CONST_CAST(GLEW_NV_depth_buffer_float) = _glewSearchExtension("GL_NV_depth_buffer_float", extStart, extEnd); if (glewExperimental || GLEW_NV_depth_buffer_float) CONST_CAST(GLEW_NV_depth_buffer_float) = !_glewInit_GL_NV_depth_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_depth_buffer_float */ #ifdef GL_NV_depth_clamp - CONST_CAST(GLEW_NV_depth_clamp) = glewGetExtension("GL_NV_depth_clamp"); + CONST_CAST(GLEW_NV_depth_clamp) = _glewSearchExtension("GL_NV_depth_clamp", extStart, extEnd); #endif /* GL_NV_depth_clamp */ #ifdef GL_NV_depth_range_unclamped - CONST_CAST(GLEW_NV_depth_range_unclamped) = glewGetExtension("GL_NV_depth_range_unclamped"); + CONST_CAST(GLEW_NV_depth_range_unclamped) = _glewSearchExtension("GL_NV_depth_range_unclamped", extStart, extEnd); #endif /* GL_NV_depth_range_unclamped */ #ifdef GL_NV_evaluators - CONST_CAST(GLEW_NV_evaluators) = glewGetExtension("GL_NV_evaluators"); + CONST_CAST(GLEW_NV_evaluators) = _glewSearchExtension("GL_NV_evaluators", extStart, extEnd); if (glewExperimental || GLEW_NV_evaluators) CONST_CAST(GLEW_NV_evaluators) = !_glewInit_GL_NV_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_evaluators */ #ifdef GL_NV_explicit_multisample - CONST_CAST(GLEW_NV_explicit_multisample) = glewGetExtension("GL_NV_explicit_multisample"); + CONST_CAST(GLEW_NV_explicit_multisample) = _glewSearchExtension("GL_NV_explicit_multisample", extStart, extEnd); if (glewExperimental || GLEW_NV_explicit_multisample) CONST_CAST(GLEW_NV_explicit_multisample) = !_glewInit_GL_NV_explicit_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_explicit_multisample */ #ifdef GL_NV_fence - CONST_CAST(GLEW_NV_fence) = glewGetExtension("GL_NV_fence"); + CONST_CAST(GLEW_NV_fence) = _glewSearchExtension("GL_NV_fence", extStart, extEnd); if (glewExperimental || GLEW_NV_fence) CONST_CAST(GLEW_NV_fence) = !_glewInit_GL_NV_fence(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_fence */ #ifdef GL_NV_float_buffer - CONST_CAST(GLEW_NV_float_buffer) = glewGetExtension("GL_NV_float_buffer"); + CONST_CAST(GLEW_NV_float_buffer) = _glewSearchExtension("GL_NV_float_buffer", extStart, extEnd); #endif /* GL_NV_float_buffer */ #ifdef GL_NV_fog_distance - CONST_CAST(GLEW_NV_fog_distance) = glewGetExtension("GL_NV_fog_distance"); + CONST_CAST(GLEW_NV_fog_distance) = _glewSearchExtension("GL_NV_fog_distance", extStart, extEnd); #endif /* GL_NV_fog_distance */ #ifdef GL_NV_fragment_program - CONST_CAST(GLEW_NV_fragment_program) = glewGetExtension("GL_NV_fragment_program"); + CONST_CAST(GLEW_NV_fragment_program) = _glewSearchExtension("GL_NV_fragment_program", extStart, extEnd); if (glewExperimental || GLEW_NV_fragment_program) CONST_CAST(GLEW_NV_fragment_program) = !_glewInit_GL_NV_fragment_program(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_fragment_program */ #ifdef GL_NV_fragment_program2 - CONST_CAST(GLEW_NV_fragment_program2) = glewGetExtension("GL_NV_fragment_program2"); + CONST_CAST(GLEW_NV_fragment_program2) = _glewSearchExtension("GL_NV_fragment_program2", extStart, extEnd); #endif /* GL_NV_fragment_program2 */ #ifdef GL_NV_fragment_program4 - CONST_CAST(GLEW_NV_fragment_program4) = glewGetExtension("GL_NV_gpu_program4"); + CONST_CAST(GLEW_NV_fragment_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); #endif /* GL_NV_fragment_program4 */ #ifdef GL_NV_fragment_program_option - CONST_CAST(GLEW_NV_fragment_program_option) = glewGetExtension("GL_NV_fragment_program_option"); + CONST_CAST(GLEW_NV_fragment_program_option) = _glewSearchExtension("GL_NV_fragment_program_option", extStart, extEnd); #endif /* GL_NV_fragment_program_option */ #ifdef GL_NV_framebuffer_multisample_coverage - CONST_CAST(GLEW_NV_framebuffer_multisample_coverage) = glewGetExtension("GL_NV_framebuffer_multisample_coverage"); + CONST_CAST(GLEW_NV_framebuffer_multisample_coverage) = _glewSearchExtension("GL_NV_framebuffer_multisample_coverage", extStart, extEnd); if (glewExperimental || GLEW_NV_framebuffer_multisample_coverage) CONST_CAST(GLEW_NV_framebuffer_multisample_coverage) = !_glewInit_GL_NV_framebuffer_multisample_coverage(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_framebuffer_multisample_coverage */ #ifdef GL_NV_geometry_program4 - CONST_CAST(GLEW_NV_geometry_program4) = glewGetExtension("GL_NV_gpu_program4"); + CONST_CAST(GLEW_NV_geometry_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); if (glewExperimental || GLEW_NV_geometry_program4) CONST_CAST(GLEW_NV_geometry_program4) = !_glewInit_GL_NV_geometry_program4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_geometry_program4 */ #ifdef GL_NV_geometry_shader4 - CONST_CAST(GLEW_NV_geometry_shader4) = glewGetExtension("GL_NV_geometry_shader4"); + CONST_CAST(GLEW_NV_geometry_shader4) = _glewSearchExtension("GL_NV_geometry_shader4", extStart, extEnd); #endif /* GL_NV_geometry_shader4 */ #ifdef GL_NV_gpu_program4 - CONST_CAST(GLEW_NV_gpu_program4) = glewGetExtension("GL_NV_gpu_program4"); + CONST_CAST(GLEW_NV_gpu_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); if (glewExperimental || GLEW_NV_gpu_program4) CONST_CAST(GLEW_NV_gpu_program4) = !_glewInit_GL_NV_gpu_program4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_gpu_program4 */ #ifdef GL_NV_gpu_program5 - CONST_CAST(GLEW_NV_gpu_program5) = glewGetExtension("GL_NV_gpu_program5"); + CONST_CAST(GLEW_NV_gpu_program5) = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); #endif /* GL_NV_gpu_program5 */ #ifdef GL_NV_gpu_program_fp64 - CONST_CAST(GLEW_NV_gpu_program_fp64) = glewGetExtension("GL_NV_gpu_program_fp64"); + CONST_CAST(GLEW_NV_gpu_program_fp64) = _glewSearchExtension("GL_NV_gpu_program_fp64", extStart, extEnd); #endif /* GL_NV_gpu_program_fp64 */ #ifdef GL_NV_gpu_shader5 - CONST_CAST(GLEW_NV_gpu_shader5) = glewGetExtension("GL_NV_gpu_shader5"); + CONST_CAST(GLEW_NV_gpu_shader5) = _glewSearchExtension("GL_NV_gpu_shader5", extStart, extEnd); if (glewExperimental || GLEW_NV_gpu_shader5) CONST_CAST(GLEW_NV_gpu_shader5) = !_glewInit_GL_NV_gpu_shader5(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_gpu_shader5 */ #ifdef GL_NV_half_float - CONST_CAST(GLEW_NV_half_float) = glewGetExtension("GL_NV_half_float"); + CONST_CAST(GLEW_NV_half_float) = _glewSearchExtension("GL_NV_half_float", extStart, extEnd); if (glewExperimental || GLEW_NV_half_float) CONST_CAST(GLEW_NV_half_float) = !_glewInit_GL_NV_half_float(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_half_float */ #ifdef GL_NV_light_max_exponent - CONST_CAST(GLEW_NV_light_max_exponent) = glewGetExtension("GL_NV_light_max_exponent"); + CONST_CAST(GLEW_NV_light_max_exponent) = _glewSearchExtension("GL_NV_light_max_exponent", extStart, extEnd); #endif /* GL_NV_light_max_exponent */ #ifdef GL_NV_multisample_coverage - CONST_CAST(GLEW_NV_multisample_coverage) = glewGetExtension("GL_NV_multisample_coverage"); + CONST_CAST(GLEW_NV_multisample_coverage) = _glewSearchExtension("GL_NV_multisample_coverage", extStart, extEnd); #endif /* GL_NV_multisample_coverage */ #ifdef GL_NV_multisample_filter_hint - CONST_CAST(GLEW_NV_multisample_filter_hint) = glewGetExtension("GL_NV_multisample_filter_hint"); + CONST_CAST(GLEW_NV_multisample_filter_hint) = _glewSearchExtension("GL_NV_multisample_filter_hint", extStart, extEnd); #endif /* GL_NV_multisample_filter_hint */ #ifdef GL_NV_occlusion_query - CONST_CAST(GLEW_NV_occlusion_query) = glewGetExtension("GL_NV_occlusion_query"); + CONST_CAST(GLEW_NV_occlusion_query) = _glewSearchExtension("GL_NV_occlusion_query", extStart, extEnd); if (glewExperimental || GLEW_NV_occlusion_query) CONST_CAST(GLEW_NV_occlusion_query) = !_glewInit_GL_NV_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_occlusion_query */ #ifdef GL_NV_packed_depth_stencil - CONST_CAST(GLEW_NV_packed_depth_stencil) = glewGetExtension("GL_NV_packed_depth_stencil"); + CONST_CAST(GLEW_NV_packed_depth_stencil) = _glewSearchExtension("GL_NV_packed_depth_stencil", extStart, extEnd); #endif /* GL_NV_packed_depth_stencil */ #ifdef GL_NV_parameter_buffer_object - CONST_CAST(GLEW_NV_parameter_buffer_object) = glewGetExtension("GL_NV_parameter_buffer_object"); + CONST_CAST(GLEW_NV_parameter_buffer_object) = _glewSearchExtension("GL_NV_parameter_buffer_object", extStart, extEnd); if (glewExperimental || GLEW_NV_parameter_buffer_object) CONST_CAST(GLEW_NV_parameter_buffer_object) = !_glewInit_GL_NV_parameter_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_parameter_buffer_object */ #ifdef GL_NV_parameter_buffer_object2 - CONST_CAST(GLEW_NV_parameter_buffer_object2) = glewGetExtension("GL_NV_parameter_buffer_object2"); + CONST_CAST(GLEW_NV_parameter_buffer_object2) = _glewSearchExtension("GL_NV_parameter_buffer_object2", extStart, extEnd); #endif /* GL_NV_parameter_buffer_object2 */ #ifdef GL_NV_pixel_data_range - CONST_CAST(GLEW_NV_pixel_data_range) = glewGetExtension("GL_NV_pixel_data_range"); + CONST_CAST(GLEW_NV_pixel_data_range) = _glewSearchExtension("GL_NV_pixel_data_range", extStart, extEnd); if (glewExperimental || GLEW_NV_pixel_data_range) CONST_CAST(GLEW_NV_pixel_data_range) = !_glewInit_GL_NV_pixel_data_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_pixel_data_range */ #ifdef GL_NV_point_sprite - CONST_CAST(GLEW_NV_point_sprite) = glewGetExtension("GL_NV_point_sprite"); + CONST_CAST(GLEW_NV_point_sprite) = _glewSearchExtension("GL_NV_point_sprite", extStart, extEnd); if (glewExperimental || GLEW_NV_point_sprite) CONST_CAST(GLEW_NV_point_sprite) = !_glewInit_GL_NV_point_sprite(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_point_sprite */ #ifdef GL_NV_present_video - CONST_CAST(GLEW_NV_present_video) = glewGetExtension("GL_NV_present_video"); + CONST_CAST(GLEW_NV_present_video) = _glewSearchExtension("GL_NV_present_video", extStart, extEnd); if (glewExperimental || GLEW_NV_present_video) CONST_CAST(GLEW_NV_present_video) = !_glewInit_GL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_present_video */ #ifdef GL_NV_primitive_restart - CONST_CAST(GLEW_NV_primitive_restart) = glewGetExtension("GL_NV_primitive_restart"); + CONST_CAST(GLEW_NV_primitive_restart) = _glewSearchExtension("GL_NV_primitive_restart", extStart, extEnd); if (glewExperimental || GLEW_NV_primitive_restart) CONST_CAST(GLEW_NV_primitive_restart) = !_glewInit_GL_NV_primitive_restart(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_primitive_restart */ #ifdef GL_NV_register_combiners - CONST_CAST(GLEW_NV_register_combiners) = glewGetExtension("GL_NV_register_combiners"); + CONST_CAST(GLEW_NV_register_combiners) = _glewSearchExtension("GL_NV_register_combiners", extStart, extEnd); if (glewExperimental || GLEW_NV_register_combiners) CONST_CAST(GLEW_NV_register_combiners) = !_glewInit_GL_NV_register_combiners(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_register_combiners */ #ifdef GL_NV_register_combiners2 - CONST_CAST(GLEW_NV_register_combiners2) = glewGetExtension("GL_NV_register_combiners2"); + CONST_CAST(GLEW_NV_register_combiners2) = _glewSearchExtension("GL_NV_register_combiners2", extStart, extEnd); if (glewExperimental || GLEW_NV_register_combiners2) CONST_CAST(GLEW_NV_register_combiners2) = !_glewInit_GL_NV_register_combiners2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_register_combiners2 */ #ifdef GL_NV_shader_buffer_load - CONST_CAST(GLEW_NV_shader_buffer_load) = glewGetExtension("GL_NV_shader_buffer_load"); + CONST_CAST(GLEW_NV_shader_buffer_load) = _glewSearchExtension("GL_NV_shader_buffer_load", extStart, extEnd); if (glewExperimental || GLEW_NV_shader_buffer_load) CONST_CAST(GLEW_NV_shader_buffer_load) = !_glewInit_GL_NV_shader_buffer_load(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_shader_buffer_load */ #ifdef GL_NV_tessellation_program5 - CONST_CAST(GLEW_NV_tessellation_program5) = glewGetExtension("GL_NV_gpu_program5"); + CONST_CAST(GLEW_NV_tessellation_program5) = _glewSearchExtension("GL_NV_gpu_program5", extStart, extEnd); #endif /* GL_NV_tessellation_program5 */ #ifdef GL_NV_texgen_emboss - CONST_CAST(GLEW_NV_texgen_emboss) = glewGetExtension("GL_NV_texgen_emboss"); + CONST_CAST(GLEW_NV_texgen_emboss) = _glewSearchExtension("GL_NV_texgen_emboss", extStart, extEnd); #endif /* GL_NV_texgen_emboss */ #ifdef GL_NV_texgen_reflection - CONST_CAST(GLEW_NV_texgen_reflection) = glewGetExtension("GL_NV_texgen_reflection"); + CONST_CAST(GLEW_NV_texgen_reflection) = _glewSearchExtension("GL_NV_texgen_reflection", extStart, extEnd); #endif /* GL_NV_texgen_reflection */ #ifdef GL_NV_texture_barrier - CONST_CAST(GLEW_NV_texture_barrier) = glewGetExtension("GL_NV_texture_barrier"); + CONST_CAST(GLEW_NV_texture_barrier) = _glewSearchExtension("GL_NV_texture_barrier", extStart, extEnd); if (glewExperimental || GLEW_NV_texture_barrier) CONST_CAST(GLEW_NV_texture_barrier) = !_glewInit_GL_NV_texture_barrier(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_texture_barrier */ #ifdef GL_NV_texture_compression_vtc - CONST_CAST(GLEW_NV_texture_compression_vtc) = glewGetExtension("GL_NV_texture_compression_vtc"); + CONST_CAST(GLEW_NV_texture_compression_vtc) = _glewSearchExtension("GL_NV_texture_compression_vtc", extStart, extEnd); #endif /* GL_NV_texture_compression_vtc */ #ifdef GL_NV_texture_env_combine4 - CONST_CAST(GLEW_NV_texture_env_combine4) = glewGetExtension("GL_NV_texture_env_combine4"); + CONST_CAST(GLEW_NV_texture_env_combine4) = _glewSearchExtension("GL_NV_texture_env_combine4", extStart, extEnd); #endif /* GL_NV_texture_env_combine4 */ #ifdef GL_NV_texture_expand_normal - CONST_CAST(GLEW_NV_texture_expand_normal) = glewGetExtension("GL_NV_texture_expand_normal"); + CONST_CAST(GLEW_NV_texture_expand_normal) = _glewSearchExtension("GL_NV_texture_expand_normal", extStart, extEnd); #endif /* GL_NV_texture_expand_normal */ +#ifdef GL_NV_texture_multisample + CONST_CAST(GLEW_NV_texture_multisample) = _glewSearchExtension("GL_NV_texture_multisample", extStart, extEnd); + if (glewExperimental || GLEW_NV_texture_multisample) CONST_CAST(GLEW_NV_texture_multisample) = !_glewInit_GL_NV_texture_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_texture_multisample */ #ifdef GL_NV_texture_rectangle - CONST_CAST(GLEW_NV_texture_rectangle) = glewGetExtension("GL_NV_texture_rectangle"); + CONST_CAST(GLEW_NV_texture_rectangle) = _glewSearchExtension("GL_NV_texture_rectangle", extStart, extEnd); #endif /* GL_NV_texture_rectangle */ #ifdef GL_NV_texture_shader - CONST_CAST(GLEW_NV_texture_shader) = glewGetExtension("GL_NV_texture_shader"); + CONST_CAST(GLEW_NV_texture_shader) = _glewSearchExtension("GL_NV_texture_shader", extStart, extEnd); #endif /* GL_NV_texture_shader */ #ifdef GL_NV_texture_shader2 - CONST_CAST(GLEW_NV_texture_shader2) = glewGetExtension("GL_NV_texture_shader2"); + CONST_CAST(GLEW_NV_texture_shader2) = _glewSearchExtension("GL_NV_texture_shader2", extStart, extEnd); #endif /* GL_NV_texture_shader2 */ #ifdef GL_NV_texture_shader3 - CONST_CAST(GLEW_NV_texture_shader3) = glewGetExtension("GL_NV_texture_shader3"); + CONST_CAST(GLEW_NV_texture_shader3) = _glewSearchExtension("GL_NV_texture_shader3", extStart, extEnd); #endif /* GL_NV_texture_shader3 */ #ifdef GL_NV_transform_feedback - CONST_CAST(GLEW_NV_transform_feedback) = glewGetExtension("GL_NV_transform_feedback"); + CONST_CAST(GLEW_NV_transform_feedback) = _glewSearchExtension("GL_NV_transform_feedback", extStart, extEnd); if (glewExperimental || GLEW_NV_transform_feedback) CONST_CAST(GLEW_NV_transform_feedback) = !_glewInit_GL_NV_transform_feedback(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_transform_feedback */ #ifdef GL_NV_transform_feedback2 - CONST_CAST(GLEW_NV_transform_feedback2) = glewGetExtension("GL_NV_transform_feedback2"); + CONST_CAST(GLEW_NV_transform_feedback2) = _glewSearchExtension("GL_NV_transform_feedback2", extStart, extEnd); if (glewExperimental || GLEW_NV_transform_feedback2) CONST_CAST(GLEW_NV_transform_feedback2) = !_glewInit_GL_NV_transform_feedback2(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_transform_feedback2 */ #ifdef GL_NV_vdpau_interop - CONST_CAST(GLEW_NV_vdpau_interop) = glewGetExtension("GL_NV_vdpau_interop"); + CONST_CAST(GLEW_NV_vdpau_interop) = _glewSearchExtension("GL_NV_vdpau_interop", extStart, extEnd); if (glewExperimental || GLEW_NV_vdpau_interop) CONST_CAST(GLEW_NV_vdpau_interop) = !_glewInit_GL_NV_vdpau_interop(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vdpau_interop */ #ifdef GL_NV_vertex_array_range - CONST_CAST(GLEW_NV_vertex_array_range) = glewGetExtension("GL_NV_vertex_array_range"); + CONST_CAST(GLEW_NV_vertex_array_range) = _glewSearchExtension("GL_NV_vertex_array_range", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_array_range) CONST_CAST(GLEW_NV_vertex_array_range) = !_glewInit_GL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_array_range */ #ifdef GL_NV_vertex_array_range2 - CONST_CAST(GLEW_NV_vertex_array_range2) = glewGetExtension("GL_NV_vertex_array_range2"); + CONST_CAST(GLEW_NV_vertex_array_range2) = _glewSearchExtension("GL_NV_vertex_array_range2", extStart, extEnd); #endif /* GL_NV_vertex_array_range2 */ #ifdef GL_NV_vertex_attrib_integer_64bit - CONST_CAST(GLEW_NV_vertex_attrib_integer_64bit) = glewGetExtension("GL_NV_vertex_attrib_integer_64bit"); + CONST_CAST(GLEW_NV_vertex_attrib_integer_64bit) = _glewSearchExtension("GL_NV_vertex_attrib_integer_64bit", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_attrib_integer_64bit) CONST_CAST(GLEW_NV_vertex_attrib_integer_64bit) = !_glewInit_GL_NV_vertex_attrib_integer_64bit(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_attrib_integer_64bit */ #ifdef GL_NV_vertex_buffer_unified_memory - CONST_CAST(GLEW_NV_vertex_buffer_unified_memory) = glewGetExtension("GL_NV_vertex_buffer_unified_memory"); + CONST_CAST(GLEW_NV_vertex_buffer_unified_memory) = _glewSearchExtension("GL_NV_vertex_buffer_unified_memory", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_buffer_unified_memory) CONST_CAST(GLEW_NV_vertex_buffer_unified_memory) = !_glewInit_GL_NV_vertex_buffer_unified_memory(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_buffer_unified_memory */ #ifdef GL_NV_vertex_program - CONST_CAST(GLEW_NV_vertex_program) = glewGetExtension("GL_NV_vertex_program"); + CONST_CAST(GLEW_NV_vertex_program) = _glewSearchExtension("GL_NV_vertex_program", extStart, extEnd); if (glewExperimental || GLEW_NV_vertex_program) CONST_CAST(GLEW_NV_vertex_program) = !_glewInit_GL_NV_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_NV_vertex_program */ #ifdef GL_NV_vertex_program1_1 - CONST_CAST(GLEW_NV_vertex_program1_1) = glewGetExtension("GL_NV_vertex_program1_1"); + CONST_CAST(GLEW_NV_vertex_program1_1) = _glewSearchExtension("GL_NV_vertex_program1_1", extStart, extEnd); #endif /* GL_NV_vertex_program1_1 */ #ifdef GL_NV_vertex_program2 - CONST_CAST(GLEW_NV_vertex_program2) = glewGetExtension("GL_NV_vertex_program2"); + CONST_CAST(GLEW_NV_vertex_program2) = _glewSearchExtension("GL_NV_vertex_program2", extStart, extEnd); #endif /* GL_NV_vertex_program2 */ #ifdef GL_NV_vertex_program2_option - CONST_CAST(GLEW_NV_vertex_program2_option) = glewGetExtension("GL_NV_vertex_program2_option"); + CONST_CAST(GLEW_NV_vertex_program2_option) = _glewSearchExtension("GL_NV_vertex_program2_option", extStart, extEnd); #endif /* GL_NV_vertex_program2_option */ #ifdef GL_NV_vertex_program3 - CONST_CAST(GLEW_NV_vertex_program3) = glewGetExtension("GL_NV_vertex_program3"); + CONST_CAST(GLEW_NV_vertex_program3) = _glewSearchExtension("GL_NV_vertex_program3", extStart, extEnd); #endif /* GL_NV_vertex_program3 */ #ifdef GL_NV_vertex_program4 - CONST_CAST(GLEW_NV_vertex_program4) = glewGetExtension("GL_NV_gpu_program4"); + CONST_CAST(GLEW_NV_vertex_program4) = _glewSearchExtension("GL_NV_gpu_program4", extStart, extEnd); #endif /* GL_NV_vertex_program4 */ +#ifdef GL_NV_video_capture + CONST_CAST(GLEW_NV_video_capture) = _glewSearchExtension("GL_NV_video_capture", extStart, extEnd); + if (glewExperimental || GLEW_NV_video_capture) CONST_CAST(GLEW_NV_video_capture) = !_glewInit_GL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_video_capture */ #ifdef GL_OES_byte_coordinates - CONST_CAST(GLEW_OES_byte_coordinates) = glewGetExtension("GL_OES_byte_coordinates"); + CONST_CAST(GLEW_OES_byte_coordinates) = _glewSearchExtension("GL_OES_byte_coordinates", extStart, extEnd); #endif /* GL_OES_byte_coordinates */ #ifdef GL_OES_compressed_paletted_texture - CONST_CAST(GLEW_OES_compressed_paletted_texture) = glewGetExtension("GL_OES_compressed_paletted_texture"); + CONST_CAST(GLEW_OES_compressed_paletted_texture) = _glewSearchExtension("GL_OES_compressed_paletted_texture", extStart, extEnd); #endif /* GL_OES_compressed_paletted_texture */ #ifdef GL_OES_read_format - CONST_CAST(GLEW_OES_read_format) = glewGetExtension("GL_OES_read_format"); + CONST_CAST(GLEW_OES_read_format) = _glewSearchExtension("GL_OES_read_format", extStart, extEnd); #endif /* GL_OES_read_format */ #ifdef GL_OES_single_precision - CONST_CAST(GLEW_OES_single_precision) = glewGetExtension("GL_OES_single_precision"); + CONST_CAST(GLEW_OES_single_precision) = _glewSearchExtension("GL_OES_single_precision", extStart, extEnd); if (glewExperimental || GLEW_OES_single_precision) CONST_CAST(GLEW_OES_single_precision) = !_glewInit_GL_OES_single_precision(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_OES_single_precision */ #ifdef GL_OML_interlace - CONST_CAST(GLEW_OML_interlace) = glewGetExtension("GL_OML_interlace"); + CONST_CAST(GLEW_OML_interlace) = _glewSearchExtension("GL_OML_interlace", extStart, extEnd); #endif /* GL_OML_interlace */ #ifdef GL_OML_resample - CONST_CAST(GLEW_OML_resample) = glewGetExtension("GL_OML_resample"); + CONST_CAST(GLEW_OML_resample) = _glewSearchExtension("GL_OML_resample", extStart, extEnd); #endif /* GL_OML_resample */ #ifdef GL_OML_subsample - CONST_CAST(GLEW_OML_subsample) = glewGetExtension("GL_OML_subsample"); + CONST_CAST(GLEW_OML_subsample) = _glewSearchExtension("GL_OML_subsample", extStart, extEnd); #endif /* GL_OML_subsample */ #ifdef GL_PGI_misc_hints - CONST_CAST(GLEW_PGI_misc_hints) = glewGetExtension("GL_PGI_misc_hints"); + CONST_CAST(GLEW_PGI_misc_hints) = _glewSearchExtension("GL_PGI_misc_hints", extStart, extEnd); #endif /* GL_PGI_misc_hints */ #ifdef GL_PGI_vertex_hints - CONST_CAST(GLEW_PGI_vertex_hints) = glewGetExtension("GL_PGI_vertex_hints"); + CONST_CAST(GLEW_PGI_vertex_hints) = _glewSearchExtension("GL_PGI_vertex_hints", extStart, extEnd); #endif /* GL_PGI_vertex_hints */ #ifdef GL_REND_screen_coordinates - CONST_CAST(GLEW_REND_screen_coordinates) = glewGetExtension("GL_REND_screen_coordinates"); + CONST_CAST(GLEW_REND_screen_coordinates) = _glewSearchExtension("GL_REND_screen_coordinates", extStart, extEnd); #endif /* GL_REND_screen_coordinates */ #ifdef GL_S3_s3tc - CONST_CAST(GLEW_S3_s3tc) = glewGetExtension("GL_S3_s3tc"); + CONST_CAST(GLEW_S3_s3tc) = _glewSearchExtension("GL_S3_s3tc", extStart, extEnd); #endif /* GL_S3_s3tc */ #ifdef GL_SGIS_color_range - CONST_CAST(GLEW_SGIS_color_range) = glewGetExtension("GL_SGIS_color_range"); + CONST_CAST(GLEW_SGIS_color_range) = _glewSearchExtension("GL_SGIS_color_range", extStart, extEnd); #endif /* GL_SGIS_color_range */ #ifdef GL_SGIS_detail_texture - CONST_CAST(GLEW_SGIS_detail_texture) = glewGetExtension("GL_SGIS_detail_texture"); + CONST_CAST(GLEW_SGIS_detail_texture) = _glewSearchExtension("GL_SGIS_detail_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIS_detail_texture) CONST_CAST(GLEW_SGIS_detail_texture) = !_glewInit_GL_SGIS_detail_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_detail_texture */ #ifdef GL_SGIS_fog_function - CONST_CAST(GLEW_SGIS_fog_function) = glewGetExtension("GL_SGIS_fog_function"); + CONST_CAST(GLEW_SGIS_fog_function) = _glewSearchExtension("GL_SGIS_fog_function", extStart, extEnd); if (glewExperimental || GLEW_SGIS_fog_function) CONST_CAST(GLEW_SGIS_fog_function) = !_glewInit_GL_SGIS_fog_function(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_fog_function */ #ifdef GL_SGIS_generate_mipmap - CONST_CAST(GLEW_SGIS_generate_mipmap) = glewGetExtension("GL_SGIS_generate_mipmap"); + CONST_CAST(GLEW_SGIS_generate_mipmap) = _glewSearchExtension("GL_SGIS_generate_mipmap", extStart, extEnd); #endif /* GL_SGIS_generate_mipmap */ #ifdef GL_SGIS_multisample - CONST_CAST(GLEW_SGIS_multisample) = glewGetExtension("GL_SGIS_multisample"); + CONST_CAST(GLEW_SGIS_multisample) = _glewSearchExtension("GL_SGIS_multisample", extStart, extEnd); if (glewExperimental || GLEW_SGIS_multisample) CONST_CAST(GLEW_SGIS_multisample) = !_glewInit_GL_SGIS_multisample(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_multisample */ #ifdef GL_SGIS_pixel_texture - CONST_CAST(GLEW_SGIS_pixel_texture) = glewGetExtension("GL_SGIS_pixel_texture"); + CONST_CAST(GLEW_SGIS_pixel_texture) = _glewSearchExtension("GL_SGIS_pixel_texture", extStart, extEnd); #endif /* GL_SGIS_pixel_texture */ #ifdef GL_SGIS_point_line_texgen - CONST_CAST(GLEW_SGIS_point_line_texgen) = glewGetExtension("GL_SGIS_point_line_texgen"); + CONST_CAST(GLEW_SGIS_point_line_texgen) = _glewSearchExtension("GL_SGIS_point_line_texgen", extStart, extEnd); #endif /* GL_SGIS_point_line_texgen */ #ifdef GL_SGIS_sharpen_texture - CONST_CAST(GLEW_SGIS_sharpen_texture) = glewGetExtension("GL_SGIS_sharpen_texture"); + CONST_CAST(GLEW_SGIS_sharpen_texture) = _glewSearchExtension("GL_SGIS_sharpen_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIS_sharpen_texture) CONST_CAST(GLEW_SGIS_sharpen_texture) = !_glewInit_GL_SGIS_sharpen_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_sharpen_texture */ #ifdef GL_SGIS_texture4D - CONST_CAST(GLEW_SGIS_texture4D) = glewGetExtension("GL_SGIS_texture4D"); + CONST_CAST(GLEW_SGIS_texture4D) = _glewSearchExtension("GL_SGIS_texture4D", extStart, extEnd); if (glewExperimental || GLEW_SGIS_texture4D) CONST_CAST(GLEW_SGIS_texture4D) = !_glewInit_GL_SGIS_texture4D(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_texture4D */ #ifdef GL_SGIS_texture_border_clamp - CONST_CAST(GLEW_SGIS_texture_border_clamp) = glewGetExtension("GL_SGIS_texture_border_clamp"); + CONST_CAST(GLEW_SGIS_texture_border_clamp) = _glewSearchExtension("GL_SGIS_texture_border_clamp", extStart, extEnd); #endif /* GL_SGIS_texture_border_clamp */ #ifdef GL_SGIS_texture_edge_clamp - CONST_CAST(GLEW_SGIS_texture_edge_clamp) = glewGetExtension("GL_SGIS_texture_edge_clamp"); + CONST_CAST(GLEW_SGIS_texture_edge_clamp) = _glewSearchExtension("GL_SGIS_texture_edge_clamp", extStart, extEnd); #endif /* GL_SGIS_texture_edge_clamp */ #ifdef GL_SGIS_texture_filter4 - CONST_CAST(GLEW_SGIS_texture_filter4) = glewGetExtension("GL_SGIS_texture_filter4"); + CONST_CAST(GLEW_SGIS_texture_filter4) = _glewSearchExtension("GL_SGIS_texture_filter4", extStart, extEnd); if (glewExperimental || GLEW_SGIS_texture_filter4) CONST_CAST(GLEW_SGIS_texture_filter4) = !_glewInit_GL_SGIS_texture_filter4(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIS_texture_filter4 */ #ifdef GL_SGIS_texture_lod - CONST_CAST(GLEW_SGIS_texture_lod) = glewGetExtension("GL_SGIS_texture_lod"); + CONST_CAST(GLEW_SGIS_texture_lod) = _glewSearchExtension("GL_SGIS_texture_lod", extStart, extEnd); #endif /* GL_SGIS_texture_lod */ #ifdef GL_SGIS_texture_select - CONST_CAST(GLEW_SGIS_texture_select) = glewGetExtension("GL_SGIS_texture_select"); + CONST_CAST(GLEW_SGIS_texture_select) = _glewSearchExtension("GL_SGIS_texture_select", extStart, extEnd); #endif /* GL_SGIS_texture_select */ #ifdef GL_SGIX_async - CONST_CAST(GLEW_SGIX_async) = glewGetExtension("GL_SGIX_async"); + CONST_CAST(GLEW_SGIX_async) = _glewSearchExtension("GL_SGIX_async", extStart, extEnd); if (glewExperimental || GLEW_SGIX_async) CONST_CAST(GLEW_SGIX_async) = !_glewInit_GL_SGIX_async(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_async */ #ifdef GL_SGIX_async_histogram - CONST_CAST(GLEW_SGIX_async_histogram) = glewGetExtension("GL_SGIX_async_histogram"); + CONST_CAST(GLEW_SGIX_async_histogram) = _glewSearchExtension("GL_SGIX_async_histogram", extStart, extEnd); #endif /* GL_SGIX_async_histogram */ #ifdef GL_SGIX_async_pixel - CONST_CAST(GLEW_SGIX_async_pixel) = glewGetExtension("GL_SGIX_async_pixel"); + CONST_CAST(GLEW_SGIX_async_pixel) = _glewSearchExtension("GL_SGIX_async_pixel", extStart, extEnd); #endif /* GL_SGIX_async_pixel */ #ifdef GL_SGIX_blend_alpha_minmax - CONST_CAST(GLEW_SGIX_blend_alpha_minmax) = glewGetExtension("GL_SGIX_blend_alpha_minmax"); + CONST_CAST(GLEW_SGIX_blend_alpha_minmax) = _glewSearchExtension("GL_SGIX_blend_alpha_minmax", extStart, extEnd); #endif /* GL_SGIX_blend_alpha_minmax */ #ifdef GL_SGIX_clipmap - CONST_CAST(GLEW_SGIX_clipmap) = glewGetExtension("GL_SGIX_clipmap"); + CONST_CAST(GLEW_SGIX_clipmap) = _glewSearchExtension("GL_SGIX_clipmap", extStart, extEnd); #endif /* GL_SGIX_clipmap */ #ifdef GL_SGIX_convolution_accuracy - CONST_CAST(GLEW_SGIX_convolution_accuracy) = glewGetExtension("GL_SGIX_convolution_accuracy"); + CONST_CAST(GLEW_SGIX_convolution_accuracy) = _glewSearchExtension("GL_SGIX_convolution_accuracy", extStart, extEnd); #endif /* GL_SGIX_convolution_accuracy */ #ifdef GL_SGIX_depth_texture - CONST_CAST(GLEW_SGIX_depth_texture) = glewGetExtension("GL_SGIX_depth_texture"); + CONST_CAST(GLEW_SGIX_depth_texture) = _glewSearchExtension("GL_SGIX_depth_texture", extStart, extEnd); #endif /* GL_SGIX_depth_texture */ #ifdef GL_SGIX_flush_raster - CONST_CAST(GLEW_SGIX_flush_raster) = glewGetExtension("GL_SGIX_flush_raster"); + CONST_CAST(GLEW_SGIX_flush_raster) = _glewSearchExtension("GL_SGIX_flush_raster", extStart, extEnd); if (glewExperimental || GLEW_SGIX_flush_raster) CONST_CAST(GLEW_SGIX_flush_raster) = !_glewInit_GL_SGIX_flush_raster(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_flush_raster */ #ifdef GL_SGIX_fog_offset - CONST_CAST(GLEW_SGIX_fog_offset) = glewGetExtension("GL_SGIX_fog_offset"); + CONST_CAST(GLEW_SGIX_fog_offset) = _glewSearchExtension("GL_SGIX_fog_offset", extStart, extEnd); #endif /* GL_SGIX_fog_offset */ #ifdef GL_SGIX_fog_texture - CONST_CAST(GLEW_SGIX_fog_texture) = glewGetExtension("GL_SGIX_fog_texture"); + CONST_CAST(GLEW_SGIX_fog_texture) = _glewSearchExtension("GL_SGIX_fog_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIX_fog_texture) CONST_CAST(GLEW_SGIX_fog_texture) = !_glewInit_GL_SGIX_fog_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_fog_texture */ #ifdef GL_SGIX_fragment_specular_lighting - CONST_CAST(GLEW_SGIX_fragment_specular_lighting) = glewGetExtension("GL_SGIX_fragment_specular_lighting"); + CONST_CAST(GLEW_SGIX_fragment_specular_lighting) = _glewSearchExtension("GL_SGIX_fragment_specular_lighting", extStart, extEnd); if (glewExperimental || GLEW_SGIX_fragment_specular_lighting) CONST_CAST(GLEW_SGIX_fragment_specular_lighting) = !_glewInit_GL_SGIX_fragment_specular_lighting(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_fragment_specular_lighting */ #ifdef GL_SGIX_framezoom - CONST_CAST(GLEW_SGIX_framezoom) = glewGetExtension("GL_SGIX_framezoom"); + CONST_CAST(GLEW_SGIX_framezoom) = _glewSearchExtension("GL_SGIX_framezoom", extStart, extEnd); if (glewExperimental || GLEW_SGIX_framezoom) CONST_CAST(GLEW_SGIX_framezoom) = !_glewInit_GL_SGIX_framezoom(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_framezoom */ #ifdef GL_SGIX_interlace - CONST_CAST(GLEW_SGIX_interlace) = glewGetExtension("GL_SGIX_interlace"); + CONST_CAST(GLEW_SGIX_interlace) = _glewSearchExtension("GL_SGIX_interlace", extStart, extEnd); #endif /* GL_SGIX_interlace */ #ifdef GL_SGIX_ir_instrument1 - CONST_CAST(GLEW_SGIX_ir_instrument1) = glewGetExtension("GL_SGIX_ir_instrument1"); + CONST_CAST(GLEW_SGIX_ir_instrument1) = _glewSearchExtension("GL_SGIX_ir_instrument1", extStart, extEnd); #endif /* GL_SGIX_ir_instrument1 */ #ifdef GL_SGIX_list_priority - CONST_CAST(GLEW_SGIX_list_priority) = glewGetExtension("GL_SGIX_list_priority"); + CONST_CAST(GLEW_SGIX_list_priority) = _glewSearchExtension("GL_SGIX_list_priority", extStart, extEnd); #endif /* GL_SGIX_list_priority */ #ifdef GL_SGIX_pixel_texture - CONST_CAST(GLEW_SGIX_pixel_texture) = glewGetExtension("GL_SGIX_pixel_texture"); + CONST_CAST(GLEW_SGIX_pixel_texture) = _glewSearchExtension("GL_SGIX_pixel_texture", extStart, extEnd); if (glewExperimental || GLEW_SGIX_pixel_texture) CONST_CAST(GLEW_SGIX_pixel_texture) = !_glewInit_GL_SGIX_pixel_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_pixel_texture */ #ifdef GL_SGIX_pixel_texture_bits - CONST_CAST(GLEW_SGIX_pixel_texture_bits) = glewGetExtension("GL_SGIX_pixel_texture_bits"); + CONST_CAST(GLEW_SGIX_pixel_texture_bits) = _glewSearchExtension("GL_SGIX_pixel_texture_bits", extStart, extEnd); #endif /* GL_SGIX_pixel_texture_bits */ #ifdef GL_SGIX_reference_plane - CONST_CAST(GLEW_SGIX_reference_plane) = glewGetExtension("GL_SGIX_reference_plane"); + CONST_CAST(GLEW_SGIX_reference_plane) = _glewSearchExtension("GL_SGIX_reference_plane", extStart, extEnd); if (glewExperimental || GLEW_SGIX_reference_plane) CONST_CAST(GLEW_SGIX_reference_plane) = !_glewInit_GL_SGIX_reference_plane(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_reference_plane */ #ifdef GL_SGIX_resample - CONST_CAST(GLEW_SGIX_resample) = glewGetExtension("GL_SGIX_resample"); + CONST_CAST(GLEW_SGIX_resample) = _glewSearchExtension("GL_SGIX_resample", extStart, extEnd); #endif /* GL_SGIX_resample */ #ifdef GL_SGIX_shadow - CONST_CAST(GLEW_SGIX_shadow) = glewGetExtension("GL_SGIX_shadow"); + CONST_CAST(GLEW_SGIX_shadow) = _glewSearchExtension("GL_SGIX_shadow", extStart, extEnd); #endif /* GL_SGIX_shadow */ #ifdef GL_SGIX_shadow_ambient - CONST_CAST(GLEW_SGIX_shadow_ambient) = glewGetExtension("GL_SGIX_shadow_ambient"); + CONST_CAST(GLEW_SGIX_shadow_ambient) = _glewSearchExtension("GL_SGIX_shadow_ambient", extStart, extEnd); #endif /* GL_SGIX_shadow_ambient */ #ifdef GL_SGIX_sprite - CONST_CAST(GLEW_SGIX_sprite) = glewGetExtension("GL_SGIX_sprite"); + CONST_CAST(GLEW_SGIX_sprite) = _glewSearchExtension("GL_SGIX_sprite", extStart, extEnd); if (glewExperimental || GLEW_SGIX_sprite) CONST_CAST(GLEW_SGIX_sprite) = !_glewInit_GL_SGIX_sprite(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_sprite */ #ifdef GL_SGIX_tag_sample_buffer - CONST_CAST(GLEW_SGIX_tag_sample_buffer) = glewGetExtension("GL_SGIX_tag_sample_buffer"); + CONST_CAST(GLEW_SGIX_tag_sample_buffer) = _glewSearchExtension("GL_SGIX_tag_sample_buffer", extStart, extEnd); if (glewExperimental || GLEW_SGIX_tag_sample_buffer) CONST_CAST(GLEW_SGIX_tag_sample_buffer) = !_glewInit_GL_SGIX_tag_sample_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGIX_tag_sample_buffer */ #ifdef GL_SGIX_texture_add_env - CONST_CAST(GLEW_SGIX_texture_add_env) = glewGetExtension("GL_SGIX_texture_add_env"); + CONST_CAST(GLEW_SGIX_texture_add_env) = _glewSearchExtension("GL_SGIX_texture_add_env", extStart, extEnd); #endif /* GL_SGIX_texture_add_env */ #ifdef GL_SGIX_texture_coordinate_clamp - CONST_CAST(GLEW_SGIX_texture_coordinate_clamp) = glewGetExtension("GL_SGIX_texture_coordinate_clamp"); + CONST_CAST(GLEW_SGIX_texture_coordinate_clamp) = _glewSearchExtension("GL_SGIX_texture_coordinate_clamp", extStart, extEnd); #endif /* GL_SGIX_texture_coordinate_clamp */ #ifdef GL_SGIX_texture_lod_bias - CONST_CAST(GLEW_SGIX_texture_lod_bias) = glewGetExtension("GL_SGIX_texture_lod_bias"); + CONST_CAST(GLEW_SGIX_texture_lod_bias) = _glewSearchExtension("GL_SGIX_texture_lod_bias", extStart, extEnd); #endif /* GL_SGIX_texture_lod_bias */ #ifdef GL_SGIX_texture_multi_buffer - CONST_CAST(GLEW_SGIX_texture_multi_buffer) = glewGetExtension("GL_SGIX_texture_multi_buffer"); + CONST_CAST(GLEW_SGIX_texture_multi_buffer) = _glewSearchExtension("GL_SGIX_texture_multi_buffer", extStart, extEnd); #endif /* GL_SGIX_texture_multi_buffer */ #ifdef GL_SGIX_texture_range - CONST_CAST(GLEW_SGIX_texture_range) = glewGetExtension("GL_SGIX_texture_range"); + CONST_CAST(GLEW_SGIX_texture_range) = _glewSearchExtension("GL_SGIX_texture_range", extStart, extEnd); #endif /* GL_SGIX_texture_range */ #ifdef GL_SGIX_texture_scale_bias - CONST_CAST(GLEW_SGIX_texture_scale_bias) = glewGetExtension("GL_SGIX_texture_scale_bias"); + CONST_CAST(GLEW_SGIX_texture_scale_bias) = _glewSearchExtension("GL_SGIX_texture_scale_bias", extStart, extEnd); #endif /* GL_SGIX_texture_scale_bias */ #ifdef GL_SGIX_vertex_preclip - CONST_CAST(GLEW_SGIX_vertex_preclip) = glewGetExtension("GL_SGIX_vertex_preclip"); + CONST_CAST(GLEW_SGIX_vertex_preclip) = _glewSearchExtension("GL_SGIX_vertex_preclip", extStart, extEnd); #endif /* GL_SGIX_vertex_preclip */ #ifdef GL_SGIX_vertex_preclip_hint - CONST_CAST(GLEW_SGIX_vertex_preclip_hint) = glewGetExtension("GL_SGIX_vertex_preclip_hint"); + CONST_CAST(GLEW_SGIX_vertex_preclip_hint) = _glewSearchExtension("GL_SGIX_vertex_preclip_hint", extStart, extEnd); #endif /* GL_SGIX_vertex_preclip_hint */ #ifdef GL_SGIX_ycrcb - CONST_CAST(GLEW_SGIX_ycrcb) = glewGetExtension("GL_SGIX_ycrcb"); + CONST_CAST(GLEW_SGIX_ycrcb) = _glewSearchExtension("GL_SGIX_ycrcb", extStart, extEnd); #endif /* GL_SGIX_ycrcb */ #ifdef GL_SGI_color_matrix - CONST_CAST(GLEW_SGI_color_matrix) = glewGetExtension("GL_SGI_color_matrix"); + CONST_CAST(GLEW_SGI_color_matrix) = _glewSearchExtension("GL_SGI_color_matrix", extStart, extEnd); #endif /* GL_SGI_color_matrix */ #ifdef GL_SGI_color_table - CONST_CAST(GLEW_SGI_color_table) = glewGetExtension("GL_SGI_color_table"); + CONST_CAST(GLEW_SGI_color_table) = _glewSearchExtension("GL_SGI_color_table", extStart, extEnd); if (glewExperimental || GLEW_SGI_color_table) CONST_CAST(GLEW_SGI_color_table) = !_glewInit_GL_SGI_color_table(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SGI_color_table */ #ifdef GL_SGI_texture_color_table - CONST_CAST(GLEW_SGI_texture_color_table) = glewGetExtension("GL_SGI_texture_color_table"); + CONST_CAST(GLEW_SGI_texture_color_table) = _glewSearchExtension("GL_SGI_texture_color_table", extStart, extEnd); #endif /* GL_SGI_texture_color_table */ #ifdef GL_SUNX_constant_data - CONST_CAST(GLEW_SUNX_constant_data) = glewGetExtension("GL_SUNX_constant_data"); + CONST_CAST(GLEW_SUNX_constant_data) = _glewSearchExtension("GL_SUNX_constant_data", extStart, extEnd); if (glewExperimental || GLEW_SUNX_constant_data) CONST_CAST(GLEW_SUNX_constant_data) = !_glewInit_GL_SUNX_constant_data(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUNX_constant_data */ #ifdef GL_SUN_convolution_border_modes - CONST_CAST(GLEW_SUN_convolution_border_modes) = glewGetExtension("GL_SUN_convolution_border_modes"); + CONST_CAST(GLEW_SUN_convolution_border_modes) = _glewSearchExtension("GL_SUN_convolution_border_modes", extStart, extEnd); #endif /* GL_SUN_convolution_border_modes */ #ifdef GL_SUN_global_alpha - CONST_CAST(GLEW_SUN_global_alpha) = glewGetExtension("GL_SUN_global_alpha"); + CONST_CAST(GLEW_SUN_global_alpha) = _glewSearchExtension("GL_SUN_global_alpha", extStart, extEnd); if (glewExperimental || GLEW_SUN_global_alpha) CONST_CAST(GLEW_SUN_global_alpha) = !_glewInit_GL_SUN_global_alpha(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_global_alpha */ #ifdef GL_SUN_mesh_array - CONST_CAST(GLEW_SUN_mesh_array) = glewGetExtension("GL_SUN_mesh_array"); + CONST_CAST(GLEW_SUN_mesh_array) = _glewSearchExtension("GL_SUN_mesh_array", extStart, extEnd); #endif /* GL_SUN_mesh_array */ #ifdef GL_SUN_read_video_pixels - CONST_CAST(GLEW_SUN_read_video_pixels) = glewGetExtension("GL_SUN_read_video_pixels"); + CONST_CAST(GLEW_SUN_read_video_pixels) = _glewSearchExtension("GL_SUN_read_video_pixels", extStart, extEnd); if (glewExperimental || GLEW_SUN_read_video_pixels) CONST_CAST(GLEW_SUN_read_video_pixels) = !_glewInit_GL_SUN_read_video_pixels(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_read_video_pixels */ #ifdef GL_SUN_slice_accum - CONST_CAST(GLEW_SUN_slice_accum) = glewGetExtension("GL_SUN_slice_accum"); + CONST_CAST(GLEW_SUN_slice_accum) = _glewSearchExtension("GL_SUN_slice_accum", extStart, extEnd); #endif /* GL_SUN_slice_accum */ #ifdef GL_SUN_triangle_list - CONST_CAST(GLEW_SUN_triangle_list) = glewGetExtension("GL_SUN_triangle_list"); + CONST_CAST(GLEW_SUN_triangle_list) = _glewSearchExtension("GL_SUN_triangle_list", extStart, extEnd); if (glewExperimental || GLEW_SUN_triangle_list) CONST_CAST(GLEW_SUN_triangle_list) = !_glewInit_GL_SUN_triangle_list(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_triangle_list */ #ifdef GL_SUN_vertex - CONST_CAST(GLEW_SUN_vertex) = glewGetExtension("GL_SUN_vertex"); + CONST_CAST(GLEW_SUN_vertex) = _glewSearchExtension("GL_SUN_vertex", extStart, extEnd); if (glewExperimental || GLEW_SUN_vertex) CONST_CAST(GLEW_SUN_vertex) = !_glewInit_GL_SUN_vertex(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_SUN_vertex */ #ifdef GL_WIN_phong_shading - CONST_CAST(GLEW_WIN_phong_shading) = glewGetExtension("GL_WIN_phong_shading"); + CONST_CAST(GLEW_WIN_phong_shading) = _glewSearchExtension("GL_WIN_phong_shading", extStart, extEnd); #endif /* GL_WIN_phong_shading */ #ifdef GL_WIN_specular_fog - CONST_CAST(GLEW_WIN_specular_fog) = glewGetExtension("GL_WIN_specular_fog"); + CONST_CAST(GLEW_WIN_specular_fog) = _glewSearchExtension("GL_WIN_specular_fog", extStart, extEnd); #endif /* GL_WIN_specular_fog */ #ifdef GL_WIN_swap_hint - CONST_CAST(GLEW_WIN_swap_hint) = glewGetExtension("GL_WIN_swap_hint"); + CONST_CAST(GLEW_WIN_swap_hint) = _glewSearchExtension("GL_WIN_swap_hint", extStart, extEnd); if (glewExperimental || GLEW_WIN_swap_hint) CONST_CAST(GLEW_WIN_swap_hint) = !_glewInit_GL_WIN_swap_hint(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GL_WIN_swap_hint */ @@ -9453,7 +9590,7 @@ PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD = NULL; PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD = NULL; PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD = NULL; PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD = NULL; -//XXX-blender, added: PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD = NULL; +PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD = NULL; PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD = NULL; PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB = NULL; @@ -9541,6 +9678,15 @@ PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D = NULL; PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D = NULL; PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D = NULL; +PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV = NULL; +PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV = NULL; +PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV = NULL; +PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV = NULL; +PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV = NULL; +PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV = NULL; +PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV = NULL; +PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV = NULL; + PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV = NULL; PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV = NULL; @@ -9563,6 +9709,12 @@ PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV = NULL; PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV = NULL; PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV = NULL; +PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV = NULL; +PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV = NULL; +PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV = NULL; +PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV = NULL; +PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV = NULL; + PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV = NULL; PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV = NULL; PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV = NULL; @@ -9610,6 +9762,7 @@ GLboolean __WGLEW_I3D_genlock = GL_FALSE; GLboolean __WGLEW_I3D_image_buffer = GL_FALSE; GLboolean __WGLEW_I3D_swap_frame_lock = GL_FALSE; GLboolean __WGLEW_I3D_swap_frame_usage = GL_FALSE; +GLboolean __WGLEW_NV_DX_interop = GL_FALSE; GLboolean __WGLEW_NV_copy_image = GL_FALSE; GLboolean __WGLEW_NV_float_buffer = GL_FALSE; GLboolean __WGLEW_NV_gpu_affinity = GL_FALSE; @@ -9619,6 +9772,7 @@ GLboolean __WGLEW_NV_render_depth_texture = GL_FALSE; GLboolean __WGLEW_NV_render_texture_rectangle = GL_FALSE; GLboolean __WGLEW_NV_swap_group = GL_FALSE; GLboolean __WGLEW_NV_vertex_array_range = GL_FALSE; +GLboolean __WGLEW_NV_video_capture = GL_FALSE; GLboolean __WGLEW_NV_video_output = GL_FALSE; GLboolean __WGLEW_OML_sync_control = GL_FALSE; @@ -9654,7 +9808,7 @@ static GLboolean _glewInit_WGL_AMD_gpu_association (WGLEW_CONTEXT_ARG_DEF_INIT) r = ((wglGetContextGPUIDAMD = (PFNWGLGETCONTEXTGPUIDAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetContextGPUIDAMD")) == NULL) || r; r = ((wglGetCurrentAssociatedContextAMD = (PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentAssociatedContextAMD")) == NULL) || r; r = ((wglGetGPUIDsAMD = (PFNWGLGETGPUIDSAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUIDsAMD")) == NULL) || r; -//XXX-blender, added: r = ((wglGetGPUInfoAMD = (PFNWGLGETGPUINFOAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUInfoAMD")) == NULL) || r; + r = ((wglGetGPUInfoAMD = (PFNWGLGETGPUINFOAMDPROC)glewGetProcAddress((const GLubyte*)"wglGetGPUInfoAMD")) == NULL) || r; r = ((wglMakeAssociatedContextCurrentAMD = (PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)glewGetProcAddress((const GLubyte*)"wglMakeAssociatedContextCurrentAMD")) == NULL) || r; return r; @@ -10004,6 +10158,26 @@ static GLboolean _glewInit_WGL_I3D_swap_frame_usage (WGLEW_CONTEXT_ARG_DEF_INIT) #endif /* WGL_I3D_swap_frame_usage */ +#ifdef WGL_NV_DX_interop + +static GLboolean _glewInit_WGL_NV_DX_interop (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglDXCloseDeviceNV = (PFNWGLDXCLOSEDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXCloseDeviceNV")) == NULL) || r; + r = ((wglDXLockObjectsNV = (PFNWGLDXLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXLockObjectsNV")) == NULL) || r; + r = ((wglDXObjectAccessNV = (PFNWGLDXOBJECTACCESSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXObjectAccessNV")) == NULL) || r; + r = ((wglDXOpenDeviceNV = (PFNWGLDXOPENDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglDXOpenDeviceNV")) == NULL) || r; + r = ((wglDXRegisterObjectNV = (PFNWGLDXREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXRegisterObjectNV")) == NULL) || r; + r = ((wglDXSetResourceShareHandleNV = (PFNWGLDXSETRESOURCESHAREHANDLENVPROC)glewGetProcAddress((const GLubyte*)"wglDXSetResourceShareHandleNV")) == NULL) || r; + r = ((wglDXUnlockObjectsNV = (PFNWGLDXUNLOCKOBJECTSNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnlockObjectsNV")) == NULL) || r; + r = ((wglDXUnregisterObjectNV = (PFNWGLDXUNREGISTEROBJECTNVPROC)glewGetProcAddress((const GLubyte*)"wglDXUnregisterObjectNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_DX_interop */ + #ifdef WGL_NV_copy_image static GLboolean _glewInit_WGL_NV_copy_image (WGLEW_CONTEXT_ARG_DEF_INIT) @@ -10097,6 +10271,23 @@ static GLboolean _glewInit_WGL_NV_vertex_array_range (WGLEW_CONTEXT_ARG_DEF_INIT #endif /* WGL_NV_vertex_array_range */ +#ifdef WGL_NV_video_capture + +static GLboolean _glewInit_WGL_NV_video_capture (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindVideoCaptureDeviceNV = (PFNWGLBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglBindVideoCaptureDeviceNV")) == NULL) || r; + r = ((wglEnumerateVideoCaptureDevicesNV = (PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"wglEnumerateVideoCaptureDevicesNV")) == NULL) || r; + r = ((wglLockVideoCaptureDeviceNV = (PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglLockVideoCaptureDeviceNV")) == NULL) || r; + r = ((wglQueryVideoCaptureDeviceNV = (PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglQueryVideoCaptureDeviceNV")) == NULL) || r; + r = ((wglReleaseVideoCaptureDeviceNV = (PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"wglReleaseVideoCaptureDeviceNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_video_capture */ + #ifdef WGL_NV_video_output static GLboolean _glewInit_WGL_NV_video_output (WGLEW_CONTEXT_ARG_DEF_INIT) @@ -10140,196 +10331,209 @@ static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; GLboolean wglewGetExtension (const char* name) { - GLubyte* p; - GLubyte* end; - GLuint len = _glewStrLen((const GLubyte*)name); + const GLubyte* start; + const GLubyte* end; if (_wglewGetExtensionsStringARB == NULL) if (_wglewGetExtensionsStringEXT == NULL) return GL_FALSE; else - p = (GLubyte*)_wglewGetExtensionsStringEXT(); + start = (const GLubyte*)_wglewGetExtensionsStringEXT(); else - p = (GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); - if (0 == p) return GL_FALSE; - end = p + _glewStrLen(p); - while (p < end) - { - GLuint n = _glewStrCLen(p, ' '); - if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; - p += n+1; - } - return GL_FALSE; + start = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); + if (start == 0) + return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); } GLenum wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST) { GLboolean crippled; + const GLubyte* extStart; + const GLubyte* extEnd; /* find wgl extension string query functions */ _wglewGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB"); _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT"); + /* query wgl extension string */ + if (_wglewGetExtensionsStringARB == NULL) + if (_wglewGetExtensionsStringEXT == NULL) + extStart = (const GLubyte*)""; + else + extStart = (const GLubyte*)_wglewGetExtensionsStringEXT(); + else + extStart = (const GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); + extEnd = extStart + _glewStrLen(extStart); /* initialize extensions */ crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL; #ifdef WGL_3DFX_multisample - CONST_CAST(WGLEW_3DFX_multisample) = wglewGetExtension("WGL_3DFX_multisample"); + CONST_CAST(WGLEW_3DFX_multisample) = _glewSearchExtension("WGL_3DFX_multisample", extStart, extEnd); #endif /* WGL_3DFX_multisample */ #ifdef WGL_3DL_stereo_control - CONST_CAST(WGLEW_3DL_stereo_control) = wglewGetExtension("WGL_3DL_stereo_control"); + CONST_CAST(WGLEW_3DL_stereo_control) = _glewSearchExtension("WGL_3DL_stereo_control", extStart, extEnd); if (glewExperimental || WGLEW_3DL_stereo_control|| crippled) CONST_CAST(WGLEW_3DL_stereo_control)= !_glewInit_WGL_3DL_stereo_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_3DL_stereo_control */ #ifdef WGL_AMD_gpu_association - CONST_CAST(WGLEW_AMD_gpu_association) = wglewGetExtension("WGL_AMD_gpu_association"); + CONST_CAST(WGLEW_AMD_gpu_association) = _glewSearchExtension("WGL_AMD_gpu_association", extStart, extEnd); if (glewExperimental || WGLEW_AMD_gpu_association|| crippled) CONST_CAST(WGLEW_AMD_gpu_association)= !_glewInit_WGL_AMD_gpu_association(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_AMD_gpu_association */ #ifdef WGL_ARB_buffer_region - CONST_CAST(WGLEW_ARB_buffer_region) = wglewGetExtension("WGL_ARB_buffer_region"); + CONST_CAST(WGLEW_ARB_buffer_region) = _glewSearchExtension("WGL_ARB_buffer_region", extStart, extEnd); if (glewExperimental || WGLEW_ARB_buffer_region|| crippled) CONST_CAST(WGLEW_ARB_buffer_region)= !_glewInit_WGL_ARB_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_buffer_region */ #ifdef WGL_ARB_create_context - CONST_CAST(WGLEW_ARB_create_context) = wglewGetExtension("WGL_ARB_create_context"); + CONST_CAST(WGLEW_ARB_create_context) = _glewSearchExtension("WGL_ARB_create_context", extStart, extEnd); if (glewExperimental || WGLEW_ARB_create_context|| crippled) CONST_CAST(WGLEW_ARB_create_context)= !_glewInit_WGL_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_create_context */ #ifdef WGL_ARB_create_context_profile - CONST_CAST(WGLEW_ARB_create_context_profile) = wglewGetExtension("WGL_ARB_create_context_profile"); + CONST_CAST(WGLEW_ARB_create_context_profile) = _glewSearchExtension("WGL_ARB_create_context_profile", extStart, extEnd); #endif /* WGL_ARB_create_context_profile */ #ifdef WGL_ARB_create_context_robustness - CONST_CAST(WGLEW_ARB_create_context_robustness) = wglewGetExtension("WGL_ARB_create_context_robustness"); + CONST_CAST(WGLEW_ARB_create_context_robustness) = _glewSearchExtension("WGL_ARB_create_context_robustness", extStart, extEnd); #endif /* WGL_ARB_create_context_robustness */ #ifdef WGL_ARB_extensions_string - CONST_CAST(WGLEW_ARB_extensions_string) = wglewGetExtension("WGL_ARB_extensions_string"); + CONST_CAST(WGLEW_ARB_extensions_string) = _glewSearchExtension("WGL_ARB_extensions_string", extStart, extEnd); if (glewExperimental || WGLEW_ARB_extensions_string|| crippled) CONST_CAST(WGLEW_ARB_extensions_string)= !_glewInit_WGL_ARB_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_extensions_string */ #ifdef WGL_ARB_framebuffer_sRGB - CONST_CAST(WGLEW_ARB_framebuffer_sRGB) = wglewGetExtension("WGL_ARB_framebuffer_sRGB"); + CONST_CAST(WGLEW_ARB_framebuffer_sRGB) = _glewSearchExtension("WGL_ARB_framebuffer_sRGB", extStart, extEnd); #endif /* WGL_ARB_framebuffer_sRGB */ #ifdef WGL_ARB_make_current_read - CONST_CAST(WGLEW_ARB_make_current_read) = wglewGetExtension("WGL_ARB_make_current_read"); + CONST_CAST(WGLEW_ARB_make_current_read) = _glewSearchExtension("WGL_ARB_make_current_read", extStart, extEnd); if (glewExperimental || WGLEW_ARB_make_current_read|| crippled) CONST_CAST(WGLEW_ARB_make_current_read)= !_glewInit_WGL_ARB_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_make_current_read */ #ifdef WGL_ARB_multisample - CONST_CAST(WGLEW_ARB_multisample) = wglewGetExtension("WGL_ARB_multisample"); + CONST_CAST(WGLEW_ARB_multisample) = _glewSearchExtension("WGL_ARB_multisample", extStart, extEnd); #endif /* WGL_ARB_multisample */ #ifdef WGL_ARB_pbuffer - CONST_CAST(WGLEW_ARB_pbuffer) = wglewGetExtension("WGL_ARB_pbuffer"); + CONST_CAST(WGLEW_ARB_pbuffer) = _glewSearchExtension("WGL_ARB_pbuffer", extStart, extEnd); if (glewExperimental || WGLEW_ARB_pbuffer|| crippled) CONST_CAST(WGLEW_ARB_pbuffer)= !_glewInit_WGL_ARB_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_pbuffer */ #ifdef WGL_ARB_pixel_format - CONST_CAST(WGLEW_ARB_pixel_format) = wglewGetExtension("WGL_ARB_pixel_format"); + CONST_CAST(WGLEW_ARB_pixel_format) = _glewSearchExtension("WGL_ARB_pixel_format", extStart, extEnd); if (glewExperimental || WGLEW_ARB_pixel_format|| crippled) CONST_CAST(WGLEW_ARB_pixel_format)= !_glewInit_WGL_ARB_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_pixel_format */ #ifdef WGL_ARB_pixel_format_float - CONST_CAST(WGLEW_ARB_pixel_format_float) = wglewGetExtension("WGL_ARB_pixel_format_float"); + CONST_CAST(WGLEW_ARB_pixel_format_float) = _glewSearchExtension("WGL_ARB_pixel_format_float", extStart, extEnd); #endif /* WGL_ARB_pixel_format_float */ #ifdef WGL_ARB_render_texture - CONST_CAST(WGLEW_ARB_render_texture) = wglewGetExtension("WGL_ARB_render_texture"); + CONST_CAST(WGLEW_ARB_render_texture) = _glewSearchExtension("WGL_ARB_render_texture", extStart, extEnd); if (glewExperimental || WGLEW_ARB_render_texture|| crippled) CONST_CAST(WGLEW_ARB_render_texture)= !_glewInit_WGL_ARB_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_ARB_render_texture */ #ifdef WGL_ATI_pixel_format_float - CONST_CAST(WGLEW_ATI_pixel_format_float) = wglewGetExtension("WGL_ATI_pixel_format_float"); + CONST_CAST(WGLEW_ATI_pixel_format_float) = _glewSearchExtension("WGL_ATI_pixel_format_float", extStart, extEnd); #endif /* WGL_ATI_pixel_format_float */ #ifdef WGL_ATI_render_texture_rectangle - CONST_CAST(WGLEW_ATI_render_texture_rectangle) = wglewGetExtension("WGL_ATI_render_texture_rectangle"); + CONST_CAST(WGLEW_ATI_render_texture_rectangle) = _glewSearchExtension("WGL_ATI_render_texture_rectangle", extStart, extEnd); #endif /* WGL_ATI_render_texture_rectangle */ #ifdef WGL_EXT_create_context_es2_profile - CONST_CAST(WGLEW_EXT_create_context_es2_profile) = wglewGetExtension("WGL_EXT_create_context_es2_profile"); + CONST_CAST(WGLEW_EXT_create_context_es2_profile) = _glewSearchExtension("WGL_EXT_create_context_es2_profile", extStart, extEnd); #endif /* WGL_EXT_create_context_es2_profile */ #ifdef WGL_EXT_depth_float - CONST_CAST(WGLEW_EXT_depth_float) = wglewGetExtension("WGL_EXT_depth_float"); + CONST_CAST(WGLEW_EXT_depth_float) = _glewSearchExtension("WGL_EXT_depth_float", extStart, extEnd); #endif /* WGL_EXT_depth_float */ #ifdef WGL_EXT_display_color_table - CONST_CAST(WGLEW_EXT_display_color_table) = wglewGetExtension("WGL_EXT_display_color_table"); + CONST_CAST(WGLEW_EXT_display_color_table) = _glewSearchExtension("WGL_EXT_display_color_table", extStart, extEnd); if (glewExperimental || WGLEW_EXT_display_color_table|| crippled) CONST_CAST(WGLEW_EXT_display_color_table)= !_glewInit_WGL_EXT_display_color_table(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_display_color_table */ #ifdef WGL_EXT_extensions_string - CONST_CAST(WGLEW_EXT_extensions_string) = wglewGetExtension("WGL_EXT_extensions_string"); + CONST_CAST(WGLEW_EXT_extensions_string) = _glewSearchExtension("WGL_EXT_extensions_string", extStart, extEnd); if (glewExperimental || WGLEW_EXT_extensions_string|| crippled) CONST_CAST(WGLEW_EXT_extensions_string)= !_glewInit_WGL_EXT_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_extensions_string */ #ifdef WGL_EXT_framebuffer_sRGB - CONST_CAST(WGLEW_EXT_framebuffer_sRGB) = wglewGetExtension("WGL_EXT_framebuffer_sRGB"); + CONST_CAST(WGLEW_EXT_framebuffer_sRGB) = _glewSearchExtension("WGL_EXT_framebuffer_sRGB", extStart, extEnd); #endif /* WGL_EXT_framebuffer_sRGB */ #ifdef WGL_EXT_make_current_read - CONST_CAST(WGLEW_EXT_make_current_read) = wglewGetExtension("WGL_EXT_make_current_read"); + CONST_CAST(WGLEW_EXT_make_current_read) = _glewSearchExtension("WGL_EXT_make_current_read", extStart, extEnd); if (glewExperimental || WGLEW_EXT_make_current_read|| crippled) CONST_CAST(WGLEW_EXT_make_current_read)= !_glewInit_WGL_EXT_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_make_current_read */ #ifdef WGL_EXT_multisample - CONST_CAST(WGLEW_EXT_multisample) = wglewGetExtension("WGL_EXT_multisample"); + CONST_CAST(WGLEW_EXT_multisample) = _glewSearchExtension("WGL_EXT_multisample", extStart, extEnd); #endif /* WGL_EXT_multisample */ #ifdef WGL_EXT_pbuffer - CONST_CAST(WGLEW_EXT_pbuffer) = wglewGetExtension("WGL_EXT_pbuffer"); + CONST_CAST(WGLEW_EXT_pbuffer) = _glewSearchExtension("WGL_EXT_pbuffer", extStart, extEnd); if (glewExperimental || WGLEW_EXT_pbuffer|| crippled) CONST_CAST(WGLEW_EXT_pbuffer)= !_glewInit_WGL_EXT_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_pbuffer */ #ifdef WGL_EXT_pixel_format - CONST_CAST(WGLEW_EXT_pixel_format) = wglewGetExtension("WGL_EXT_pixel_format"); + CONST_CAST(WGLEW_EXT_pixel_format) = _glewSearchExtension("WGL_EXT_pixel_format", extStart, extEnd); if (glewExperimental || WGLEW_EXT_pixel_format|| crippled) CONST_CAST(WGLEW_EXT_pixel_format)= !_glewInit_WGL_EXT_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_pixel_format */ #ifdef WGL_EXT_pixel_format_packed_float - CONST_CAST(WGLEW_EXT_pixel_format_packed_float) = wglewGetExtension("WGL_EXT_pixel_format_packed_float"); + CONST_CAST(WGLEW_EXT_pixel_format_packed_float) = _glewSearchExtension("WGL_EXT_pixel_format_packed_float", extStart, extEnd); #endif /* WGL_EXT_pixel_format_packed_float */ #ifdef WGL_EXT_swap_control - CONST_CAST(WGLEW_EXT_swap_control) = wglewGetExtension("WGL_EXT_swap_control"); + CONST_CAST(WGLEW_EXT_swap_control) = _glewSearchExtension("WGL_EXT_swap_control", extStart, extEnd); if (glewExperimental || WGLEW_EXT_swap_control|| crippled) CONST_CAST(WGLEW_EXT_swap_control)= !_glewInit_WGL_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_EXT_swap_control */ #ifdef WGL_I3D_digital_video_control - CONST_CAST(WGLEW_I3D_digital_video_control) = wglewGetExtension("WGL_I3D_digital_video_control"); + CONST_CAST(WGLEW_I3D_digital_video_control) = _glewSearchExtension("WGL_I3D_digital_video_control", extStart, extEnd); if (glewExperimental || WGLEW_I3D_digital_video_control|| crippled) CONST_CAST(WGLEW_I3D_digital_video_control)= !_glewInit_WGL_I3D_digital_video_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_digital_video_control */ #ifdef WGL_I3D_gamma - CONST_CAST(WGLEW_I3D_gamma) = wglewGetExtension("WGL_I3D_gamma"); + CONST_CAST(WGLEW_I3D_gamma) = _glewSearchExtension("WGL_I3D_gamma", extStart, extEnd); if (glewExperimental || WGLEW_I3D_gamma|| crippled) CONST_CAST(WGLEW_I3D_gamma)= !_glewInit_WGL_I3D_gamma(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_gamma */ #ifdef WGL_I3D_genlock - CONST_CAST(WGLEW_I3D_genlock) = wglewGetExtension("WGL_I3D_genlock"); + CONST_CAST(WGLEW_I3D_genlock) = _glewSearchExtension("WGL_I3D_genlock", extStart, extEnd); if (glewExperimental || WGLEW_I3D_genlock|| crippled) CONST_CAST(WGLEW_I3D_genlock)= !_glewInit_WGL_I3D_genlock(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_genlock */ #ifdef WGL_I3D_image_buffer - CONST_CAST(WGLEW_I3D_image_buffer) = wglewGetExtension("WGL_I3D_image_buffer"); + CONST_CAST(WGLEW_I3D_image_buffer) = _glewSearchExtension("WGL_I3D_image_buffer", extStart, extEnd); if (glewExperimental || WGLEW_I3D_image_buffer|| crippled) CONST_CAST(WGLEW_I3D_image_buffer)= !_glewInit_WGL_I3D_image_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_image_buffer */ #ifdef WGL_I3D_swap_frame_lock - CONST_CAST(WGLEW_I3D_swap_frame_lock) = wglewGetExtension("WGL_I3D_swap_frame_lock"); + CONST_CAST(WGLEW_I3D_swap_frame_lock) = _glewSearchExtension("WGL_I3D_swap_frame_lock", extStart, extEnd); if (glewExperimental || WGLEW_I3D_swap_frame_lock|| crippled) CONST_CAST(WGLEW_I3D_swap_frame_lock)= !_glewInit_WGL_I3D_swap_frame_lock(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_swap_frame_lock */ #ifdef WGL_I3D_swap_frame_usage - CONST_CAST(WGLEW_I3D_swap_frame_usage) = wglewGetExtension("WGL_I3D_swap_frame_usage"); + CONST_CAST(WGLEW_I3D_swap_frame_usage) = _glewSearchExtension("WGL_I3D_swap_frame_usage", extStart, extEnd); if (glewExperimental || WGLEW_I3D_swap_frame_usage|| crippled) CONST_CAST(WGLEW_I3D_swap_frame_usage)= !_glewInit_WGL_I3D_swap_frame_usage(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_I3D_swap_frame_usage */ +#ifdef WGL_NV_DX_interop + CONST_CAST(WGLEW_NV_DX_interop) = _glewSearchExtension("WGL_NV_DX_interop", extStart, extEnd); + if (glewExperimental || WGLEW_NV_DX_interop|| crippled) CONST_CAST(WGLEW_NV_DX_interop)= !_glewInit_WGL_NV_DX_interop(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_DX_interop */ #ifdef WGL_NV_copy_image - CONST_CAST(WGLEW_NV_copy_image) = wglewGetExtension("WGL_NV_copy_image"); + CONST_CAST(WGLEW_NV_copy_image) = _glewSearchExtension("WGL_NV_copy_image", extStart, extEnd); if (glewExperimental || WGLEW_NV_copy_image|| crippled) CONST_CAST(WGLEW_NV_copy_image)= !_glewInit_WGL_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_copy_image */ #ifdef WGL_NV_float_buffer - CONST_CAST(WGLEW_NV_float_buffer) = wglewGetExtension("WGL_NV_float_buffer"); + CONST_CAST(WGLEW_NV_float_buffer) = _glewSearchExtension("WGL_NV_float_buffer", extStart, extEnd); #endif /* WGL_NV_float_buffer */ #ifdef WGL_NV_gpu_affinity - CONST_CAST(WGLEW_NV_gpu_affinity) = wglewGetExtension("WGL_NV_gpu_affinity"); + CONST_CAST(WGLEW_NV_gpu_affinity) = _glewSearchExtension("WGL_NV_gpu_affinity", extStart, extEnd); if (glewExperimental || WGLEW_NV_gpu_affinity|| crippled) CONST_CAST(WGLEW_NV_gpu_affinity)= !_glewInit_WGL_NV_gpu_affinity(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_gpu_affinity */ #ifdef WGL_NV_multisample_coverage - CONST_CAST(WGLEW_NV_multisample_coverage) = wglewGetExtension("WGL_NV_multisample_coverage"); + CONST_CAST(WGLEW_NV_multisample_coverage) = _glewSearchExtension("WGL_NV_multisample_coverage", extStart, extEnd); #endif /* WGL_NV_multisample_coverage */ #ifdef WGL_NV_present_video - CONST_CAST(WGLEW_NV_present_video) = wglewGetExtension("WGL_NV_present_video"); + CONST_CAST(WGLEW_NV_present_video) = _glewSearchExtension("WGL_NV_present_video", extStart, extEnd); if (glewExperimental || WGLEW_NV_present_video|| crippled) CONST_CAST(WGLEW_NV_present_video)= !_glewInit_WGL_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_present_video */ #ifdef WGL_NV_render_depth_texture - CONST_CAST(WGLEW_NV_render_depth_texture) = wglewGetExtension("WGL_NV_render_depth_texture"); + CONST_CAST(WGLEW_NV_render_depth_texture) = _glewSearchExtension("WGL_NV_render_depth_texture", extStart, extEnd); #endif /* WGL_NV_render_depth_texture */ #ifdef WGL_NV_render_texture_rectangle - CONST_CAST(WGLEW_NV_render_texture_rectangle) = wglewGetExtension("WGL_NV_render_texture_rectangle"); + CONST_CAST(WGLEW_NV_render_texture_rectangle) = _glewSearchExtension("WGL_NV_render_texture_rectangle", extStart, extEnd); #endif /* WGL_NV_render_texture_rectangle */ #ifdef WGL_NV_swap_group - CONST_CAST(WGLEW_NV_swap_group) = wglewGetExtension("WGL_NV_swap_group"); + CONST_CAST(WGLEW_NV_swap_group) = _glewSearchExtension("WGL_NV_swap_group", extStart, extEnd); if (glewExperimental || WGLEW_NV_swap_group|| crippled) CONST_CAST(WGLEW_NV_swap_group)= !_glewInit_WGL_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_swap_group */ #ifdef WGL_NV_vertex_array_range - CONST_CAST(WGLEW_NV_vertex_array_range) = wglewGetExtension("WGL_NV_vertex_array_range"); + CONST_CAST(WGLEW_NV_vertex_array_range) = _glewSearchExtension("WGL_NV_vertex_array_range", extStart, extEnd); if (glewExperimental || WGLEW_NV_vertex_array_range|| crippled) CONST_CAST(WGLEW_NV_vertex_array_range)= !_glewInit_WGL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_vertex_array_range */ +#ifdef WGL_NV_video_capture + CONST_CAST(WGLEW_NV_video_capture) = _glewSearchExtension("WGL_NV_video_capture", extStart, extEnd); + if (glewExperimental || WGLEW_NV_video_capture|| crippled) CONST_CAST(WGLEW_NV_video_capture)= !_glewInit_WGL_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_video_capture */ #ifdef WGL_NV_video_output - CONST_CAST(WGLEW_NV_video_output) = wglewGetExtension("WGL_NV_video_output"); + CONST_CAST(WGLEW_NV_video_output) = _glewSearchExtension("WGL_NV_video_output", extStart, extEnd); if (glewExperimental || WGLEW_NV_video_output|| crippled) CONST_CAST(WGLEW_NV_video_output)= !_glewInit_WGL_NV_video_output(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_NV_video_output */ #ifdef WGL_OML_sync_control - CONST_CAST(WGLEW_OML_sync_control) = wglewGetExtension("WGL_OML_sync_control"); + CONST_CAST(WGLEW_OML_sync_control) = _glewSearchExtension("WGL_OML_sync_control", extStart, extEnd); if (glewExperimental || WGLEW_OML_sync_control|| crippled) CONST_CAST(WGLEW_OML_sync_control)= !_glewInit_WGL_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* WGL_OML_sync_control */ @@ -10399,6 +10603,12 @@ PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV = NULL; PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV = NULL; PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV = NULL; +PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV = NULL; +PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV = NULL; +PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV = NULL; +PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV = NULL; +PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV = NULL; + PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV = NULL; PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV = NULL; PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV = NULL; @@ -10406,13 +10616,11 @@ PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV = NULL; PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV = NULL; PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV = NULL; -#ifdef GLX_OML_sync_control PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML = NULL; PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML = NULL; PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML = NULL; PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML = NULL; PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML = NULL; -#endif PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX = NULL; PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX = NULL; @@ -10502,11 +10710,10 @@ GLboolean __GLXEW_NV_multisample_coverage = GL_FALSE; GLboolean __GLXEW_NV_present_video = GL_FALSE; GLboolean __GLXEW_NV_swap_group = GL_FALSE; GLboolean __GLXEW_NV_vertex_array_range = GL_FALSE; +GLboolean __GLXEW_NV_video_capture = GL_FALSE; GLboolean __GLXEW_NV_video_output = GL_FALSE; GLboolean __GLXEW_OML_swap_method = GL_FALSE; -#ifdef GLX_OML_sync_control GLboolean __GLXEW_OML_sync_control = GL_FALSE; -#endif GLboolean __GLXEW_SGIS_blended_overlay = GL_FALSE; GLboolean __GLXEW_SGIS_color_range = GL_FALSE; GLboolean __GLXEW_SGIS_multisample = GL_FALSE; @@ -10844,6 +11051,23 @@ static GLboolean _glewInit_GLX_NV_vertex_array_range (GLXEW_CONTEXT_ARG_DEF_INIT #endif /* GLX_NV_vertex_array_range */ +#ifdef GLX_NV_video_capture + +static GLboolean _glewInit_GLX_NV_video_capture (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindVideoCaptureDeviceNV = (PFNGLXBINDVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXBindVideoCaptureDeviceNV")) == NULL) || r; + r = ((glXEnumerateVideoCaptureDevicesNV = (PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC)glewGetProcAddress((const GLubyte*)"glXEnumerateVideoCaptureDevicesNV")) == NULL) || r; + r = ((glXLockVideoCaptureDeviceNV = (PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXLockVideoCaptureDeviceNV")) == NULL) || r; + r = ((glXQueryVideoCaptureDeviceNV = (PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXQueryVideoCaptureDeviceNV")) == NULL) || r; + r = ((glXReleaseVideoCaptureDeviceNV = (PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC)glewGetProcAddress((const GLubyte*)"glXReleaseVideoCaptureDeviceNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_video_capture */ + #ifdef GLX_NV_video_output static GLboolean _glewInit_GLX_NV_video_output (GLXEW_CONTEXT_ARG_DEF_INIT) @@ -10866,8 +11090,7 @@ static GLboolean _glewInit_GLX_NV_video_output (GLXEW_CONTEXT_ARG_DEF_INIT) #endif /* GLX_OML_swap_method */ -#if defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -#include +#ifdef GLX_OML_sync_control static GLboolean _glewInit_GLX_OML_sync_control (GLXEW_CONTEXT_ARG_DEF_INIT) { @@ -11088,27 +11311,21 @@ static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) GLboolean glxewGetExtension (const char* name) { - GLubyte* p; - GLubyte* end; - GLuint len; + const GLubyte* start; + const GLubyte* end; if (glXGetCurrentDisplay == NULL) return GL_FALSE; - len = _glewStrLen((const GLubyte*)name); - p = (GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); - if (0 == p) return GL_FALSE; - end = p + _glewStrLen(p); - while (p < end) - { - GLuint n = _glewStrCLen(p, ' '); - if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; - p += n+1; - } - return GL_FALSE; + start = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); + if (0 == start) return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); } GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST) { int major, minor; + const GLubyte* extStart; + const GLubyte* extEnd; /* initialize core GLX 1.2 */ if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY; /* initialize flags */ @@ -11135,196 +11352,206 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST) break; } } + /* query GLX extension string */ + extStart = 0; + if (glXGetCurrentDisplay != NULL) + extStart = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte *)""; + extEnd = extStart + _glewStrLen(extStart); /* initialize extensions */ #ifdef GLX_VERSION_1_3 if (glewExperimental || GLXEW_VERSION_1_3) CONST_CAST(GLXEW_VERSION_1_3) = !_glewInit_GLX_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_VERSION_1_3 */ #ifdef GLX_3DFX_multisample - CONST_CAST(GLXEW_3DFX_multisample) = glxewGetExtension("GLX_3DFX_multisample"); + CONST_CAST(GLXEW_3DFX_multisample) = _glewSearchExtension("GLX_3DFX_multisample", extStart, extEnd); #endif /* GLX_3DFX_multisample */ #ifdef GLX_AMD_gpu_association - CONST_CAST(GLXEW_AMD_gpu_association) = glxewGetExtension("GLX_AMD_gpu_association"); + CONST_CAST(GLXEW_AMD_gpu_association) = _glewSearchExtension("GLX_AMD_gpu_association", extStart, extEnd); #endif /* GLX_AMD_gpu_association */ #ifdef GLX_ARB_create_context - CONST_CAST(GLXEW_ARB_create_context) = glxewGetExtension("GLX_ARB_create_context"); + CONST_CAST(GLXEW_ARB_create_context) = _glewSearchExtension("GLX_ARB_create_context", extStart, extEnd); if (glewExperimental || GLXEW_ARB_create_context) CONST_CAST(GLXEW_ARB_create_context) = !_glewInit_GLX_ARB_create_context(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_ARB_create_context */ #ifdef GLX_ARB_create_context_profile - CONST_CAST(GLXEW_ARB_create_context_profile) = glxewGetExtension("GLX_ARB_create_context_profile"); + CONST_CAST(GLXEW_ARB_create_context_profile) = _glewSearchExtension("GLX_ARB_create_context_profile", extStart, extEnd); #endif /* GLX_ARB_create_context_profile */ #ifdef GLX_ARB_create_context_robustness - CONST_CAST(GLXEW_ARB_create_context_robustness) = glxewGetExtension("GLX_ARB_create_context_robustness"); + CONST_CAST(GLXEW_ARB_create_context_robustness) = _glewSearchExtension("GLX_ARB_create_context_robustness", extStart, extEnd); #endif /* GLX_ARB_create_context_robustness */ #ifdef GLX_ARB_fbconfig_float - CONST_CAST(GLXEW_ARB_fbconfig_float) = glxewGetExtension("GLX_ARB_fbconfig_float"); + CONST_CAST(GLXEW_ARB_fbconfig_float) = _glewSearchExtension("GLX_ARB_fbconfig_float", extStart, extEnd); #endif /* GLX_ARB_fbconfig_float */ #ifdef GLX_ARB_framebuffer_sRGB - CONST_CAST(GLXEW_ARB_framebuffer_sRGB) = glxewGetExtension("GLX_ARB_framebuffer_sRGB"); + CONST_CAST(GLXEW_ARB_framebuffer_sRGB) = _glewSearchExtension("GLX_ARB_framebuffer_sRGB", extStart, extEnd); #endif /* GLX_ARB_framebuffer_sRGB */ #ifdef GLX_ARB_get_proc_address - CONST_CAST(GLXEW_ARB_get_proc_address) = glxewGetExtension("GLX_ARB_get_proc_address"); + CONST_CAST(GLXEW_ARB_get_proc_address) = _glewSearchExtension("GLX_ARB_get_proc_address", extStart, extEnd); #endif /* GLX_ARB_get_proc_address */ #ifdef GLX_ARB_multisample - CONST_CAST(GLXEW_ARB_multisample) = glxewGetExtension("GLX_ARB_multisample"); + CONST_CAST(GLXEW_ARB_multisample) = _glewSearchExtension("GLX_ARB_multisample", extStart, extEnd); #endif /* GLX_ARB_multisample */ #ifdef GLX_ARB_vertex_buffer_object - CONST_CAST(GLXEW_ARB_vertex_buffer_object) = glxewGetExtension("GLX_ARB_vertex_buffer_object"); + CONST_CAST(GLXEW_ARB_vertex_buffer_object) = _glewSearchExtension("GLX_ARB_vertex_buffer_object", extStart, extEnd); #endif /* GLX_ARB_vertex_buffer_object */ #ifdef GLX_ATI_pixel_format_float - CONST_CAST(GLXEW_ATI_pixel_format_float) = glxewGetExtension("GLX_ATI_pixel_format_float"); + CONST_CAST(GLXEW_ATI_pixel_format_float) = _glewSearchExtension("GLX_ATI_pixel_format_float", extStart, extEnd); #endif /* GLX_ATI_pixel_format_float */ #ifdef GLX_ATI_render_texture - CONST_CAST(GLXEW_ATI_render_texture) = glxewGetExtension("GLX_ATI_render_texture"); + CONST_CAST(GLXEW_ATI_render_texture) = _glewSearchExtension("GLX_ATI_render_texture", extStart, extEnd); if (glewExperimental || GLXEW_ATI_render_texture) CONST_CAST(GLXEW_ATI_render_texture) = !_glewInit_GLX_ATI_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_ATI_render_texture */ #ifdef GLX_EXT_create_context_es2_profile - CONST_CAST(GLXEW_EXT_create_context_es2_profile) = glxewGetExtension("GLX_EXT_create_context_es2_profile"); + CONST_CAST(GLXEW_EXT_create_context_es2_profile) = _glewSearchExtension("GLX_EXT_create_context_es2_profile", extStart, extEnd); #endif /* GLX_EXT_create_context_es2_profile */ #ifdef GLX_EXT_fbconfig_packed_float - CONST_CAST(GLXEW_EXT_fbconfig_packed_float) = glxewGetExtension("GLX_EXT_fbconfig_packed_float"); + CONST_CAST(GLXEW_EXT_fbconfig_packed_float) = _glewSearchExtension("GLX_EXT_fbconfig_packed_float", extStart, extEnd); #endif /* GLX_EXT_fbconfig_packed_float */ #ifdef GLX_EXT_framebuffer_sRGB - CONST_CAST(GLXEW_EXT_framebuffer_sRGB) = glxewGetExtension("GLX_EXT_framebuffer_sRGB"); + CONST_CAST(GLXEW_EXT_framebuffer_sRGB) = _glewSearchExtension("GLX_EXT_framebuffer_sRGB", extStart, extEnd); #endif /* GLX_EXT_framebuffer_sRGB */ #ifdef GLX_EXT_import_context - CONST_CAST(GLXEW_EXT_import_context) = glxewGetExtension("GLX_EXT_import_context"); + CONST_CAST(GLXEW_EXT_import_context) = _glewSearchExtension("GLX_EXT_import_context", extStart, extEnd); if (glewExperimental || GLXEW_EXT_import_context) CONST_CAST(GLXEW_EXT_import_context) = !_glewInit_GLX_EXT_import_context(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_EXT_import_context */ #ifdef GLX_EXT_scene_marker - CONST_CAST(GLXEW_EXT_scene_marker) = glxewGetExtension("GLX_EXT_scene_marker"); + CONST_CAST(GLXEW_EXT_scene_marker) = _glewSearchExtension("GLX_EXT_scene_marker", extStart, extEnd); #endif /* GLX_EXT_scene_marker */ #ifdef GLX_EXT_swap_control - CONST_CAST(GLXEW_EXT_swap_control) = glxewGetExtension("GLX_EXT_swap_control"); + CONST_CAST(GLXEW_EXT_swap_control) = _glewSearchExtension("GLX_EXT_swap_control", extStart, extEnd); if (glewExperimental || GLXEW_EXT_swap_control) CONST_CAST(GLXEW_EXT_swap_control) = !_glewInit_GLX_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_EXT_swap_control */ #ifdef GLX_EXT_texture_from_pixmap - CONST_CAST(GLXEW_EXT_texture_from_pixmap) = glxewGetExtension("GLX_EXT_texture_from_pixmap"); + CONST_CAST(GLXEW_EXT_texture_from_pixmap) = _glewSearchExtension("GLX_EXT_texture_from_pixmap", extStart, extEnd); if (glewExperimental || GLXEW_EXT_texture_from_pixmap) CONST_CAST(GLXEW_EXT_texture_from_pixmap) = !_glewInit_GLX_EXT_texture_from_pixmap(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_EXT_texture_from_pixmap */ #ifdef GLX_EXT_visual_info - CONST_CAST(GLXEW_EXT_visual_info) = glxewGetExtension("GLX_EXT_visual_info"); + CONST_CAST(GLXEW_EXT_visual_info) = _glewSearchExtension("GLX_EXT_visual_info", extStart, extEnd); #endif /* GLX_EXT_visual_info */ #ifdef GLX_EXT_visual_rating - CONST_CAST(GLXEW_EXT_visual_rating) = glxewGetExtension("GLX_EXT_visual_rating"); + CONST_CAST(GLXEW_EXT_visual_rating) = _glewSearchExtension("GLX_EXT_visual_rating", extStart, extEnd); #endif /* GLX_EXT_visual_rating */ #ifdef GLX_INTEL_swap_event - CONST_CAST(GLXEW_INTEL_swap_event) = glxewGetExtension("GLX_INTEL_swap_event"); + CONST_CAST(GLXEW_INTEL_swap_event) = _glewSearchExtension("GLX_INTEL_swap_event", extStart, extEnd); #endif /* GLX_INTEL_swap_event */ #ifdef GLX_MESA_agp_offset - CONST_CAST(GLXEW_MESA_agp_offset) = glxewGetExtension("GLX_MESA_agp_offset"); + CONST_CAST(GLXEW_MESA_agp_offset) = _glewSearchExtension("GLX_MESA_agp_offset", extStart, extEnd); if (glewExperimental || GLXEW_MESA_agp_offset) CONST_CAST(GLXEW_MESA_agp_offset) = !_glewInit_GLX_MESA_agp_offset(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_agp_offset */ #ifdef GLX_MESA_copy_sub_buffer - CONST_CAST(GLXEW_MESA_copy_sub_buffer) = glxewGetExtension("GLX_MESA_copy_sub_buffer"); + CONST_CAST(GLXEW_MESA_copy_sub_buffer) = _glewSearchExtension("GLX_MESA_copy_sub_buffer", extStart, extEnd); if (glewExperimental || GLXEW_MESA_copy_sub_buffer) CONST_CAST(GLXEW_MESA_copy_sub_buffer) = !_glewInit_GLX_MESA_copy_sub_buffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_copy_sub_buffer */ #ifdef GLX_MESA_pixmap_colormap - CONST_CAST(GLXEW_MESA_pixmap_colormap) = glxewGetExtension("GLX_MESA_pixmap_colormap"); + CONST_CAST(GLXEW_MESA_pixmap_colormap) = _glewSearchExtension("GLX_MESA_pixmap_colormap", extStart, extEnd); if (glewExperimental || GLXEW_MESA_pixmap_colormap) CONST_CAST(GLXEW_MESA_pixmap_colormap) = !_glewInit_GLX_MESA_pixmap_colormap(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_pixmap_colormap */ #ifdef GLX_MESA_release_buffers - CONST_CAST(GLXEW_MESA_release_buffers) = glxewGetExtension("GLX_MESA_release_buffers"); + CONST_CAST(GLXEW_MESA_release_buffers) = _glewSearchExtension("GLX_MESA_release_buffers", extStart, extEnd); if (glewExperimental || GLXEW_MESA_release_buffers) CONST_CAST(GLXEW_MESA_release_buffers) = !_glewInit_GLX_MESA_release_buffers(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_release_buffers */ #ifdef GLX_MESA_set_3dfx_mode - CONST_CAST(GLXEW_MESA_set_3dfx_mode) = glxewGetExtension("GLX_MESA_set_3dfx_mode"); + CONST_CAST(GLXEW_MESA_set_3dfx_mode) = _glewSearchExtension("GLX_MESA_set_3dfx_mode", extStart, extEnd); if (glewExperimental || GLXEW_MESA_set_3dfx_mode) CONST_CAST(GLXEW_MESA_set_3dfx_mode) = !_glewInit_GLX_MESA_set_3dfx_mode(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_MESA_set_3dfx_mode */ #ifdef GLX_NV_copy_image - CONST_CAST(GLXEW_NV_copy_image) = glxewGetExtension("GLX_NV_copy_image"); + CONST_CAST(GLXEW_NV_copy_image) = _glewSearchExtension("GLX_NV_copy_image", extStart, extEnd); if (glewExperimental || GLXEW_NV_copy_image) CONST_CAST(GLXEW_NV_copy_image) = !_glewInit_GLX_NV_copy_image(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_copy_image */ #ifdef GLX_NV_float_buffer - CONST_CAST(GLXEW_NV_float_buffer) = glxewGetExtension("GLX_NV_float_buffer"); + CONST_CAST(GLXEW_NV_float_buffer) = _glewSearchExtension("GLX_NV_float_buffer", extStart, extEnd); #endif /* GLX_NV_float_buffer */ #ifdef GLX_NV_multisample_coverage - CONST_CAST(GLXEW_NV_multisample_coverage) = glxewGetExtension("GLX_NV_multisample_coverage"); + CONST_CAST(GLXEW_NV_multisample_coverage) = _glewSearchExtension("GLX_NV_multisample_coverage", extStart, extEnd); #endif /* GLX_NV_multisample_coverage */ #ifdef GLX_NV_present_video - CONST_CAST(GLXEW_NV_present_video) = glxewGetExtension("GLX_NV_present_video"); + CONST_CAST(GLXEW_NV_present_video) = _glewSearchExtension("GLX_NV_present_video", extStart, extEnd); if (glewExperimental || GLXEW_NV_present_video) CONST_CAST(GLXEW_NV_present_video) = !_glewInit_GLX_NV_present_video(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_present_video */ #ifdef GLX_NV_swap_group - CONST_CAST(GLXEW_NV_swap_group) = glxewGetExtension("GLX_NV_swap_group"); + CONST_CAST(GLXEW_NV_swap_group) = _glewSearchExtension("GLX_NV_swap_group", extStart, extEnd); if (glewExperimental || GLXEW_NV_swap_group) CONST_CAST(GLXEW_NV_swap_group) = !_glewInit_GLX_NV_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_swap_group */ #ifdef GLX_NV_vertex_array_range - CONST_CAST(GLXEW_NV_vertex_array_range) = glxewGetExtension("GLX_NV_vertex_array_range"); + CONST_CAST(GLXEW_NV_vertex_array_range) = _glewSearchExtension("GLX_NV_vertex_array_range", extStart, extEnd); if (glewExperimental || GLXEW_NV_vertex_array_range) CONST_CAST(GLXEW_NV_vertex_array_range) = !_glewInit_GLX_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_vertex_array_range */ +#ifdef GLX_NV_video_capture + CONST_CAST(GLXEW_NV_video_capture) = _glewSearchExtension("GLX_NV_video_capture", extStart, extEnd); + if (glewExperimental || GLXEW_NV_video_capture) CONST_CAST(GLXEW_NV_video_capture) = !_glewInit_GLX_NV_video_capture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_video_capture */ #ifdef GLX_NV_video_output - CONST_CAST(GLXEW_NV_video_output) = glxewGetExtension("GLX_NV_video_output"); + CONST_CAST(GLXEW_NV_video_output) = _glewSearchExtension("GLX_NV_video_output", extStart, extEnd); if (glewExperimental || GLXEW_NV_video_output) CONST_CAST(GLXEW_NV_video_output) = !_glewInit_GLX_NV_video_output(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_NV_video_output */ #ifdef GLX_OML_swap_method - CONST_CAST(GLXEW_OML_swap_method) = glxewGetExtension("GLX_OML_swap_method"); + CONST_CAST(GLXEW_OML_swap_method) = _glewSearchExtension("GLX_OML_swap_method", extStart, extEnd); #endif /* GLX_OML_swap_method */ -#if defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -#include - CONST_CAST(GLXEW_OML_sync_control) = glxewGetExtension("GLX_OML_sync_control"); +#ifdef GLX_OML_sync_control + CONST_CAST(GLXEW_OML_sync_control) = _glewSearchExtension("GLX_OML_sync_control", extStart, extEnd); if (glewExperimental || GLXEW_OML_sync_control) CONST_CAST(GLXEW_OML_sync_control) = !_glewInit_GLX_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_OML_sync_control */ #ifdef GLX_SGIS_blended_overlay - CONST_CAST(GLXEW_SGIS_blended_overlay) = glxewGetExtension("GLX_SGIS_blended_overlay"); + CONST_CAST(GLXEW_SGIS_blended_overlay) = _glewSearchExtension("GLX_SGIS_blended_overlay", extStart, extEnd); #endif /* GLX_SGIS_blended_overlay */ #ifdef GLX_SGIS_color_range - CONST_CAST(GLXEW_SGIS_color_range) = glxewGetExtension("GLX_SGIS_color_range"); + CONST_CAST(GLXEW_SGIS_color_range) = _glewSearchExtension("GLX_SGIS_color_range", extStart, extEnd); #endif /* GLX_SGIS_color_range */ #ifdef GLX_SGIS_multisample - CONST_CAST(GLXEW_SGIS_multisample) = glxewGetExtension("GLX_SGIS_multisample"); + CONST_CAST(GLXEW_SGIS_multisample) = _glewSearchExtension("GLX_SGIS_multisample", extStart, extEnd); #endif /* GLX_SGIS_multisample */ #ifdef GLX_SGIS_shared_multisample - CONST_CAST(GLXEW_SGIS_shared_multisample) = glxewGetExtension("GLX_SGIS_shared_multisample"); + CONST_CAST(GLXEW_SGIS_shared_multisample) = _glewSearchExtension("GLX_SGIS_shared_multisample", extStart, extEnd); #endif /* GLX_SGIS_shared_multisample */ #ifdef GLX_SGIX_fbconfig - CONST_CAST(GLXEW_SGIX_fbconfig) = glxewGetExtension("GLX_SGIX_fbconfig"); + CONST_CAST(GLXEW_SGIX_fbconfig) = _glewSearchExtension("GLX_SGIX_fbconfig", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_fbconfig) CONST_CAST(GLXEW_SGIX_fbconfig) = !_glewInit_GLX_SGIX_fbconfig(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_fbconfig */ #ifdef GLX_SGIX_hyperpipe - CONST_CAST(GLXEW_SGIX_hyperpipe) = glxewGetExtension("GLX_SGIX_hyperpipe"); + CONST_CAST(GLXEW_SGIX_hyperpipe) = _glewSearchExtension("GLX_SGIX_hyperpipe", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_hyperpipe) CONST_CAST(GLXEW_SGIX_hyperpipe) = !_glewInit_GLX_SGIX_hyperpipe(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_hyperpipe */ #ifdef GLX_SGIX_pbuffer - CONST_CAST(GLXEW_SGIX_pbuffer) = glxewGetExtension("GLX_SGIX_pbuffer"); + CONST_CAST(GLXEW_SGIX_pbuffer) = _glewSearchExtension("GLX_SGIX_pbuffer", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_pbuffer) CONST_CAST(GLXEW_SGIX_pbuffer) = !_glewInit_GLX_SGIX_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_pbuffer */ #ifdef GLX_SGIX_swap_barrier - CONST_CAST(GLXEW_SGIX_swap_barrier) = glxewGetExtension("GLX_SGIX_swap_barrier"); + CONST_CAST(GLXEW_SGIX_swap_barrier) = _glewSearchExtension("GLX_SGIX_swap_barrier", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_swap_barrier) CONST_CAST(GLXEW_SGIX_swap_barrier) = !_glewInit_GLX_SGIX_swap_barrier(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_swap_barrier */ #ifdef GLX_SGIX_swap_group - CONST_CAST(GLXEW_SGIX_swap_group) = glxewGetExtension("GLX_SGIX_swap_group"); + CONST_CAST(GLXEW_SGIX_swap_group) = _glewSearchExtension("GLX_SGIX_swap_group", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_swap_group) CONST_CAST(GLXEW_SGIX_swap_group) = !_glewInit_GLX_SGIX_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_swap_group */ #ifdef GLX_SGIX_video_resize - CONST_CAST(GLXEW_SGIX_video_resize) = glxewGetExtension("GLX_SGIX_video_resize"); + CONST_CAST(GLXEW_SGIX_video_resize) = _glewSearchExtension("GLX_SGIX_video_resize", extStart, extEnd); if (glewExperimental || GLXEW_SGIX_video_resize) CONST_CAST(GLXEW_SGIX_video_resize) = !_glewInit_GLX_SGIX_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGIX_video_resize */ #ifdef GLX_SGIX_visual_select_group - CONST_CAST(GLXEW_SGIX_visual_select_group) = glxewGetExtension("GLX_SGIX_visual_select_group"); + CONST_CAST(GLXEW_SGIX_visual_select_group) = _glewSearchExtension("GLX_SGIX_visual_select_group", extStart, extEnd); #endif /* GLX_SGIX_visual_select_group */ #ifdef GLX_SGI_cushion - CONST_CAST(GLXEW_SGI_cushion) = glxewGetExtension("GLX_SGI_cushion"); + CONST_CAST(GLXEW_SGI_cushion) = _glewSearchExtension("GLX_SGI_cushion", extStart, extEnd); if (glewExperimental || GLXEW_SGI_cushion) CONST_CAST(GLXEW_SGI_cushion) = !_glewInit_GLX_SGI_cushion(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_cushion */ #ifdef GLX_SGI_make_current_read - CONST_CAST(GLXEW_SGI_make_current_read) = glxewGetExtension("GLX_SGI_make_current_read"); + CONST_CAST(GLXEW_SGI_make_current_read) = _glewSearchExtension("GLX_SGI_make_current_read", extStart, extEnd); if (glewExperimental || GLXEW_SGI_make_current_read) CONST_CAST(GLXEW_SGI_make_current_read) = !_glewInit_GLX_SGI_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_make_current_read */ #ifdef GLX_SGI_swap_control - CONST_CAST(GLXEW_SGI_swap_control) = glxewGetExtension("GLX_SGI_swap_control"); + CONST_CAST(GLXEW_SGI_swap_control) = _glewSearchExtension("GLX_SGI_swap_control", extStart, extEnd); if (glewExperimental || GLXEW_SGI_swap_control) CONST_CAST(GLXEW_SGI_swap_control) = !_glewInit_GLX_SGI_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_swap_control */ #ifdef GLX_SGI_video_sync - CONST_CAST(GLXEW_SGI_video_sync) = glxewGetExtension("GLX_SGI_video_sync"); + CONST_CAST(GLXEW_SGI_video_sync) = _glewSearchExtension("GLX_SGI_video_sync", extStart, extEnd); if (glewExperimental || GLXEW_SGI_video_sync) CONST_CAST(GLXEW_SGI_video_sync) = !_glewInit_GLX_SGI_video_sync(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SGI_video_sync */ #ifdef GLX_SUN_get_transparent_index - CONST_CAST(GLXEW_SUN_get_transparent_index) = glxewGetExtension("GLX_SUN_get_transparent_index"); + CONST_CAST(GLXEW_SUN_get_transparent_index) = _glewSearchExtension("GLX_SUN_get_transparent_index", extStart, extEnd); if (glewExperimental || GLXEW_SUN_get_transparent_index) CONST_CAST(GLXEW_SUN_get_transparent_index) = !_glewInit_GLX_SUN_get_transparent_index(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SUN_get_transparent_index */ #ifdef GLX_SUN_video_resize - CONST_CAST(GLXEW_SUN_video_resize) = glxewGetExtension("GLX_SUN_video_resize"); + CONST_CAST(GLXEW_SUN_video_resize) = _glewSearchExtension("GLX_SUN_video_resize", extStart, extEnd); if (glewExperimental || GLXEW_SUN_video_resize) CONST_CAST(GLXEW_SUN_video_resize) = !_glewInit_GLX_SUN_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); #endif /* GLX_SUN_video_resize */ @@ -11354,10 +11581,10 @@ const GLubyte* glewGetString (GLenum name) static const GLubyte* _glewString[] = { (const GLubyte*)NULL, - (const GLubyte*)"1.5.8", + (const GLubyte*)"1.6.0", (const GLubyte*)"1", - (const GLubyte*)"5", - (const GLubyte*)"8" + (const GLubyte*)"6", + (const GLubyte*)"0" }; const int max_string = sizeof(_glewString)/sizeof(*_glewString) - 1; return _glewString[(int)name > max_string ? 0 : (int)name]; @@ -11522,6 +11749,13 @@ GLboolean glewIsSupported (const char* name) } if (_glewStrSame2(&pos, &len, (const GLubyte*)"AMD_", 4)) { +#ifdef GL_AMD_blend_minmax_factor + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax_factor", 19)) + { + ret = GLEW_AMD_blend_minmax_factor; + continue; + } +#endif #ifdef GL_AMD_conservative_depth if (_glewStrSame3(&pos, &len, (const GLubyte*)"conservative_depth", 18)) { @@ -11564,6 +11798,13 @@ GLboolean glewIsSupported (const char* name) continue; } #endif +#ifdef GL_AMD_sample_positions + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sample_positions", 16)) + { + ret = GLEW_AMD_sample_positions; + continue; + } +#endif #ifdef GL_AMD_seamless_cubemap_per_texture if (_glewStrSame3(&pos, &len, (const GLubyte*)"seamless_cubemap_per_texture", 28)) { @@ -13216,6 +13457,13 @@ GLboolean glewIsSupported (const char* name) ret = GLEW_EXT_vertex_weighting; continue; } +#endif +#ifdef GL_EXT_x11_sync_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"x11_sync_object", 15)) + { + ret = GLEW_EXT_x11_sync_object; + continue; + } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"GREMEDY_", 8)) @@ -13723,6 +13971,13 @@ GLboolean glewIsSupported (const char* name) continue; } #endif +#ifdef GL_NV_texture_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multisample", 19)) + { + ret = GLEW_NV_texture_multisample; + continue; + } +#endif #ifdef GL_NV_texture_rectangle if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) { @@ -13841,6 +14096,13 @@ GLboolean glewIsSupported (const char* name) ret = GLEW_NV_vertex_program4; continue; } +#endif +#ifdef GL_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) + { + ret = GLEW_NV_video_capture; + continue; + } #endif } if (_glewStrSame2(&pos, &len, (const GLubyte*)"OES_", 4)) @@ -14655,6 +14917,13 @@ GLboolean wglewIsSupported (const char* name) } if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) { +#ifdef WGL_NV_DX_interop + if (_glewStrSame3(&pos, &len, (const GLubyte*)"DX_interop", 10)) + { + ret = WGLEW_NV_DX_interop; + continue; + } +#endif #ifdef WGL_NV_copy_image if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_image", 10)) { @@ -14718,6 +14987,13 @@ GLboolean wglewIsSupported (const char* name) continue; } #endif +#ifdef WGL_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) + { + ret = WGLEW_NV_video_capture; + continue; + } +#endif #ifdef WGL_NV_video_output if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_output", 12)) { @@ -15035,6 +15311,13 @@ GLboolean glxewIsSupported (const char* name) continue; } #endif +#ifdef GLX_NV_video_capture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_capture", 13)) + { + ret = GLXEW_NV_video_capture; + continue; + } +#endif #ifdef GLX_NV_video_output if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_output", 12)) { @@ -15052,8 +15335,7 @@ GLboolean glxewIsSupported (const char* name) continue; } #endif -#if defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -#include +#ifdef GLX_OML_sync_control if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) { ret = GLXEW_OML_sync_control; From 211cd99cbc0d894c2e586bd08ae723bf18b3cdd3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 2 Jun 2011 04:58:27 +0000 Subject: [PATCH 012/105] Fix #27539: Sculpt data is lost after editing base mesh Face's totdisp was set to correct value, but memory hasn't been allocated for disps. Handle this in multires_topology_changed(), so the whole MDISPS layer wouldn't be totally re-allocated when applying displacement. --- source/blender/blenkernel/intern/multires.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 637f5da45af..13ab89200db 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1756,7 +1756,7 @@ void multires_topology_changed(Scene *scene, Object *ob) int nvert= me->mface[i].v4 ? 4 : 3; /* allocate memory for mdisp, the whole disp layer would be erased otherwise */ - if(!mdisp->totdisp) { + if(!mdisp->totdisp || !mdisp->disps) { if(grid) { mdisp->totdisp= nvert*grid; mdisp->disps= MEM_callocN(mdisp->totdisp*sizeof(float)*3, "mdisp topology"); From d46da5a09d972926e6b4ab5d9fde49ffad16a48f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Jun 2011 08:29:16 +0000 Subject: [PATCH 013/105] mathutils support for color arithmetic, also some minor whitespace edits. --- source/blender/python/BPY_extern.h | 14 +- source/blender/python/generic/bgl.c | 24 +- source/blender/python/generic/bgl.h | 2 +- .../python/generic/bpy_internal_import.c | 4 +- .../blender/python/generic/mathutils_Color.c | 278 +++++++++++++++++- .../blender/python/generic/mathutils_Euler.c | 2 +- .../blender/python/generic/mathutils_Matrix.c | 2 +- .../blender/python/generic/mathutils_Vector.c | 29 +- .../python/generic/mathutils_geometry.c | 4 +- source/blender/python/intern/bpy.c | 12 +- source/blender/python/intern/bpy.h | 2 +- source/blender/python/intern/bpy_app.h | 2 +- source/blender/python/intern/bpy_driver.c | 2 +- source/blender/python/intern/bpy_interface.c | 3 + source/blender/python/intern/bpy_library.c | 2 +- source/blender/python/intern/bpy_props.c | 2 +- source/blender/python/intern/bpy_props.h | 2 +- source/blender/python/intern/bpy_rna.c | 4 +- source/blender/python/intern/bpy_rna.h | 16 +- 19 files changed, 337 insertions(+), 69 deletions(-) diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index e8796a6f8dd..ae5253d07a0 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -67,14 +67,14 @@ int BPY_is_pyconstraint(struct Text *text); // void BPY_free_pyconstraint_links(struct Text *text); // void BPY_python_start(int argc, const char **argv); -void BPY_python_end( void ); -// void init_syspath( int first_time ); -// void syspath_append( char *dir ); -// void BPY_rebuild_syspath( void ); -// int BPY_path_update( void ); +void BPY_python_end(void); +// void init_syspath(int first_time); +// void syspath_append(char *dir); +// void BPY_rebuild_syspath(void); +// int BPY_path_update(void); // -// int BPY_Err_getLinenumber( void ); -// const char *BPY_Err_getFilename( void ); +// int BPY_Err_getLinenumber(void); +// const char *BPY_Err_getFilename(void); /* 2.5 UI Scripts */ int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports); diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 4eb6d78bd7b..b5a693c397c 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -62,16 +62,16 @@ square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\ buffer which is twice as deep as it is wide or high." ); -static PyObject *Method_Buffer( PyObject * self, PyObject *args ); +static PyObject *Method_Buffer(PyObject *self, PyObject *args); /* Buffer sequence methods */ -static int Buffer_len( PyObject * self ); -static PyObject *Buffer_item( PyObject * self, int i ); -static PyObject *Buffer_slice( PyObject * self, int begin, int end ); -static int Buffer_ass_item( PyObject * self, int i, PyObject * v ); -static int Buffer_ass_slice( PyObject * self, int begin, int end, - PyObject * seq ); +static int Buffer_len(PyObject *self); +static PyObject *Buffer_item(PyObject *self, int i); +static PyObject *Buffer_slice(PyObject *self, int begin, int end); +static int Buffer_ass_item(PyObject *self, int i, PyObject *v); +static int Buffer_ass_slice(PyObject *self, int begin, int end, + PyObject *seq); static PySequenceMethods Buffer_SeqMethods = { ( lenfunc ) Buffer_len, /*sq_length */ @@ -86,11 +86,11 @@ static PySequenceMethods Buffer_SeqMethods = { (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; -static void Buffer_dealloc( PyObject * self ); -static PyObject *Buffer_tolist( PyObject * self ); -static PyObject *Buffer_dimensions( PyObject * self ); -static PyObject *Buffer_getattr( PyObject * self, char *name ); -static PyObject *Buffer_repr( PyObject * self ); +static void Buffer_dealloc(PyObject *self); +static PyObject *Buffer_tolist(PyObject *self); +static PyObject *Buffer_dimensions(PyObject *self); +static PyObject *Buffer_getattr(PyObject *self, char *name); +static PyObject *Buffer_repr(PyObject *self); PyTypeObject BGL_bufferType = { PyVarObject_HEAD_INIT(NULL, 0) diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h index a870e82d4fd..81b570c8505 100644 --- a/source/blender/python/generic/bgl.h +++ b/source/blender/python/generic/bgl.h @@ -55,7 +55,7 @@ int BGL_typeSize( int type ); /*@ For Python access to OpenGL functions requiring a pointer. */ typedef struct _Buffer { PyObject_VAR_HEAD - PyObject * parent; + PyObject *parent; int type; /* GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT */ int ndimensions; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index cb145cc453b..f0158fe72c3 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -217,7 +217,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) } -static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw) +static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { PyObject *exception, *err, *tb; char *name; @@ -270,7 +270,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * our reload() module, to handle reloading in-memory scripts */ -static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module) +static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module) { PyObject *exception, *err, *tb; PyObject *newmodule= NULL; diff --git a/source/blender/python/generic/mathutils_Color.c b/source/blender/python/generic/mathutils_Color.c index 09e3493cd09..c59cb501d86 100644 --- a/source/blender/python/generic/mathutils_Color.c +++ b/source/blender/python/generic/mathutils_Color.c @@ -186,7 +186,7 @@ static PyObject *Color_item(ColorObject * self, int i) } //----------------------------object[]------------------------- //sequence accessor (set) -static int Color_ass_item(ColorObject * self, int i, PyObject * value) +static int Color_ass_item(ColorObject * self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); @@ -233,7 +233,7 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end) } //----------------------------object[z:y]------------------------ //sequence slice (set) -static int Color_ass_slice(ColorObject * self, int begin, int end, PyObject * seq) +static int Color_ass_slice(ColorObject *self, int begin, int end, PyObject *seq) { int i, size; float col[COLOR_SIZE]; @@ -344,13 +344,279 @@ static PyMappingMethods Color_AsMapping = { (objobjargproc)Color_ass_subscript }; +/* numeric */ + + +/* addition: obj + obj */ +static PyObject *Color_add(PyObject *v1, PyObject *v2) +{ + ColorObject *color1 = NULL, *color2 = NULL; + float col[COLOR_SIZE]; + + if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { + PyErr_SetString(PyExc_AttributeError, "Color addition: arguments not valid for this operation"); + return NULL; + } + color1 = (ColorObject*)v1; + color2 = (ColorObject*)v2; + + if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + return NULL; + + add_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE); + + return newColorObject(col, Py_NEW, Py_TYPE(v1)); +} + +/* addition in-place: obj += obj */ +static PyObject *Color_iadd(PyObject *v1, PyObject *v2) +{ + ColorObject *color1 = NULL, *color2 = NULL; + + if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { + PyErr_SetString(PyExc_AttributeError, "Color addition: arguments not valid for this operation"); + return NULL; + } + color1 = (ColorObject*)v1; + color2 = (ColorObject*)v2; + + if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + return NULL; + + add_vn_vn(color1->col, color2->col, COLOR_SIZE); + + (void)BaseMath_WriteCallback(color1); + Py_INCREF(v1); + return v1; +} + +/* subtraction: obj - obj */ +static PyObject *Color_sub(PyObject *v1, PyObject *v2) +{ + ColorObject *color1 = NULL, *color2 = NULL; + float col[COLOR_SIZE]; + + if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { + PyErr_SetString(PyExc_AttributeError, "Color subtraction: arguments not valid for this operation"); + return NULL; + } + color1 = (ColorObject*)v1; + color2 = (ColorObject*)v2; + + if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + return NULL; + + sub_vn_vnvn(col, color1->col, color2->col, COLOR_SIZE); + + return newColorObject(col, Py_NEW, Py_TYPE(v1)); +} + +/* subtraction in-place: obj -= obj */ +static PyObject *Color_isub(PyObject *v1, PyObject *v2) +{ + ColorObject *color1= NULL, *color2= NULL; + + if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) { + PyErr_SetString(PyExc_AttributeError, "Color subtraction: arguments not valid for this operation"); + return NULL; + } + color1 = (ColorObject*)v1; + color2 = (ColorObject*)v2; + + if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1) + return NULL; + + sub_vn_vn(color1->col, color2->col, COLOR_SIZE); + + (void)BaseMath_WriteCallback(color1); + Py_INCREF(v1); + return v1; +} + +static PyObject *color_mul_float(ColorObject *color, const float scalar) +{ + float tcol[COLOR_SIZE]; + mul_vn_vn_fl(tcol, color->col, COLOR_SIZE, scalar); + return newColorObject(tcol, Py_NEW, Py_TYPE(color)); +} + + +static PyObject *Color_mul(PyObject *v1, PyObject *v2) +{ + ColorObject *color1 = NULL, *color2 = NULL; + float scalar; + + if ColorObject_Check(v1) { + color1= (ColorObject *)v1; + if(BaseMath_ReadCallback(color1) == -1) + return NULL; + } + if ColorObject_Check(v2) { + color2= (ColorObject *)v2; + if(BaseMath_ReadCallback(color2) == -1) + return NULL; + } + + + /* make sure v1 is always the vector */ + if (color1 && color2) { + /* col * col, dont support yet! */ + } + else if (color1) { + if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR * FLOAT */ + return color_mul_float(color1, scalar); + } + } + else if (color2) { + if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* FLOAT * COLOR */ + return color_mul_float(color2, scalar); + } + } + else { + BLI_assert(!"internal error"); + } + + PyErr_Format(PyExc_TypeError, "Color multiplication: not supported between '%.200s' and '%.200s' types", Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); + return NULL; +} + +static PyObject *Color_div(PyObject *v1, PyObject *v2) +{ + ColorObject *color1 = NULL; + float scalar; + + if ColorObject_Check(v1) { + color1= (ColorObject *)v1; + if(BaseMath_ReadCallback(color1) == -1) + return NULL; + } + else { + PyErr_SetString(PyExc_TypeError, "Color division not supported in this order"); + return NULL; + } + + /* make sure v1 is always the vector */ + if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR * FLOAT */ + if(scalar==0.0f) { + PyErr_SetString(PyExc_ZeroDivisionError, "Color division: divide by zero error"); + return NULL; + } + return color_mul_float(color1, 1.0f / scalar); + } + + PyErr_Format(PyExc_TypeError, "Color multiplication: not supported between '%.200s' and '%.200s' types", Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name); + return NULL; +} + +/* mulplication in-place: obj *= obj */ +static PyObject *Color_imul(PyObject *v1, PyObject *v2) +{ + ColorObject *color = (ColorObject *)v1; + float scalar; + + if(BaseMath_ReadCallback(color) == -1) + return NULL; + + /* only support color *= float */ + if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR *= FLOAT */ + mul_vn_fl(color->col, COLOR_SIZE, scalar); + } + else { + PyErr_SetString(PyExc_TypeError, "Color multiplication: arguments not acceptable for this operation"); + return NULL; + } + + (void)BaseMath_WriteCallback(color); + Py_INCREF(v1); + return v1; +} + +/* mulplication in-place: obj *= obj */ +static PyObject *Color_idiv(PyObject *v1, PyObject *v2) +{ + ColorObject *color = (ColorObject *)v1; + float scalar; + + if(BaseMath_ReadCallback(color) == -1) + return NULL; + + /* only support color /= float */ + if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* COLOR /= FLOAT */ + if(scalar==0.0f) { + PyErr_SetString(PyExc_ZeroDivisionError, "Color division: divide by zero error"); + return NULL; + } + + mul_vn_fl(color->col, COLOR_SIZE, 1.0f / scalar); + } + else { + PyErr_SetString(PyExc_TypeError, "Color multiplication: arguments not acceptable for this operation"); + return NULL; + } + + (void)BaseMath_WriteCallback(color); + Py_INCREF(v1); + return v1; +} + +/* -obj + returns the negative of this object*/ +static PyObject *Color_neg(ColorObject *self) +{ + float tcol[COLOR_SIZE]; + + if(BaseMath_ReadCallback(self) == -1) + return NULL; + + negate_vn_vn(tcol, self->col, COLOR_SIZE); + return newColorObject(tcol, Py_NEW, Py_TYPE(self)); +} + + +static PyNumberMethods Color_NumMethods = { + (binaryfunc) Color_add, /*nb_add*/ + (binaryfunc) Color_sub, /*nb_subtract*/ + (binaryfunc) Color_mul, /*nb_multiply*/ + NULL, /*nb_remainder*/ + NULL, /*nb_divmod*/ + NULL, /*nb_power*/ + (unaryfunc) Color_neg, /*nb_negative*/ + (unaryfunc) NULL, /*tp_positive*/ + (unaryfunc) NULL, /*tp_absolute*/ + (inquiry) NULL, /*tp_bool*/ + (unaryfunc) NULL, /*nb_invert*/ + NULL, /*nb_lshift*/ + (binaryfunc)NULL, /*nb_rshift*/ + NULL, /*nb_and*/ + NULL, /*nb_xor*/ + NULL, /*nb_or*/ + NULL, /*nb_int*/ + NULL, /*nb_reserved*/ + NULL, /*nb_float*/ + Color_iadd, /* nb_inplace_add */ + Color_isub, /* nb_inplace_subtract */ + Color_imul, /* nb_inplace_multiply */ + NULL, /* nb_inplace_remainder */ + NULL, /* nb_inplace_power */ + NULL, /* nb_inplace_lshift */ + NULL, /* nb_inplace_rshift */ + NULL, /* nb_inplace_and */ + NULL, /* nb_inplace_xor */ + NULL, /* nb_inplace_or */ + NULL, /* nb_floor_divide */ + Color_div, /* nb_true_divide */ + NULL, /* nb_inplace_floor_divide */ + Color_idiv, /* nb_inplace_true_divide */ + NULL, /* nb_index */ +}; + /* color channel, vector.r/g/b */ static PyObject *Color_getChannel(ColorObject * self, void *type) { return Color_item(self, GET_INT_FROM_POINTER(type)); } -static int Color_setChannel(ColorObject * self, PyObject * value, void * type) +static int Color_setChannel(ColorObject * self, PyObject *value, void * type) { return Color_ass_item(self, GET_INT_FROM_POINTER(type), value); } @@ -369,7 +635,7 @@ static PyObject *Color_getChannelHSV(ColorObject * self, void *type) return PyFloat_FromDouble(hsv[i]); } -static int Color_setChannelHSV(ColorObject * self, PyObject * value, void * type) +static int Color_setChannelHSV(ColorObject * self, PyObject *value, void * type) { float hsv[3]; int i= GET_INT_FROM_POINTER(type); @@ -412,7 +678,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure)) return ret; } -static int Color_setHSV(ColorObject * self, PyObject * value, void *UNUSED(closure)) +static int Color_setHSV(ColorObject * self, PyObject *value, void *UNUSED(closure)) { float hsv[3]; @@ -473,7 +739,7 @@ PyTypeObject color_Type = { NULL, //tp_setattr NULL, //tp_compare (reprfunc) Color_repr, //tp_repr - NULL, //tp_as_number + &Color_NumMethods, //tp_as_number &Color_SeqMethods, //tp_as_sequence &Color_AsMapping, //tp_as_mapping NULL, //tp_hash diff --git a/source/blender/python/generic/mathutils_Euler.c b/source/blender/python/generic/mathutils_Euler.c index 9adf0ee905b..4281c7bf6c5 100644 --- a/source/blender/python/generic/mathutils_Euler.c +++ b/source/blender/python/generic/mathutils_Euler.c @@ -419,7 +419,7 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end) } //----------------------------object[z:y]------------------------ //sequence slice (set) -static int Euler_ass_slice(EulerObject * self, int begin, int end, PyObject * seq) +static int Euler_ass_slice(EulerObject *self, int begin, int end, PyObject *seq) { int i, size; float eul[EULER_SIZE]; diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c index 982a8e63282..4b7f9dc0d97 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/generic/mathutils_Matrix.c @@ -1485,7 +1485,7 @@ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar) return newMatrixObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat)); } -static PyObject *Matrix_mul(PyObject * m1, PyObject * m2) +static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) { float scalar; diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c index fd8d1b5f481..d0ba94474d4 100644 --- a/source/blender/python/generic/mathutils_Vector.c +++ b/source/blender/python/generic/mathutils_Vector.c @@ -869,8 +869,7 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end) return tuple; } /* sequence slice (set): vector[a:b] = value */ -static int Vector_ass_slice(VectorObject *self, int begin, int end, - PyObject * seq) +static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *seq) { int y, size = 0; float vec[MAX_DIMENSIONS]; @@ -899,7 +898,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, /* Numeric Protocols */ /* addition: obj + obj */ -static PyObject *Vector_add(PyObject * v1, PyObject * v2) +static PyObject *Vector_add(PyObject *v1, PyObject *v2) { VectorObject *vec1 = NULL, *vec2 = NULL; float vec[MAX_DIMENSIONS]; @@ -926,7 +925,7 @@ static PyObject *Vector_add(PyObject * v1, PyObject * v2) } /* addition in-place: obj += obj */ -static PyObject *Vector_iadd(PyObject * v1, PyObject * v2) +static PyObject *Vector_iadd(PyObject *v1, PyObject *v2) { VectorObject *vec1 = NULL, *vec2 = NULL; @@ -953,7 +952,7 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2) } /* subtraction: obj - obj */ -static PyObject *Vector_sub(PyObject * v1, PyObject * v2) +static PyObject *Vector_sub(PyObject *v1, PyObject *v2) { VectorObject *vec1 = NULL, *vec2 = NULL; float vec[MAX_DIMENSIONS]; @@ -979,7 +978,7 @@ static PyObject *Vector_sub(PyObject * v1, PyObject * v2) } /* subtraction in-place: obj -= obj */ -static PyObject *Vector_isub(PyObject * v1, PyObject * v2) +static PyObject *Vector_isub(PyObject *v1, PyObject *v2) { VectorObject *vec1= NULL, *vec2= NULL; @@ -1055,7 +1054,7 @@ static PyObject *vector_mul_float(VectorObject *vec, const float scalar) return newVectorObject(tvec, vec->size, Py_NEW, Py_TYPE(vec)); } -static PyObject *Vector_mul(PyObject * v1, PyObject * v2) +static PyObject *Vector_mul(PyObject *v1, PyObject *v2) { VectorObject *vec1 = NULL, *vec2 = NULL; float scalar; @@ -1116,12 +1115,12 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2) mul_qt_v3(quat2->quat, tvec); return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec1)); } - else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC*FLOAT */ + else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC * FLOAT */ return vector_mul_float(vec1, scalar); } } else if (vec2) { - if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* VEC*FLOAT */ + if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* FLOAT * VEC */ return vector_mul_float(vec2, scalar); } } @@ -1134,7 +1133,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2) } /* mulplication in-place: obj *= obj */ -static PyObject *Vector_imul(PyObject * v1, PyObject * v2) +static PyObject *Vector_imul(PyObject *v1, PyObject *v2) { VectorObject *vec = (VectorObject *)v1; float scalar; @@ -1168,7 +1167,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2) } mul_qt_v3(quat2->quat, vec->vec); } - else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC*=FLOAT */ + else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC *= FLOAT */ mul_vn_fl(vec->vec, vec->size, scalar); } else { @@ -1182,7 +1181,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2) } /* divid: obj / obj */ -static PyObject *Vector_div(PyObject * v1, PyObject * v2) +static PyObject *Vector_div(PyObject *v1, PyObject *v2) { int i; float vec[4], scalar; @@ -1214,7 +1213,7 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2) } /* divide in-place: obj /= obj */ -static PyObject *Vector_idiv(PyObject * v1, PyObject * v2) +static PyObject *Vector_idiv(PyObject *v1, PyObject *v2) { int i; float scalar; @@ -1489,7 +1488,7 @@ static PyObject *Vector_getAxis(VectorObject *self, void *type) return vector_item_internal(self, GET_INT_FROM_POINTER(type), TRUE); } -static int Vector_setAxis(VectorObject *self, PyObject * value, void *type) +static int Vector_setAxis(VectorObject *self, PyObject *value, void *type) { return vector_ass_item_internal(self, GET_INT_FROM_POINTER(type), value, TRUE); } @@ -1596,7 +1595,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure) Returns 0 on success and -1 on failure. On failure, the vector will be unchanged. */ -static int Vector_setSwizzle(VectorObject *self, PyObject * value, void *closure) +static int Vector_setSwizzle(VectorObject *self, PyObject *value, void *closure) { size_t size_from; float scalarVal; diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c index c4917199e59..53c066d1a85 100644 --- a/source/blender/python/generic/mathutils_geometry.c +++ b/source/blender/python/generic/mathutils_geometry.c @@ -169,7 +169,7 @@ PyDoc_STRVAR(M_Geometry_intersect_line_line_doc, ); static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject *args) { - PyObject * tuple; + PyObject *tuple; VectorObject *vec1, *vec2, *vec3, *vec4; float v1[3], v2[3], v3[3], v4[3], i1[3], i2[3]; @@ -720,7 +720,7 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) return 0; } -static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray) +static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray) { int len, i; PyObject *list_item; diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 450151ee870..cb11b53c83c 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -231,7 +231,7 @@ static PyObject *bpy_import_test(const char *modname) /***************************************************************************** * Description: Creates the bpy module and adds it to sys.modules for importing *****************************************************************************/ -void BPy_init_modules( void ) +void BPy_init_modules(void) { extern BPy_StructRNA *bpy_context_module; extern int bpy_lib_init(PyObject *); @@ -262,17 +262,17 @@ void BPy_init_modules( void ) /* run first, initializes rna types */ BPY_rna_init(); - PyModule_AddObject( mod, "types", BPY_rna_types() ); /* needs to be first so bpy_types can run */ + PyModule_AddObject(mod, "types", BPY_rna_types()); /* needs to be first so bpy_types can run */ PyModule_AddObject(mod, "StructMetaPropGroup", (PyObject *)&pyrna_struct_meta_idprop_Type); /* metaclass for idprop types, bpy_types.py needs access */ bpy_lib_init(mod); /* adds '_bpy._library_load', must be called before 'bpy_types' which uses it */ bpy_import_test("bpy_types"); - PyModule_AddObject( mod, "data", BPY_rna_module() ); /* imports bpy_types by running this */ + PyModule_AddObject(mod, "data", BPY_rna_module()); /* imports bpy_types by running this */ bpy_import_test("bpy_types"); - PyModule_AddObject( mod, "props", BPY_rna_props() ); - PyModule_AddObject( mod, "ops", BPY_operator_module() ); /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */ - PyModule_AddObject( mod, "app", BPY_app_struct() ); + PyModule_AddObject(mod, "props", BPY_rna_props()); + PyModule_AddObject(mod, "ops", BPY_operator_module()); /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */ + PyModule_AddObject(mod, "app", BPY_app_struct()); /* bpy context */ RNA_pointer_create(NULL, &RNA_Context, (void *)BPy_GetContext(), &ctx_ptr); diff --git a/source/blender/python/intern/bpy.h b/source/blender/python/intern/bpy.h index 0f298c1daf1..0ebc6bb2438 100644 --- a/source/blender/python/intern/bpy.h +++ b/source/blender/python/intern/bpy.h @@ -26,5 +26,5 @@ */ -void BPy_init_modules( void ); +void BPy_init_modules(void); extern PyObject *bpy_package_py; diff --git a/source/blender/python/intern/bpy_app.h b/source/blender/python/intern/bpy_app.h index d57e4688f46..fbc5696875a 100644 --- a/source/blender/python/intern/bpy_app.h +++ b/source/blender/python/intern/bpy_app.h @@ -29,6 +29,6 @@ #ifndef BPY_APP_H #define BPY_APP_H -PyObject *BPY_app_struct( void ); +PyObject *BPY_app_struct(void); #endif // BPY_APP_H diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index df31fab6bde..6f124d959cb 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -60,7 +60,7 @@ int bpy_pydriver_create_dict(void) else bpy_pydriver_Dict= d; - /* import some modules: builtins, bpy, math, (Blender.noise )*/ + /* import some modules: builtins, bpy, math, (Blender.noise)*/ PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins()); mod= PyImport_ImportModule("math"); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index e6f4c5713a1..089c9b37788 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -171,6 +171,8 @@ void BPY_context_set(bContext *C) /* defined in AUD_C-API.cpp */ extern PyObject *AUD_initPython(void); +/* defined in gpu_python.c */ +extern PyObject *GPU_initPython(void); static struct _inittab bpy_internal_modules[]= { {(char *)"noise", BPyInit_noise}, @@ -179,6 +181,7 @@ static struct _inittab bpy_internal_modules[]= { {(char *)"bgl", BPyInit_bgl}, {(char *)"blf", BPyInit_blf}, {(char *)"aud", AUD_initPython}, + {(char *)"gpu", GPU_initPython}, {NULL, NULL} }; diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 10e97573447..85bffb5a8cc 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -213,7 +213,7 @@ static PyObject *_bpy_names(BPy_Library *self, int blocktype) int counter= 0; list= PyList_New(totnames); for(l= names; l; l= l->next) { - PyList_SET_ITEM(list, counter, PyUnicode_FromString((char * )l->link)); + PyList_SET_ITEM(list, counter, PyUnicode_FromString((char *)l->link)); counter++; } BLI_linklist_free(names, free); /* free linklist *and* each node's data */ diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 0ee9d7e5bd5..352f7408961 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1156,7 +1156,7 @@ static struct PyModuleDef props_module= { NULL, NULL, NULL, NULL }; -PyObject *BPY_rna_props( void ) +PyObject *BPY_rna_props(void) { PyObject *submodule; PyObject *submodule_dict; diff --git a/source/blender/python/intern/bpy_props.h b/source/blender/python/intern/bpy_props.h index f306d6898d1..8b64d04e092 100644 --- a/source/blender/python/intern/bpy_props.h +++ b/source/blender/python/intern/bpy_props.h @@ -30,7 +30,7 @@ #ifndef BPY_PROPS_H #define BPY_PROPS_H -PyObject *BPY_rna_props( void ); +PyObject *BPY_rna_props(void); #define PYRNA_STACK_ARRAY 32 diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 72d391fed32..4fe13bc6818 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1200,7 +1200,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) return ret; } -PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) +PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) { PyObject *ret; int type= RNA_property_type(prop); @@ -1334,7 +1334,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha return error_val; } -static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw); +static PyObject *pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw); static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func) { diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index ea8af61c9bf..dbb5fc2feb7 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -148,18 +148,18 @@ typedef struct { StructRNA *srna_from_self(PyObject *self, const char *error_prefix); StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_prefix); -void BPY_rna_init( void ); -PyObject *BPY_rna_module( void ); -void BPY_update_rna_module( void ); -/*PyObject *BPY_rna_doc( void );*/ -PyObject *BPY_rna_types( void ); +void BPY_rna_init(void); +PyObject *BPY_rna_module(void); +void BPY_update_rna_module(void); +/*PyObject *BPY_rna_doc(void);*/ +PyObject *BPY_rna_types(void); -PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr ); -PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop ); +PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr); +PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop); /* operators also need this to set args */ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix); -PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop); +PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop); PyObject *pyrna_enum_bitfield_to_py(struct EnumPropertyItem *items, int value); int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix); From dbe1f07c765857b2dfcaa7860aafce4fe031794f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Jun 2011 08:45:28 +0000 Subject: [PATCH 014/105] fix [#27553] Weird resulsts when animating opacity on (color) strip --- source/blender/makesrna/intern/rna_sequencer.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 88ff5ebb628..4171189d928 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -588,11 +588,16 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA * } /* do_versions? */ -static float rna_Sequence_opacity_get(PointerRNA *ptr) { - return ((Sequence*)(ptr->data))->blend_opacity / 100.0f; +static float rna_Sequence_opacity_get(PointerRNA *ptr) +{ + Sequence *seq= (Sequence*)(ptr->data); + return seq->blend_opacity / 100.0f; } -static void rna_Sequence_opacity_set(PointerRNA *ptr, float value) { - ((Sequence*)(ptr->data))->blend_opacity = value * 100.0f; +static void rna_Sequence_opacity_set(PointerRNA *ptr, float value) +{ + Sequence *seq= (Sequence*)(ptr->data); + CLAMP(value, 0.0f, 1.0f); + seq->blend_opacity = value * 100.0f; } From ab2450a58d8ac4d4d9fd3534ac1843ffa7831ea0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Jun 2011 08:55:26 +0000 Subject: [PATCH 015/105] fix [#27557] Linked object (camera) should not be able to set position by using camera to view operator --- source/blender/editors/space_view3d/view3d_view.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 32e8ae81f90..0c4ab161e71 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -391,12 +391,15 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) static int view3d_setcameratoview_poll(bContext *C) { - View3D *v3d = CTX_wm_view3d(C); - RegionView3D *rv3d= CTX_wm_region_view3d(C); + View3D *v3d= CTX_wm_view3d(C); + if(v3d && v3d->camera && v3d->camera->id.lib==NULL) { + RegionView3D *rv3d= CTX_wm_region_view3d(C); + if(rv3d && !rv3d->viewlock) { + return 1; + } + } - if (v3d==NULL || v3d->camera==NULL) return 0; - if (rv3d && rv3d->viewlock != 0) return 0; - return 1; + return 0; } void VIEW3D_OT_setcameratoview(wmOperatorType *ot) From 1ba4550d2786bf5348d43a7285d37a66d53d461e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Jun 2011 09:04:07 +0000 Subject: [PATCH 016/105] committed this by mistake. --- source/blender/python/intern/bpy_interface.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 089c9b37788..e6f4c5713a1 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -171,8 +171,6 @@ void BPY_context_set(bContext *C) /* defined in AUD_C-API.cpp */ extern PyObject *AUD_initPython(void); -/* defined in gpu_python.c */ -extern PyObject *GPU_initPython(void); static struct _inittab bpy_internal_modules[]= { {(char *)"noise", BPyInit_noise}, @@ -181,7 +179,6 @@ static struct _inittab bpy_internal_modules[]= { {(char *)"bgl", BPyInit_bgl}, {(char *)"blf", BPyInit_blf}, {(char *)"aud", AUD_initPython}, - {(char *)"gpu", GPU_initPython}, {NULL, NULL} }; From b4872b84c87ee5c7feade2fe684cd5823bf4c078 Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Thu, 2 Jun 2011 12:44:59 +0000 Subject: [PATCH 017/105] fix for [#27410] Manual save kills actual .blend file if disk space is low - moved do_history into WM_write_file after successful write of .blend@ temporary file - Added new file flag, to avoid writing history on writing the startup.blend, autosave files and undo. Thanks Campbell, Brecht for review! --- source/blender/blenkernel/BKE_global.h | 1 + source/blender/blenkernel/intern/blender.c | 5 +- source/blender/blenloader/intern/writefile.c | 114 ++++++++++++------ .../blender/windowmanager/intern/wm_files.c | 36 +----- 4 files changed, 88 insertions(+), 68 deletions(-) diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 0360acbea32..d21b0428d76 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -145,6 +145,7 @@ typedef struct Global { #define G_FILE_IGNORE_DEPRECATION_WARNINGS (1 << 22) /* deprecated */ #define G_FILE_RECOVER (1 << 23) #define G_FILE_RELATIVE_REMAP (1 << 24) +#define G_FILE_HISTORY (1 << 25) /* G.windowstate */ #define G_WINDOWSTATE_USERDEF 0 diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 2fce1175fe1..b852629e49c 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -523,7 +523,8 @@ void BKE_write_undo(bContext *C, const char *name) static int counter= 0; char filepath[FILE_MAXDIR+FILE_MAXFILE]; char numstr[32]; - + int fileflags = G.fileflags & ~(G_FILE_HISTORY); /* don't do file history on undo */ + /* calculate current filepath */ counter++; counter= counter % U.undosteps; @@ -531,7 +532,7 @@ void BKE_write_undo(bContext *C, const char *name) BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); BLI_make_file_string("/", filepath, btempdir, numstr); - success= BLO_write_file(CTX_data_main(C), filepath, G.fileflags, NULL, NULL); + success= BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); BLI_strncpy(curundo->str, filepath, sizeof(curundo->str)); } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 17f54141252..240e8d00ab8 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2520,6 +2520,41 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil return endwrite(wd); } +/* do reverse file history: .blend1 -> .blend2, .blend -> .blend1 */ +/* return: success(0), failure(1) */ +static int do_history(const char *name, ReportList *reports) +{ + char tempname1[FILE_MAXDIR+FILE_MAXFILE], tempname2[FILE_MAXDIR+FILE_MAXFILE]; + int hisnr= U.versions; + + if(U.versions==0) return 0; + if(strlen(name)<2) { + BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short"); + return 1; + } + + while(hisnr > 1) { + BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1); + BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr); + + if(BLI_rename(tempname1, tempname2)) { + BKE_report(reports, RPT_ERROR, "Unable to make version backup"); + return 1; + } + hisnr--; + } + + /* is needed when hisnr==1 */ + BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr); + + if(BLI_rename(name, tempname1)) { + BKE_report(reports, RPT_ERROR, "Unable to make version backup"); + return 1; + } + + return 0; +} + /* return: success (1) */ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportList *reports, int *thumb) { @@ -2571,48 +2606,55 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb); close(file); - /* rename/compress */ - if(!err) { - if(write_flags & G_FILE_COMPRESS) { - /* compressed files have the same ending as regular files... only from 2.4!!! */ - char gzname[FILE_MAXDIR+FILE_MAXFILE+4]; - int ret; - - /* first write compressed to separate @.gz */ - BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath); - ret = BLI_gzip(tempname, gzname); - - if(0==ret) { - /* now rename to real file name, and delete temp @ file too */ - if(BLI_rename(gzname, filepath) != 0) { - BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @."); - return 0; - } - - BLI_delete(tempname, 0, 0); - } - else if(-1==ret) { - BKE_report(reports, RPT_ERROR, "Failed opening .gz file."); - return 0; - } - else if(-2==ret) { - BKE_report(reports, RPT_ERROR, "Failed opening .blend file for compression."); - return 0; - } - } - else if(BLI_rename(tempname, filepath) != 0) { - BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @"); - return 0; - } - - } - else { + if (err) { BKE_report(reports, RPT_ERROR, strerror(errno)); remove(tempname); return 0; } + /* file save to temporary file was successful */ + /* now do reverse file history (move .blend1 -> .blend2, .blend -> .blend1) */ + if (write_flags & G_FILE_HISTORY) { + int err_hist = do_history(filepath, reports); + if (err_hist) { + BKE_report(reports, RPT_ERROR, "Version backup failed. File saved with @"); + return 0; + } + } + + if(write_flags & G_FILE_COMPRESS) { + /* compressed files have the same ending as regular files... only from 2.4!!! */ + char gzname[FILE_MAXDIR+FILE_MAXFILE+4]; + int ret; + + /* first write compressed to separate @.gz */ + BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath); + ret = BLI_gzip(tempname, gzname); + + if(0==ret) { + /* now rename to real file name, and delete temp @ file too */ + if(BLI_rename(gzname, filepath) != 0) { + BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @."); + return 0; + } + + BLI_delete(tempname, 0, 0); + } + else if(-1==ret) { + BKE_report(reports, RPT_ERROR, "Failed opening .gz file."); + return 0; + } + else if(-2==ret) { + BKE_report(reports, RPT_ERROR, "Failed opening .blend file for compression."); + return 0; + } + } + else if(BLI_rename(tempname, filepath) != 0) { + BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @"); + return 0; + } + return 1; } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 1f005ba6021..a5ee01de2f1 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -620,31 +620,6 @@ static void write_history(void) } } -static void do_history(char *name, ReportList *reports) -{ - char tempname1[FILE_MAXDIR+FILE_MAXFILE], tempname2[FILE_MAXDIR+FILE_MAXFILE]; - int hisnr= U.versions; - - if(U.versions==0) return; - if(strlen(name)<2) return; - - while(hisnr > 1) { - BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1); - BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr); - - if(BLI_rename(tempname1, tempname2)) - BKE_report(reports, RPT_ERROR, "Unable to make version backup"); - - hisnr--; - } - - /* is needed when hisnr==1 */ - BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr); - - if(BLI_rename(name, tempname1)) - BKE_report(reports, RPT_ERROR, "Unable to make version backup"); -} - static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) { /* will be scaled down, but gives some nice oversampling */ @@ -693,9 +668,11 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) int write_crash_blend(void) { char path[FILE_MAX]; + int fileflags = G.fileflags & ~(G_FILE_HISTORY); /* don't do file history on crash file */ + BLI_strncpy(path, G.main->name, sizeof(path)); BLI_replace_extension(path, sizeof(path), "_crash.blend"); - if(BLO_write_file(G.main, path, G.fileflags, NULL, NULL)) { + if(BLO_write_file(G.main, path, fileflags, NULL, NULL)) { printf("written: %s\n", path); return 1; } @@ -753,8 +730,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re /* blend file thumbnail */ ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); - /* rename to .blend1, do this as last before write */ - do_history(filepath, reports); + fileflags |= G_FILE_HISTORY; /* write file history */ if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) { if(!copy) { @@ -809,7 +785,7 @@ int WM_write_homefile(bContext *C, wmOperator *op) printf("trying to save homefile at %s ", filepath); /* force save as regular blend file */ - fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN); + fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY); if(BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) { printf("fail\n"); @@ -883,7 +859,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w wm_autosave_location(filepath); /* force save as regular blend file */ - fileflags = G.fileflags & ~(G_FILE_COMPRESS|G_FILE_AUTOPLAY |G_FILE_LOCK|G_FILE_SIGN); + fileflags = G.fileflags & ~(G_FILE_COMPRESS|G_FILE_AUTOPLAY |G_FILE_LOCK|G_FILE_SIGN|G_FILE_HISTORY); /* no error reporting to console */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); From 7138fef58a9892c71c044a9c5d6761742c8ec095 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Jun 2011 14:18:51 +0000 Subject: [PATCH 018/105] UI: fix two issues with expanded enum property buttons: * they were too slow for dynamic python enums, calling the callback to list the items for each button, to get a tooltip * enum tooltips sometimes were showing the same description twice --- source/blender/editors/interface/interface.c | 24 ++----------------- .../editors/interface/interface_handlers.c | 2 +- .../editors/interface/interface_intern.h | 2 +- .../editors/interface/interface_regions.c | 21 ++++++++++++++++ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 3e65e707682..d139eafc09d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1668,7 +1668,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) return 0; } -void ui_set_but_default(bContext *C, uiBut *UNUSED(but), short all) +void ui_set_but_default(bContext *C, short all) { PointerRNA ptr; @@ -2481,28 +2481,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s icon= RNA_property_ui_icon(prop); } } - - if(!tip) { - if(type == ROW && proptype == PROP_ENUM) { - EnumPropertyItem *item; - int i, totitem, free; - - RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free); - - for(i=0; itype, DELKEY, PADPERIOD) && event->val == KM_PRESS) { /* ctrl+del - reset active button; del - reset a whole array*/ if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM))) - ui_set_but_default(C, but, !event->ctrl); + ui_set_but_default(C, !event->ctrl); } /* handle menu */ else if(event->type == RIGHTMOUSE && event->val == KM_PRESS) { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 6cca689d115..e95b544d0c0 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -369,7 +369,7 @@ extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen); extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str); extern int ui_get_but_string_max_length(uiBut *but); -extern void ui_set_but_default(struct bContext *C, uiBut *but, short all); +extern void ui_set_but_default(struct bContext *C, short all); extern void ui_set_but_soft_range(uiBut *but, double value); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 624f06db3c1..8b20406e036 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -370,6 +370,27 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->color[data->totline]= 0xFFFFFF; data->totline++; } + + if(but->type == ROW) { + EnumPropertyItem *item; + int i, totitem, free; + + RNA_property_enum_items(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free); + + for(i=0; ihardmax) { + if(item[i].description[0]) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); + data->color[data->totline]= 0xFFFFFF; + data->totline++; + } + break; + } + } + + if(free) + MEM_freeN(item); + } } if(but->tip && strlen(but->tip)) { From dd0522242ae6e8ba3ca5c56e82592539fb74a9e1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Jun 2011 15:21:47 +0000 Subject: [PATCH 019/105] addons now show expanded list again (since Brecht's commit now makes it fast) also add utility function for getting cleaned, unique names from python: bpy_extras.io_utils.unique_name(...) --- .../scripts/modules/bpy_extras/io_utils.py | 41 +++++++++++++++++++ .../scripts/startup/bl_ui/space_userpref.py | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index c444fd618a8..12c2d809132 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -29,6 +29,7 @@ __all__ = ( "path_reference", "path_reference_copy", "path_reference_mode", + "unique_name" ) import bpy @@ -298,3 +299,43 @@ def path_reference_copy(copy_set, report=print): os.makedirs(dir_to) shutil.copy(file_src, file_dst) + + +def unique_name(key, name, name_dict, name_max=-1, clean_func=None): + """ + Helper function for storing unique names which may have special characters + stripped and restricted to a maximum length. + + :arg key: unique item this name belongs to, name_dict[key] will be reused + when available. + This can be the object, mesh, material, etc instance its self. + :type key: any hashable object assosiated with the *name*. + :arg name: The name used to create a unique value in *name_dict*. + :type name: string + :arg name_dict: This is used to cache namespace to ensure no collisions + occur, this should be an empty dict initially and only modified by this + function. + :type name_dict: dict + :arg clean_func: Function to call on *name* before creating a unique value. + :type clean_func: function + """ + name_new = name_dict.get(key) + if name_new is None: + count = 1 + name_dict_values = name_dict.values() + name_new = name_new_orig = name if clean_func is None else clean_func(name) + + if name_max == -1: + while name_new in name_dict_values: + name_new = "%s.%03d" % (name_new_orig, count) + count += 1 + else: + name_new = name_new[:name_max] + while name_new in name_dict_values: + count_str = "%03d" % count + name_new = "%.*s.%s" % (name_max - (len(count_str) + 1), name_new_orig, count_str) + count += 1 + + name_dict[key] = name_new + + return name_new diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index e34755ae72e..f018785a925 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -890,7 +890,7 @@ class USERPREF_PT_addons(bpy.types.Panel): col = split.column() col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM') col.label(text="Categories") - col.prop(context.window_manager, "addon_filter", text="") # , expand=True, too slow with dynamic enum. + col.prop(context.window_manager, "addon_filter", expand=True) col.label(text="Supported Level") col.prop(context.window_manager, "addon_support", expand=True) From 32368aac43db134c7ec59fd5ec21d196a54b1598 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Jun 2011 16:59:12 +0000 Subject: [PATCH 020/105] Fix #27241: crash with point density texture when using particle age/velocity fallof for object vertices. --- .../blender/render/intern/source/pointdensity.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index d3d3e4d261c..b45528b96d9 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -362,10 +362,18 @@ static void accum_density(void *userdata, int index, float squared_dist) density = pdr->squared_radius; else if (pdr->falloff_type == TEX_PD_FALLOFF_ROOT) density = sqrt(dist); - else if (pdr->falloff_type == TEX_PD_FALLOFF_PARTICLE_AGE) - density = dist*MIN2(pdr->point_data[pdr->offset + index], 1.0f); - else if (pdr->falloff_type == TEX_PD_FALLOFF_PARTICLE_VEL) - density = dist*len_v3(pdr->point_data + index*3)*pdr->velscale; + else if (pdr->falloff_type == TEX_PD_FALLOFF_PARTICLE_AGE) { + if (pdr->point_data_used & POINT_DATA_LIFE) + density = dist*MIN2(pdr->point_data[pdr->offset + index], 1.0f); + else + density = dist; + } + else if (pdr->falloff_type == TEX_PD_FALLOFF_PARTICLE_VEL) { + if (pdr->point_data_used & POINT_DATA_VEL) + density = dist*len_v3(pdr->point_data + index*3)*pdr->velscale; + else + density = dist; + } if (pdr->density_curve && dist != 0.0f) { density = curvemapping_evaluateF(pdr->density_curve, 0, density/dist)*dist; From 83609edd51de4df72960527cea399482ea7a3eaf Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Jun 2011 17:34:01 +0000 Subject: [PATCH 021/105] Fix related to #27309: group nodes with a linked datablock that was missing would crash. --- source/blender/blenkernel/intern/node.c | 11 ++++++----- source/blender/blenloader/intern/readfile.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index ba2434bba23..3a8a2ae9c09 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -350,7 +350,7 @@ static bNodeType ntype_group; /* groups display their internal tree name as label */ static const char *group_label(bNode *node) { - return node->id->name+2; + return (node->id)? node->id->name+2: "Missing Datablock"; } void register_node_type_group(ListBase *lb) @@ -2072,11 +2072,12 @@ static int set_stack_indexes_group(bNode *node, int index) bNodeTree *ngroup= (bNodeTree*)node->id; bNodeSocket *sock; - if((ngroup->init & NTREE_TYPE_INIT)==0) + if(ngroup && (ngroup->init & NTREE_TYPE_INIT)==0) ntreeInitTypes(ngroup); node->stack_index = index; - index += ntree_begin_exec_tree(ngroup); + if(ngroup) + index += ntree_begin_exec_tree(ngroup); for (sock=node->inputs.first; sock; sock=sock->next) { if (sock->link && sock->link->fromsock) { @@ -2199,7 +2200,7 @@ static void composit_begin_exec(bNodeTree *ntree, bNodeStack *stack) if(node->type==CMP_NODE_CURVE_RGB) curvemapping_premultiply(node->storage, 0); } - if(node->type==NODE_GROUP) + if(node->type==NODE_GROUP && node->id) composit_begin_exec((bNodeTree *)node->id, stack + node->stack_index); } @@ -2225,7 +2226,7 @@ static void composit_end_exec(bNodeTree *ntree, bNodeStack *stack) if(node->type==CMP_NODE_CURVE_RGB) curvemapping_premultiply(node->storage, 1); - if(node->type==NODE_GROUP) + if(node->type==NODE_GROUP && node->id) composit_end_exec((bNodeTree *)node->id, stack + node->stack_index); node->need_exec= 0; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6188ee143b2..c15acb4f5ca 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2093,7 +2093,7 @@ static void lib_nodetree_do_versions_group(bNodeTree *ntree) for (node=ntree->nodes.first; node; node=node->next) { if (node->type==NODE_GROUP) { bNodeTree *ngroup= (bNodeTree*)node->id; - if (ngroup->flag & NTREE_DO_VERSIONS) + if (ngroup && (ngroup->flag & NTREE_DO_VERSIONS)) lib_node_do_versions_group(node); } } From 45093f50bc6aebc56953ebc597b3ab3fa160a221 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Jun 2011 23:10:05 +0000 Subject: [PATCH 022/105] Quiet warnings for picky compilers. --- source/blender/editors/uvedit/uvedit_parametrizer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index a9ee65b027b..dd7c336c98e 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -4140,7 +4140,7 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl) param_assert(phandle->state == PHANDLE_STATE_ALLOCATED); - phandle->ncharts = p_connect_pairs(phandle, impl); + phandle->ncharts = p_connect_pairs(phandle, (PBool)impl); phandle->charts = p_split_charts(phandle, chart, phandle->ncharts); p_chart_delete(phandle->construction_chart); @@ -4189,7 +4189,7 @@ void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf) for (i = 0; i < phandle->ncharts; i++) { for (f=phandle->charts[i]->faces; f; f=f->nextlink) p_face_backup_uvs(f); - p_chart_lscm_begin(phandle->charts[i], live, abf); + p_chart_lscm_begin(phandle->charts[i], (PBool)live, (PBool)abf); } } From 60f5b51484a2ab748fccca85b01b1a45be760912 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Thu, 2 Jun 2011 23:25:38 +0000 Subject: [PATCH 023/105] Fix for [#27562] audaspace not playing files in blenderplayer blenderplayer wasn't initialising ffmpeg This might also fix [#27558] GE Sound works in Blender but not in runtimes --- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 7a98c7e09b0..121f38eef02 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -71,6 +71,7 @@ extern "C" #include "BLO_runtime.h" #include "IMB_imbuf.h" #include "BKE_text.h" +#include "BKE_sound.h" int GHOST_HACK_getFirstFile(char buf[]); @@ -449,6 +450,8 @@ int main(int argc, char** argv) U.audioformat = 0x24; U.audiochannels = 2; + sound_init_once(); + /* if running blenderplayer the last argument can't be parsed since it has to be the filename. */ isBlenderPlayer = !BLO_is_a_runtime(argv[0]); if (isBlenderPlayer) From 5332c602c9f6c492e897779accc5e52496017809 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Jun 2011 03:19:22 +0000 Subject: [PATCH 024/105] pre-allocate the array when converting py/rna enums, also fix for memory leak with bad values. --- source/blender/python/intern/bpy_props.c | 32 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 352f7408961..99021ab5f18 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -644,7 +644,9 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const short is_enum_flag) { - EnumPropertyItem *items= NULL; +# define PREALLOC_ENUM + + EnumPropertyItem *items; PyObject *item; int seq_len, i, totitem= 0; short def_used= 0; @@ -681,18 +683,23 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i /* blank value */ *defvalue= 0; +#ifdef PREALLOC_ENUM + items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "RNA_enum_items_reserve"); +#endif + for(i=0; i Date: Fri, 3 Jun 2011 04:21:41 +0000 Subject: [PATCH 025/105] when making the C/RNA copy of the python enum, duplicate all strings since theres no guarantee python wont free them immediately after, though in practice this isn't so common. --- source/blender/python/intern/bpy_props.c | 108 ++++++++++++++--------- 1 file changed, 65 insertions(+), 43 deletions(-) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 99021ab5f18..9f55d0f1985 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -642,18 +642,27 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw Py_RETURN_NONE; } +/* copies orig to buf, then sets orig to buf, returns copy length */ +static size_t strswapbufcpy(char *buf, const char **orig) +{ + const char *src= *orig; + char *dst= buf; + size_t i= 0; + *orig= buf; + while((*dst= *src)) { dst++; src++; i++; } + return i + 1; /* include '\0' */ +} + static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const short is_enum_flag) { -# define PREALLOC_ENUM - EnumPropertyItem *items; PyObject *item; - int seq_len, i, totitem= 0; + const Py_ssize_t seq_len= PySequence_Fast_GET_SIZE(seq_fast); + Py_ssize_t totbuf= 0; + int i; short def_used= 0; const char *def_cmp= NULL; - seq_len= PySequence_Fast_GET_SIZE(seq_fast); - if(is_enum_flag) { if(seq_len > RNA_ENUM_BITFLAG_SIZE) { PyErr_SetString(PyExc_TypeError, "EnumProperty(...): maximum " STRINGIFY(RNA_ENUM_BITFLAG_SIZE) " members for a ENUM_FLAG type property"); @@ -683,55 +692,52 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i /* blank value */ *defvalue= 0; -#ifdef PREALLOC_ENUM - items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "RNA_enum_items_reserve"); -#endif + items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), "enum_items_from_py1"); for(i=0; iidentifier); + buf += strswapbufcpy(buf, &items_ptr->name); + buf += strswapbufcpy(buf, &items_ptr->description); + } + MEM_freeN(items); + items=items_dup; + } + /* end string duplication */ -# undef PREALLOC_ENUM + return items; } static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int *free) From 7ee9becfa32d0752c5d81cf4f21a94672b3391be Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Jun 2011 04:39:18 +0000 Subject: [PATCH 026/105] disable python/string enum duplication from last commit because the array of duplicated strings can be freed and the pointers to the strings referenced still, the problem with python freeing strings that RNA references remains. --- source/blender/python/intern/bpy_props.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 9f55d0f1985..4fef084f093 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -642,6 +642,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw Py_RETURN_NONE; } +#if 0 /* copies orig to buf, then sets orig to buf, returns copy length */ static size_t strswapbufcpy(char *buf, const char **orig) { @@ -652,6 +653,7 @@ static size_t strswapbufcpy(char *buf, const char **orig) while((*dst= *src)) { dst++; src++; i++; } return i + 1; /* include '\0' */ } +#endif static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const short is_enum_flag) { @@ -760,6 +762,10 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i } } + /* disabled duplicating strings because the array can still be freed and + * the strings from it referenced, for now we can't support dynamically + * created strings from python. */ +#if 0 /* this would all work perfectly _but_ the python strings may be freed * immediately after use, so we need to duplicate them, ugh. * annoying because it works most of the time without this. */ @@ -777,6 +783,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i items=items_dup; } /* end string duplication */ +#endif return items; } From 6480ab10db80b175e7f79b67bd47b1a9feffc8a6 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 3 Jun 2011 05:51:39 +0000 Subject: [PATCH 027/105] Fix for [#27461] Particle Instance modifier doesn't work correctly with Hair Dynamics. * Wrong matrix used for dynamic hair. --- source/blender/blenkernel/intern/particle.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index d0fee1d5bd5..f71e2e9a6e9 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4018,7 +4018,11 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * init_particle_interpolation(sim->ob, psys, pa, &pind); do_particle_interpolation(psys, p, pa, t, &pind, state); - if(!keyed && !cached) { + if(pind.dm) { + mul_m4_v3(sim->ob->obmat, state->co); + mul_mat3_m4_v3(sim->ob->obmat, state->vel); + } + else if(!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) { if((pa->flag & PARS_REKEY)==0) { psys_mat_hair_to_global(sim->ob, sim->psmd->dm, part->from, pa, hairmat); mul_m4_v3(hairmat, state->co); From ed072f2fef757cd46113b1216b46c40fbaa532f8 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 3 Jun 2011 07:53:55 +0000 Subject: [PATCH 028/105] BugFix: [#27556] Replace mesh for gfx in "Edit Object" actuator act illogically + other booleans that are flipped Now I think we are all good. We still have a few actuators that were using TOGN before but that I didn't make as negative_boolean. All fixed now: - parent actuator - edit object actuator - action actuator - shape actuator --- source/blender/makesrna/intern/rna_actuator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 116f5185980..c7cf511d5c7 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -584,7 +584,7 @@ static void rna_def_action_actuator(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "end_reset", 1); + RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1); RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1383,7 +1383,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_replace_display_mesh", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX); RNA_def_property_ui_text(prop, "Gfx", "Replace the display mesh"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1769,12 +1769,12 @@ static void rna_def_parent_actuator(BlenderRNA *brna) /* booleans */ prop= RNA_def_property(srna, "use_compound", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PARENT_COMPOUND); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_COMPOUND); RNA_def_property_ui_text(prop, "Compound", "Add this object shape to the parent shape (only if the parent shape is already compound)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PARENT_GHOST); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_GHOST); RNA_def_property_ui_text(prop, "Ghost", "Make this object ghost while parented"); RNA_def_property_update(prop, NC_LOGIC, NULL); } @@ -1816,7 +1816,7 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "end_reset", 1); + RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1); RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time"); RNA_def_property_update(prop, NC_LOGIC, NULL); From 06ca70373768826da6c98f5eb5631f817164e11d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 3 Jun 2011 20:44:23 +0000 Subject: [PATCH 029/105] BuildBot: various changes to support building branches. --- build_files/buildbot/master.cfg | 35 +++++++++++++++++---------- build_files/buildbot/master_unpack.py | 23 +++++++++++++++--- build_files/buildbot/slave_compile.py | 10 ++++---- build_files/buildbot/slave_pack.py | 10 +++++--- build_files/scons/tools/btools.py | 15 +++++++++--- 5 files changed, 66 insertions(+), 27 deletions(-) diff --git a/build_files/buildbot/master.cfg b/build_files/buildbot/master.cfg index 6913ed2dab0..b4d69a289ee 100644 --- a/build_files/buildbot/master.cfg +++ b/build_files/buildbot/master.cfg @@ -53,7 +53,7 @@ c['builders'] = [] buildernames = [] -def add_builder(c, name, libdir, factory): +def add_builder(c, name, libdir, factory, branch=''): slavenames = [] for slave in master_private.slaves: @@ -61,16 +61,18 @@ def add_builder(c, name, libdir, factory): slavenames.append(slave['name']) if len(slavenames) > 0: - f = factory(name, libdir) + f = factory(name, libdir, branch) c['builders'].append(BuilderConfig(name=name, slavenames=slavenames, factory=f, category='blender')) buildernames.append(name) # common steps -def svn_step(): - return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender') - +def svn_step(branch=''): + if branch: + return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/branches/%%BRANCH%%', mode='update', defaultBranch=branch, workdir='blender') + else: + return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender') def lib_svn_step(dir): return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir, mode='update', defaultBranch='trunk', workdir='lib/' + dir) @@ -78,7 +80,7 @@ def lib_svn_step(dir): # generic builder -def generic_builder(id, libdir=""): +def generic_builder(id, libdir='', branch=''): filename = 'buildbot_upload_' + id + '.zip' compile_script = '../blender/build_files/buildbot/slave_compile.py' test_script = '../blender/build_files/buildbot/slave_test.py' @@ -86,13 +88,13 @@ def generic_builder(id, libdir=""): unpack_script = 'master_unpack.py' f = BuildFactory() - f.addStep(svn_step()) + f.addStep(svn_step(branch)) if libdir != '': f.addStep(lib_svn_step(libdir)) f.addStep(Compile(command=['python', compile_script, id])) f.addStep(Test(command=['python', test_script, id])) - f.addStep(ShellCommand(name='package', command=['python', pack_script, id], description='packaging', descriptionDone='packaged')) + f.addStep(ShellCommand(name='package', command=['python', pack_script, id, branch], description='packaging', descriptionDone='packaged')) if id.find('cmake') != -1: f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024)) else: @@ -102,12 +104,19 @@ def generic_builder(id, libdir=""): # builders -add_builder(c, 'mac_x86_64_cmake', 'darwin-9.x.universal', generic_builder) -add_builder(c, 'mac_i386_cmake', 'darwin-9.x.universal', generic_builder) -add_builder(c, 'mac_ppc_cmake', 'darwin-9.x.universal', generic_builder) -add_builder(c, 'linux_x86_64_cmake', '', generic_builder) +add_builder(c, 'mac_x86_64_scons', 'darwin-9.x.universal', generic_builder) +add_builder(c, 'salad_mac_x86_64_scons', 'darwin-9.x.universal', generic_builder, 'soc-2011-salad') +add_builder(c, 'mac_i386_scons', 'darwin-9.x.universal', generic_builder) +add_builder(c, 'mac_ppc_scons', 'darwin-9.x.universal', generic_builder) +#add_builder(c, 'linux_x86_64_cmake', '', generic_builder) +add_builder(c, 'linux_i386_scons', '', generic_builder) +add_builder(c, 'salad_linux_i386_scons', '', generic_builder, 'soc-2011-salad') add_builder(c, 'linux_x86_64_scons', '', generic_builder) +add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad') add_builder(c, 'win32_scons', 'windows', generic_builder) +add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad') +#add_builder(c, 'freebsd_i386_cmake', '', generic_builder) +#add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder) # SCHEDULERS # @@ -149,7 +158,7 @@ authz_cfg = authz.Authz( pingBuilder=False, stopBuild=False, stopAllBuilds=False, - cancelPendingBuild=False, + cancelPendingBuild=True, ) c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg)) diff --git a/build_files/buildbot/master_unpack.py b/build_files/buildbot/master_unpack.py index 06c11b368b0..3e1dec726e5 100644 --- a/build_files/buildbot/master_unpack.py +++ b/build_files/buildbot/master_unpack.py @@ -43,6 +43,7 @@ def get_platform(filename): # platform out, but there may be some variations, so we fiddle a # bit to handle current and hopefully future names filename = strip_extension(filename) + filename = strip_extension(filename) tokens = filename.split("-") platforms = ('osx', 'mac', 'bsd', @@ -63,6 +64,21 @@ def get_platform(filename): return '-'.join(platform_tokens) +def get_branch(filename): + tokens = filename.split("-") + branch = "" + + for token in tokens: + if branch == "": + branch = token + else: + branch = branch + "-" + token + + if token == "blender": + return branch + + return "" + # get filename if len(sys.argv) < 2: sys.stderr.write("Not enough arguments, expecting file to unpack\n") @@ -88,8 +104,9 @@ if len(z.namelist()) != 1: package = z.namelist()[0] packagename = os.path.basename(package) -# detect platform +# detect platform and branch platform = get_platform(packagename) +branch = get_branch(packagename) if platform == '': sys.stderr.write('Failed to detect platform ' + @@ -113,10 +130,10 @@ except Exception, ex: sys.stderr.write('Failed to unzip package: %s\n' % str(ex)) sys.exit(1) -# remove other files from the same platform +# remove other files from the same platform and branch try: for f in os.listdir(directory): - if platform.lower() in f.lower(): + if get_platform(f) == platform and get_branch(f) == branch: if f != packagename: os.remove(os.path.join(directory, f)) except Exception, ex: diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index 2a1af0578a9..9980207cb0b 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -38,11 +38,11 @@ if builder.find('cmake') != -1: # set build options cmake_options = ['-DCMAKE_BUILD_TYPE:STRING=Release'] - if builder == 'mac_x86_64_cmake': + if builder.endswith('mac_x86_64_cmake'): cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64') - elif builder == 'mac_i386_cmake': + elif builder.endswith('mac_i386_cmake'): cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=i386') - elif builder == 'mac_ppc_cmake': + elif builder.endswith('mac_ppc_cmake'): cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=ppc') # configure and make @@ -75,10 +75,10 @@ else: config_dir = os.path.join(buildbot_dir, 'config') configs = [] - if builder == 'linux_x86_64_scons': + if builder.endswith('linux_x86_64_scons'): configs = ['user-config-player-x86_64.py', 'user-config-x86_64.py'] - elif builder == 'linux_i386_scons': + elif builder.endswith('linux_i386_scons'): configs = ['user-config-player-i686.py', 'user-config-i686.py'] diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py index 81402b3aca4..13578cbaaef 100644 --- a/build_files/buildbot/slave_pack.py +++ b/build_files/buildbot/slave_pack.py @@ -33,11 +33,15 @@ if len(sys.argv) < 2: sys.exit(1) builder = sys.argv[1] +branch = '' + +if len(sys.argv) >= 3: + branch = sys.argv[2] # scons does own packaging if builder.find('scons') != -1: os.chdir('../blender') - scons_options = ['BF_QUICK=slnt', 'buildslave'] + scons_options = ['BF_QUICK=slnt', 'BUILDBOT_BRANCH=' + branch, 'buildslave'] if builder.startswith('linux'): buildbot_dir = os.path.dirname(os.path.realpath(__file__)) @@ -52,9 +56,9 @@ if builder.find('scons') != -1: config = None - if builder == 'linux_x86_64_scons': + if builder.endswith('linux_x86_64_scons'): config = 'user-config-x86_64.py' - elif builder == 'linux_i386_scons': + elif builder.endswith('linux_i386_scons'): config = 'user-config-x86_64.py' if config is not None: diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 3131548aed2..a8bee920a9b 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -134,7 +134,8 @@ def validate_arguments(args, bc): 'BF_RAYOPTIMIZATION_SSE_FLAGS', 'BF_NO_ELBEEM', 'WITH_BF_CXX_GUARDEDALLOC', - 'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC' + 'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC', + 'BUILDBOT_BRANCH' ] # Have options here that scons expects to be lists @@ -501,7 +502,9 @@ def read_opts(env, cfg, args): (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)), ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''), - (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)) + (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)), + + ('BUILDBOT_BRANCH', 'Buildbot branch name', ''), ) # end of opts.AddOptions() return localopts @@ -546,7 +549,7 @@ def buildslave(target=None, source=None, env=None): Builder for buildbot integration. Used by buildslaves of http://builder.blender.org only. """ - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin'): extension = '.zip' else: extension = '.tar.bz2' @@ -560,9 +563,15 @@ def buildslave(target=None, source=None, env=None): platform = 'linux-glibc27-x86_64' elif bitness == '32bit': platform = 'linux-glibc27-i686' + if platform == 'darwin': + platform = 'OSX-' + env['MACOSX_ARCHITECTURE'] + + branch = env['BUILDBOT_BRANCH'] outdir = os.path.abspath(env['BF_INSTALLDIR']) package_name = 'blender-' + VERSION+'-'+REVISION + '-' + platform + if branch != '': + package_name = branch + '-' + package_name package_dir = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name) package_archive = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name + extension) From d84c6a3cdb60c4e31db75efc4c6f9a3ea9e9f034 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 3 Jun 2011 21:36:39 +0000 Subject: [PATCH 030/105] Fix for linux buildslaves. Now they should be able to compile branches. --- build_files/buildbot/slave_compile.py | 2 +- build_files/buildbot/slave_pack.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index 9980207cb0b..e74d889c243 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -57,7 +57,7 @@ else: scons_cmd = ['python', 'scons/scons.py'] scons_options = [] - if builder.startswith('linux'): + if builder.find('linux') != -1: import shutil # We're using the same rules as release builder, so tweak diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py index 13578cbaaef..cdc7cff3275 100644 --- a/build_files/buildbot/slave_pack.py +++ b/build_files/buildbot/slave_pack.py @@ -43,7 +43,7 @@ if builder.find('scons') != -1: os.chdir('../blender') scons_options = ['BF_QUICK=slnt', 'BUILDBOT_BRANCH=' + branch, 'buildslave'] - if builder.startswith('linux'): + if builder.find('linux') != -1: buildbot_dir = os.path.dirname(os.path.realpath(__file__)) config_dir = os.path.join(buildbot_dir, 'config') build_dir = os.path.join('..', 'build', builder) From 1915f1b1e250c515377149eedf58524533592ee6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 4 Jun 2011 03:07:56 +0000 Subject: [PATCH 031/105] quiet 2 compiler warnings and update man page --- doc/manpage/blender.1 | 21 ++++++++++----------- source/blender/imbuf/intern/targa.c | 2 +- source/blender/modifiers/intern/MOD_none.c | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1 index c27cc98f08b..ddf3a79b104 100644 --- a/doc/manpage/blender.1 +++ b/doc/manpage/blender.1 @@ -1,4 +1,4 @@ -.TH "BLENDER" "1" "April 05, 2011" "Blender Blender 2\&.56 (sub 6)" +.TH "BLENDER" "1" "June 03, 2011" "Blender Blender 2\&.57 (sub 1)" .SH NAME blender \- a 3D modelling and rendering package @@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business http://www.blender.org .SH OPTIONS -Blender 2.56 (sub 6) +Blender 2.57 (sub 1) Usage: blender [args ...] [file] [args ...] .br .SS "Render Options:" @@ -160,6 +160,12 @@ Force opening without borders Open with lower left corner at , and width and height as , .br +.TP +.B \-con or \-\-start\-console +.br +Start with the console window open (ignored if \-b is set) +.br + .IP .SS "Game Engine Specific Options:" @@ -191,7 +197,7 @@ Turn debugging on .br * Disables mouse grab (to interact with a debugger in some cases) .br -* Keeps python sys.stdin rather then setting it to None +* Keeps python sys.stdin rather than setting it to None .br .TP @@ -210,12 +216,6 @@ Skip reading the "startup.blend" in the users home directory .IP -.TP -.B \-\-env\-system\-config -.br -Set the BLENDER_SYSTEM_CONFIG environment variable -.br - .TP .B \-\-env\-system\-datafiles .br @@ -281,7 +281,7 @@ Print this help text and exit .TP .B \-y or \-\-enable\-autoexec .br -Enable automatic python script execution (default) +Enable automatic python script execution, (default) .br .TP @@ -376,7 +376,6 @@ Arguments are executed in the order they are given. eg .br .SH "ENVIRONMENT VARIABLES" \fIBLENDER_USER_CONFIG\fR Directory for user configuration files. - \fIBLENDER_SYSTEM_CONFIG\fR Directory for system wide configuration files. \fIBLENDER_USER_SCRIPTS\fR Directory for user scripts. \fIBLENDER_SYSTEM_SCRIPTS\fR Directory for system wide scripts. \fIBLENDER_USER_DATAFILES\fR Directory for user data files (icons, translations, ..). diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 5d9f350be48..ec00b15c079 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -586,7 +586,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) ibuf->depth = size; if (tga.mapbits != 32) { /* set alpha bits */ - cmap[0] &= BIG_LONG(0x00ffffff); + cmap[0] &= BIG_LONG(0x00ffffffl); } } diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index 489733c8480..48c5b9a4c08 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -57,7 +57,7 @@ ModifierTypeInfo modifierType_None = { /* name */ "None", /* structName */ "ModifierData", /* structSize */ sizeof(ModifierData), - /* type */ eModifierType_None, + /* type */ eModifierTypeType_None, /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_AcceptsCVs, From 86f2f425bffb373f7d938138ee5ad59356df2d51 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Sat, 4 Jun 2011 08:09:34 +0000 Subject: [PATCH 032/105] UI for texture space in mesh/curve/mball data properties http://pasteall.org/pic/show.php?id=13244 --- release/scripts/startup/bl_ui/properties_data_curve.py | 4 ++++ release/scripts/startup/bl_ui/properties_data_mesh.py | 5 ++++- release/scripts/startup/bl_ui/properties_data_metaball.py | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index 623daffac93..11a129377e8 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -116,6 +116,10 @@ class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel): col.label(text="Textures:") col.prop(curve, "use_uv_as_generated") col.prop(curve, "use_auto_texspace") + + row = layout.row() + row.column().prop(curve, "texspace_location") + row.column().prop(curve, "texspace_size") class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 7097988d25b..1f75b5059a5 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -110,7 +110,10 @@ class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel): layout.prop(mesh, "texture_mesh") layout.prop(mesh, "use_auto_texspace") - + + row = layout.row() + row.column().prop(mesh, "texspace_location") + row.column().prop(mesh, "texspace_size") class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel): bl_label = "Vertex Groups" diff --git a/release/scripts/startup/bl_ui/properties_data_metaball.py b/release/scripts/startup/bl_ui/properties_data_metaball.py index 81ba15d6f40..c568d10b3b0 100644 --- a/release/scripts/startup/bl_ui/properties_data_metaball.py +++ b/release/scripts/startup/bl_ui/properties_data_metaball.py @@ -70,6 +70,10 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel): layout.label(text="Update:") layout.prop(mball, "update_method", expand=True) + + row = layout.row() + row.column().prop(mball, "texspace_location") + row.column().prop(mball, "texspace_size") class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel): From c6f3fabd16ff5fb9a941fbb41d7d8f07c5be14ab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 4 Jun 2011 10:39:04 +0000 Subject: [PATCH 033/105] fix [#27568] Segmentation fault in Sequencer when adding an effect strip with python disallow negative length effect strips. --- source/blender/blenkernel/intern/seqeffects.c | 9 +++++++-- source/blender/blenkernel/intern/sequencer.c | 11 ++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index d2f05a8ca53..c19a74deff6 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -3021,10 +3021,15 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) /* if not already done, load / initialize data */ get_sequence_effect(seq); - if (!(force || seq->len != v->length || !v->frameMap)) { + if ( (force == FALSE) && + (seq->len == v->length) && + (v->frameMap != NULL) + ) { return; } - if (!seq->seq1) { /* make coverity happy and check for (CID 598) + if ( (seq->seq1 == NULL) || + (seq->len < 1) + ) { /* make coverity happy and check for (CID 598) input strip ... */ return; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 009665f3a1f..b94782f9a25 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -587,8 +587,17 @@ void calc_sequence(Scene *scene, Sequence *seq) if (seq->seq1) { seq->start= seq->startdisp= MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp); seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp); + /* we cant help if strips don't overlap, it wont give useful results. + * but at least ensure 'len' is never negative which causes bad bugs elsewhere. */ + if(seq->enddisp < seq->startdisp) { + /* simple start/end swap */ + seq->start= seq->enddisp; + seq->enddisp = seq->startdisp; + seq->startdisp= seq->start; + } seq->len= seq->enddisp - seq->startdisp; - } else { + } + else { calc_sequence_disp(scene, seq); } From a440679c57f6a309079a0253d557716044d78e6c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 4 Jun 2011 11:06:41 +0000 Subject: [PATCH 034/105] edits to make these cmake files compatible with my own basic cmake parser which checks for correctness in our files. --- source/blender/modifiers/CMakeLists.txt | 8 ++++++-- source/blender/windowmanager/CMakeLists.txt | 4 +++- source/blenderplayer/bad_level_call_stubs/CMakeLists.txt | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index cf66a27bda2..348e2a0ec1d 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -88,8 +88,12 @@ set(SRC if(WITH_MOD_BOOLEAN) add_definitions(-DWITH_MOD_BOOLEAN) - list(APPEND SRC intern/MOD_boolean_util.c) - list(APPEND INC ../../../intern/bsp/extern) + list(APPEND SRC + intern/MOD_boolean_util.c + ) + list(APPEND INC + ../../../intern/bsp/extern + ) endif() if(WITH_MOD_DECIMATE) diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 76ba298cd5f..6d125c01af4 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -115,7 +115,9 @@ endif() if(APPLE) if(NOT WITH_COCOA) - list(APPEND SRC intern/wm_apple.c) + list(APPEND SRC + intern/wm_apple.c + ) endif() endif() diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index 2cc6dbc8255..15c3b2a4743 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -46,7 +46,9 @@ set(SRC ) if(WITH_BUILDINFO) - list(APPEND SRC ../../creator/buildinfo.c) + list(APPEND SRC + ../../creator/buildinfo.c + ) add_definitions(-DBUILD_DATE) endif() From 4a59928484b93a6c3876c0c8b065f6d313640804 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 4 Jun 2011 14:12:55 +0000 Subject: [PATCH 035/105] CMake option 'WITH_HEADLESS' to build blender in headless mode (no x11/xlib) with NULL ghost classe. --- CMakeLists.txt | 27 ++++-- intern/ghost/CMakeLists.txt | 37 ++++++- .../ghost/intern/GHOST_DisplayManagerNULL.h | 51 ++++++++++ intern/ghost/intern/GHOST_ISystem.cpp | 8 +- intern/ghost/intern/GHOST_NDOFManager.cpp | 4 +- intern/ghost/intern/GHOST_SystemNULL.h | 93 ++++++++++++++++++ intern/ghost/intern/GHOST_WindowNULL.h | 96 +++++++++++++++++++ source/creator/CMakeLists.txt | 4 + source/creator/creator.c | 2 +- 9 files changed, 310 insertions(+), 12 deletions(-) create mode 100644 intern/ghost/intern/GHOST_DisplayManagerNULL.h create mode 100644 intern/ghost/intern/GHOST_SystemNULL.h create mode 100644 intern/ghost/intern/GHOST_WindowNULL.h diff --git a/CMakeLists.txt b/CMakeLists.txt index dae8a37e572..4f99136097c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,10 @@ option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effect option(WITH_BULLET "Enable Bullet (Physics Engine)" ON) option(WITH_GAMEENGINE "Enable Game Engine" ON) option(WITH_PLAYER "Build Player" OFF) + +option(WITH_HEADLESS "Build without graphical support (renderfarm, server mode only)" OFF) +mark_as_advanced(WITH_HEADLESS) + # (unix defaults to OpenMP On) if(UNIX AND NOT APPLE) option(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" ON) @@ -205,6 +209,11 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL) message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF") endif() +# may as well build python module without a UI +if(WITH_PYTHON_MODULE) + set(WITH_HEADLESS ON) +endif() + # remove old vars unset(WITH_INSTALL CACHE) @@ -409,15 +418,19 @@ if(UNIX AND NOT APPLE) unset(JEMALLOC) endif() - find_package(X11 REQUIRED) - find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH}) - mark_as_advanced(X11_XF86keysym_INCLUDE_PATH) - # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed - set(LLIBS "-lutil -lc -lm -lpthread -lstdc++ ${X11_X11_LIB}") + set(LLIBS "-lutil -lc -lm -lpthread -lstdc++") - if(WITH_X11_XINPUT) - list(APPEND LLIBS ${X11_Xinput_LIB}) + if(NOT WITH_HEADLESS) + find_package(X11 REQUIRED) + find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH}) + mark_as_advanced(X11_XF86keysym_INCLUDE_PATH) + + list(APPEND LLIBS ${X11_X11_LIB}) + + if(WITH_X11_XINPUT) + list(APPEND LLIBS ${X11_Xinput_LIB}) + endif() endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 065aa68dd3d..922f6918392 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -89,7 +89,42 @@ set(SRC intern/GHOST_WindowManager.h ) -if(APPLE) +if(WITH_HEADLESS) + list(APPEND SRC + intern/GHOST_DisplayManagerNULL.h + intern/GHOST_SystemNULL.h + intern/GHOST_WindowNULL.h + ) + add_definitions(-DWITH_HEADLESS) + + # ack, this is still system dependant + if(APPLE) + if(WITH_COCOA) + list(APPEND SRC + intern/GHOST_SystemPathsCocoa.mm + intern/GHOST_SystemPathsCocoa.h + ) + else() + list(APPEND SRC + intern/GHOST_SystemPathsCarbon.cpp + intern/GHOST_SystemPathsCarbon.h + ) + endif() + elseif(UNIX) + list(APPEND SRC + intern/GHOST_SystemPathsX11.cpp + intern/GHOST_SystemPathsX11.h + ) + elseif(WIN32) + + list(APPEND SRC + intern/GHOST_SystemPathsWin32.cpp + + intern/GHOST_SystemPathsWin32.h + ) + endif() + +elseif(APPLE) if(WITH_COCOA) list(APPEND SRC intern/GHOST_DisplayManagerCocoa.mm diff --git a/intern/ghost/intern/GHOST_DisplayManagerNULL.h b/intern/ghost/intern/GHOST_DisplayManagerNULL.h new file mode 100644 index 00000000000..e2902afd29b --- /dev/null +++ b/intern/ghost/intern/GHOST_DisplayManagerNULL.h @@ -0,0 +1,51 @@ +/* + * $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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file ghost/intern/GHOST_DisplayManagerNULL.h + * \ingroup GHOST + * Declaration of GHOST_DisplayManagerNULL class. + */ + +#ifndef _GHOST_DISPLAY_MANAGER_NULL_H_ +#define _GHOST_DISPLAY_MANAGER_NULL_H_ + +#include "GHOST_DisplayManager.h" +#include "GHOST_SystemNULL.h" + +class GHOST_SystemNULL; + +class GHOST_DisplayManagerNULL : public GHOST_DisplayManager +{ +public: + GHOST_DisplayManagerNULL( GHOST_SystemNULL *system ) : GHOST_DisplayManager(), m_system(system) { /* nop */ } + GHOST_TSuccess getNumDisplays( GHOST_TUns8& numDisplays ) const { return GHOST_kFailure; } + GHOST_TSuccess getNumDisplaySettings( GHOST_TUns8 display, GHOST_TInt32& numSettings ) const{ return GHOST_kFailure; } + GHOST_TSuccess getDisplaySetting( GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting ) const { return GHOST_kFailure; } + GHOST_TSuccess getCurrentDisplaySetting( GHOST_TUns8 display, GHOST_DisplaySetting& setting ) const { return getDisplaySetting(display,GHOST_TInt32(0),setting); } + GHOST_TSuccess setCurrentDisplaySetting( GHOST_TUns8 display, const GHOST_DisplaySetting& setting ){ return GHOST_kSuccess; } + +private : + GHOST_SystemNULL * m_system; +}; + +#endif /* _GHOST_DISPLAY_MANAGER_NULL_H_ */ diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp index 040164e2c40..7f170d2e876 100644 --- a/intern/ghost/intern/GHOST_ISystem.cpp +++ b/intern/ghost/intern/GHOST_ISystem.cpp @@ -41,7 +41,9 @@ #include "GHOST_ISystem.h" -#ifdef WIN32 +#ifdef WITH_HEADLESS +# include "GHOST_SystemNULL.h" +#elif defined(WIN32) # include "GHOST_SystemWin32.h" #else # ifdef __APPLE__ @@ -63,7 +65,9 @@ GHOST_TSuccess GHOST_ISystem::createSystem() { GHOST_TSuccess success; if (!m_system) { -#ifdef WIN32 +#ifdef WITH_HEADLESS + m_system = new GHOST_SystemNULL(); +#elif defined(WIN32) m_system = new GHOST_SystemWin32 (); #else # ifdef __APPLE__ diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp index 95626ec26ea..7721b1708f9 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.cpp +++ b/intern/ghost/intern/GHOST_NDOFManager.cpp @@ -81,7 +81,9 @@ GHOST_NDOFManager::deviceOpen(GHOST_IWindow* window, #if 0 printf("%i client \n", Pid); #endif - #if defined(_WIN32) || defined(__APPLE__) + #if defined(WITH_HEADLESS) + /* do nothing */ + #elif defined(_WIN32) || defined(__APPLE__) m_DeviceHandle = ndofDeviceOpen((void *)¤tNdofValues); #else GHOST_SystemX11 *sys; diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h new file mode 100644 index 00000000000..00277449ceb --- /dev/null +++ b/intern/ghost/intern/GHOST_SystemNULL.h @@ -0,0 +1,93 @@ +/* + * $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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file ghost/intern/GHOST_SystemNULL.h + * \ingroup GHOST + * Declaration of GHOST_SystemNULL class. + */ + +#ifndef _GHOST_SYSTEM_NULL_H_ +#define _GHOST_SYSTEM_NULL_H_ + +#include "GHOST_System.h" +#include "../GHOST_Types.h" +#include "GHOST_DisplayManagerNULL.h" +#include "GHOST_WindowNULL.h" + +class GHOST_WindowNULL; + +class GHOST_SystemNULL : public GHOST_System { +public: + + GHOST_SystemNULL( ) : GHOST_System() { /* nop */ } + ~GHOST_SystemNULL() { /* nop */ } + bool processEvents(bool waitForEvent) { return false; } + int toggleConsole(int action) { return 0; } + GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys& keys) const { return GHOST_kSuccess; } + GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const { return GHOST_kSuccess; } + GHOST_TUns8 *getClipboard(bool selection) const { return NULL; } + void putClipboard(GHOST_TInt8 *buffer, bool selection) const { /* nop */ } + GHOST_TUns64 getMilliSeconds( ) const { return 0; } + GHOST_TUns8 getNumDisplays( ) const { return GHOST_TUns8(1); } + GHOST_TSuccess getCursorPosition( GHOST_TInt32& x, GHOST_TInt32& y ) const { return GHOST_kFailure; } + GHOST_TSuccess setCursorPosition( GHOST_TInt32 x, GHOST_TInt32 y ) { return GHOST_kFailure; } + void getMainDisplayDimensions( GHOST_TUns32& width, GHOST_TUns32& height ) const { /* nop */ } + + GHOST_TSuccess init() { + GHOST_TSuccess success = GHOST_System::init(); + + if (success) { + m_displayManager = new GHOST_DisplayManagerNULL(this); + + if (m_displayManager) { + return GHOST_kSuccess; + } + } + + return GHOST_kFailure; + } + + GHOST_IWindow* createWindow( + const STR_String& title, + GHOST_TInt32 left, + GHOST_TInt32 top, + GHOST_TUns32 width, + GHOST_TUns32 height, + GHOST_TWindowState state, + GHOST_TDrawingContextType type, + bool stereoVisual, + const GHOST_TUns16 numOfAASamples, + const GHOST_TEmbedderWindowID parentWindow + ) { + return new GHOST_WindowNULL (this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1); + } +}; + +#endif + + + + + + + diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h new file mode 100644 index 00000000000..c0162f412c5 --- /dev/null +++ b/intern/ghost/intern/GHOST_WindowNULL.h @@ -0,0 +1,96 @@ +/* + * $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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file ghost/intern/GHOST_WindowNULL.h + * \ingroup GHOST + * Declaration of GHOST_WindowNULL class. + */ + +#ifndef _GHOST_WINDOWNULL_H_ +#define _GHOST_WINDOWNULL_H_ + +#include "GHOST_Window.h" + +#include + +class STR_String; +class GHOST_SystemNULL; + +class GHOST_WindowNULL : public GHOST_Window +{ +public: + const GHOST_TabletData* GetTabletData() { return NULL; } + + GHOST_WindowNULL( + GHOST_SystemNULL *system, + const STR_String& title, + GHOST_TInt32 left, + GHOST_TInt32 top, + GHOST_TUns32 width, + GHOST_TUns32 height, + GHOST_TWindowState state, + const GHOST_TEmbedderWindowID parentWindow, + GHOST_TDrawingContextType type, + const bool stereoVisual, + const GHOST_TUns16 numOfAASamples + ) : + GHOST_Window(title,left,top,width,height,state,type,stereoVisual,numOfAASamples), + m_system (system) + { + setTitle(title); + } + +protected: + GHOST_TSuccess installDrawingContext( GHOST_TDrawingContextType type ){ return GHOST_kSuccess; } + GHOST_TSuccess removeDrawingContext( ){ return GHOST_kSuccess; } + GHOST_TSuccess setWindowCursorGrab( GHOST_TGrabCursorMode mode ){ return GHOST_kSuccess; } + GHOST_TSuccess setWindowCursorShape( GHOST_TStandardCursor shape ){ return GHOST_kSuccess; } + GHOST_TSuccess setWindowCustomCursorShape( GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY ) { return GHOST_kSuccess; } + GHOST_TSuccess setWindowCustomCursorShape( GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color ){ return GHOST_kSuccess; } + + bool getValid( ) const { return true; } + void setTitle( const STR_String& title ){ /* nothing */ } + void getTitle( STR_String& title ) const { title= "untitled"; } + void getWindowBounds( GHOST_Rect& bounds ) const { getClientBounds(bounds); } + void getClientBounds( GHOST_Rect& bounds ) const { /* nothing */ } + GHOST_TSuccess setClientWidth( GHOST_TUns32 width ){ return GHOST_kFailure; } + GHOST_TSuccess setClientHeight( GHOST_TUns32 height ){ return GHOST_kFailure; } + GHOST_TSuccess setClientSize( GHOST_TUns32 width, GHOST_TUns32 height ){ return GHOST_kFailure; } + void screenToClient( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const { outX = inX; outY = inY; } + void clientToScreen( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const { outX = inX; outY = inY; } + GHOST_TSuccess swapBuffers( ){ return GHOST_kFailure; } + GHOST_TSuccess activateDrawingContext( ){ return GHOST_kFailure; } + ~GHOST_WindowNULL( ){ /* nothing */ } + GHOST_TSuccess setWindowCursorVisibility( bool visible ){ return GHOST_kSuccess; } + GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; } + GHOST_TWindowState getState() const { return GHOST_kWindowStateNormal; } + GHOST_TSuccess invalidate() { return GHOST_kSuccess; } + GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } + + +private : + GHOST_SystemNULL * m_system; +}; + + +#endif // _GHOST_WINDOWNULL_H_ diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index c3eae586599..db467eebb5c 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -81,6 +81,10 @@ if(WITH_PYTHON) endif() endif() +if(WITH_HEADLESS) + add_definitions(-DWITH_HEADLESS) +endif() + if(WITH_GAMEENGINE) blender_include_dirs(../gameengine/BlenderRoutines) diff --git a/source/creator/creator.c b/source/creator/creator.c index 6e9ecf234fc..fe9bd57d035 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1215,7 +1215,7 @@ int main(int argc, const char **argv) setuid(getuid()); /* end superuser */ #endif -#ifdef WITH_PYTHON_MODULE +#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS) G.background= 1; /* python module mode ALWAYS runs in background mode (for now) */ #else /* for all platforms, even windos has it! */ From 88676349a473020937ba5f2637535bf5960059c9 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 4 Jun 2011 17:03:46 +0000 Subject: [PATCH 036/105] Code holiday commit: - fix: user pref, window title was reset to 'Blender' on tab usage - Undo history menu back: - name "Undo History" - hotkey alt+ctrl+z (alt+apple+z for mac) - works like 2.4x, only for global undo, editmode and particle edit. - Menu scroll - for small windows or screens, popup menus now allow to display all items, using internal scrolling - works with a timer, scrolling 10 items per second when mouse is over the top or bottom arrow - if menu is too big to display, it now draws to top or bottom, based on largest available space. - also works for hotkey driven pop up menus. - User pref "DPI" follows widget/layout size - widgets & headers now become bigger and smaller, to match 'dpi' font sizes. Works well to match UI to monitor size. - note that icons can get fuzzy, we need better mipmaps for it --- release/scripts/startup/bl_ui/space_view3d.py | 6 + source/blender/blenkernel/BKE_blender.h | 1 + source/blender/blenkernel/intern/blender.c | 17 +- source/blender/editors/include/ED_particle.h | 3 +- source/blender/editors/include/ED_screen.h | 1 + source/blender/editors/include/ED_types.h | 4 - source/blender/editors/include/ED_util.h | 5 +- source/blender/editors/include/UI_interface.h | 9 +- source/blender/editors/interface/interface.c | 9 +- .../editors/interface/interface_handlers.c | 90 ++++++++- .../editors/interface/interface_icons.c | 5 +- .../editors/interface/interface_intern.h | 13 +- .../editors/interface/interface_panel.c | 9 +- .../editors/interface/interface_regions.c | 102 +++++++++-- .../editors/interface/interface_templates.c | 6 +- .../editors/interface/interface_widgets.c | 14 +- source/blender/editors/interface/resources.c | 2 + .../blender/editors/physics/particle_edit.c | 58 +++--- source/blender/editors/screen/area.c | 30 ++- source/blender/editors/screen/screen_edit.c | 19 +- source/blender/editors/screen/screen_ops.c | 14 +- .../editors/space_action/space_action.c | 1 + .../editors/space_buttons/buttons_header.c | 6 +- .../editors/space_script/script_header.c | 6 +- .../editors/space_sound/sound_header.c | 6 +- .../editors/space_view3d/view3d_header.c | 20 +- source/blender/editors/util/editmode_undo.c | 66 ++----- source/blender/editors/util/undo.c | 172 +++++++++++++++--- source/blender/editors/util/util_intern.h | 8 +- source/blender/makesdna/DNA_screen_types.h | 1 - source/blender/makesdna/DNA_userdef_types.h | 3 +- source/blender/makesrna/intern/rna_userdef.c | 9 +- .../blender/windowmanager/intern/wm_files.c | 7 +- .../windowmanager/intern/wm_operators.c | 24 +-- .../blender/windowmanager/intern/wm_window.c | 6 +- 35 files changed, 537 insertions(+), 215 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 0583dc7e4be..02004283264 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -685,6 +685,7 @@ class VIEW3D_MT_object(bpy.types.Menu): layout.operator("ed.undo") layout.operator("ed.redo") + layout.operator("ed.undo_history") layout.separator() @@ -1049,6 +1050,7 @@ class VIEW3D_MT_paint_weight(bpy.types.Menu): layout.operator("ed.undo") layout.operator("ed.redo") + layout.operator("ed.undo_history") layout.separator() @@ -1129,6 +1131,7 @@ class VIEW3D_MT_particle(bpy.types.Menu): layout.operator("ed.undo") layout.operator("ed.redo") + layout.operator("ed.undo_history") layout.separator() @@ -1182,6 +1185,7 @@ class VIEW3D_MT_pose(bpy.types.Menu): layout.operator("ed.undo") layout.operator("ed.redo") + layout.operator("ed.undo_history") layout.separator() @@ -1373,6 +1377,7 @@ class VIEW3D_MT_edit_mesh(bpy.types.Menu): layout.operator("ed.undo") layout.operator("ed.redo") + layout.operator("ed.undo_history") layout.separator() @@ -1844,6 +1849,7 @@ class VIEW3D_MT_edit_meta(bpy.types.Menu): layout.operator("ed.undo") layout.operator("ed.redo") + layout.operator("ed.undo_history") layout.separator() diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index a45e9a17dc9..07f0885372a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -89,6 +89,7 @@ extern int BKE_undo_valid(const char *name); extern void BKE_reset_undo(void); extern char *BKE_undo_menu_string(void); extern void BKE_undo_number(struct bContext *C, int nr); +extern char *BKE_undo_get_name(int nr, int *active); extern void BKE_undo_save_quit(void); extern struct Main *BKE_undo_get_main(struct Scene **scene); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index b852629e49c..20b44b3b899 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -620,7 +620,7 @@ void BKE_reset_undo(void) /* based on index nr it does a restore */ void BKE_undo_number(bContext *C, int nr) { - curundo= BLI_findlink(&undobase, nr - 1); + curundo= BLI_findlink(&undobase, nr); BKE_undo_step(C, 0); } @@ -646,6 +646,21 @@ int BKE_undo_valid(const char *name) return undobase.last != undobase.first; } +/* get name of undo item, return null if no item with this index */ +/* if active pointer, set it to 1 if true */ +char *BKE_undo_get_name(int nr, int *active) +{ + UndoElem *uel= BLI_findlink(&undobase, nr); + + if(active) *active= 0; + + if(uel) { + if(active && uel==curundo) + *active= 1; + return uel->name; + } + return NULL; +} char *BKE_undo_menu_string(void) { diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 23997e06aef..f2973d0d070 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -71,8 +71,9 @@ void PE_undo_push(struct Scene *scene, const char *str); void PE_undo_step(struct Scene *scene, int step); void PE_undo(struct Scene *scene); void PE_redo(struct Scene *scene); -void PE_undo_menu(struct Scene *scene, struct Object *ob); int PE_undo_valid(struct Scene *scene); +void PE_undo_number(struct Scene *scene, int nr); +char *PE_undo_get_name(struct Scene *scene, int nr, int *active); #endif /* ED_PARTICLE_H */ diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 93ce82fa483..6e396a1021b 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -90,6 +90,7 @@ void ED_area_headerprint(ScrArea *sa, const char *str); void ED_area_newspace(struct bContext *C, ScrArea *sa, int type); void ED_area_prevspace(struct bContext *C, ScrArea *sa); void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2); +int ED_area_headersize(void); /* screens */ void ED_screens_initialize(struct wmWindowManager *wm); diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 0218b8d9c2d..c1c31372011 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -40,10 +40,6 @@ #define SELECT 1 #define ACTIVE 2 -/* buttons */ -#define XIC 20 -#define YIC 20 - /* proposal = put scene pointers on function calls? */ // #define BASACT (scene->basact) // #define OBACT (BASACT? BASACT->object: NULL) diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 50dd2308b6b..5e004fd8d47 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -59,6 +59,7 @@ void ED_undo_redo (struct bContext *C); void ED_OT_undo (struct wmOperatorType *ot); void ED_OT_undo_push (struct wmOperatorType *ot); void ED_OT_redo (struct wmOperatorType *ot); +void ED_OT_undo_history (struct wmOperatorType *ot); int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); /* convenience since UI callbacks use this mostly*/ @@ -76,11 +77,7 @@ void undo_editmode_push(struct bContext *C, const char *name, int (*validate_undo)(void *, void *)); -void *undo_editmode_get_prev (struct Object *ob); -struct uiBlock *editmode_undohistorymenu(struct bContext *C, struct ARegion *ar, void *arg_unused); -void undo_editmode_menu (struct bContext *C); void undo_editmode_clear (void); -void undo_editmode_step (struct bContext *C, int step); /* crazyspace.c */ float *crazyspace_get_mapped_editverts(struct Scene *scene, struct Object *obedit); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index d6988aa9618..1a26079800c 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -35,6 +35,7 @@ #define UI_INTERFACE_H #include "RNA_types.h" +#include "DNA_userdef_types.h" /* Struct Declarations */ @@ -100,8 +101,8 @@ typedef struct uiLayout uiLayout; #define UI_BLOCK_RET_1 4 /* XXX 2.5 not implemented */ #define UI_BLOCK_NUMSELECT 8 /*#define UI_BLOCK_ENTER_OK 16*/ /*UNUSED*/ -/*#define UI_BLOCK_NOSHADOW 32*/ /*UNUSED*/ -/*#define UI_BLOCK_UNUSED 64*/ /*UNUSED*/ +#define UI_BLOCK_CLIPBOTTOM 32 +#define UI_BLOCK_CLIPTOP 64 #define UI_BLOCK_MOVEMOUSE_QUIT 128 #define UI_BLOCK_KEEP_OPEN 256 #define UI_BLOCK_POPUP 512 @@ -622,8 +623,8 @@ void UI_exit(void); #define UI_LAYOUT_MENU 2 #define UI_LAYOUT_TOOLBAR 3 -#define UI_UNIT_X 20 -#define UI_UNIT_Y 20 +#define UI_UNIT_X U.widget_unit +#define UI_UNIT_Y U.widget_unit #define UI_LAYOUT_ALIGN_EXPAND 0 #define UI_LAYOUT_ALIGN_LEFT 1 diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index d139eafc09d..c431af9fd8e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -892,13 +892,14 @@ void uiDrawBlock(const bContext *C, uiBlock *block) /* widgets */ for(but= block->buttons.first; but; but= but->next) { - ui_but_to_pixelrect(&rect, ar, block, but); + if(!(but->flag & (UI_HIDDEN|UI_SCROLLED))) { + ui_but_to_pixelrect(&rect, ar, block, but); - if(!(but->flag & UI_HIDDEN) && /* XXX: figure out why invalid coordinates happen when closing render window */ /* and material preview is redrawn in main window (temp fix for bug #23848) */ - rect.xmin < rect.xmax && rect.ymin < rect.ymax) - ui_draw_but(C, ar, &style, but, &rect); + if(rect.xmin < rect.xmax && rect.ymin < rect.ymax) + ui_draw_but(C, ar, &style, but, &rect); + } } /* restore matrix */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 531c9dbf799..99a31e039c8 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -81,6 +81,7 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to); #define BUTTON_TOOLTIP_DELAY 0.500 #define BUTTON_FLASH_DELAY 0.020 +#define MENU_SCROLL_INTERVAL 0.1 #define BUTTON_AUTO_OPEN_THRESH 0.3 #define BUTTON_MOUSE_TOWARDS_THRESH 1.0 @@ -4743,6 +4744,8 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) continue; if(but->flag & UI_HIDDEN) continue; + if(but->flag & UI_SCROLLED) + continue; if(ui_but_contains_pt(but, mx, my)) butover= but; } @@ -5572,6 +5575,76 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men return menu->dotowards; } +static char ui_menu_scroll_test(uiBlock *block, int my) +{ + if(block->flag & (UI_BLOCK_CLIPTOP|UI_BLOCK_CLIPBOTTOM)) { + if(block->flag & UI_BLOCK_CLIPTOP) + if(my > block->maxy-14) + return 't'; + if(block->flag & UI_BLOCK_CLIPBOTTOM) + if(my < block->miny+14) + return 'b'; + } + return 0; +} + +static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my) +{ + char test= ui_menu_scroll_test(block, my); + + if(test) { + uiBut *b1= block->buttons.first; + uiBut *b2= block->buttons.last; + uiBut *bnext; + uiBut *bprev; + int dy= 0; + + /* get first and last visible buttons */ + while(b1 && ui_but_next(b1) && (b1->flag & UI_SCROLLED)) + b1= ui_but_next(b1); + while(b2 && ui_but_prev(b2) && (b2->flag & UI_SCROLLED)) + b2= ui_but_prev(b2); + /* skips separators */ + bnext= ui_but_next(b1); + bprev= ui_but_prev(b2); + + if(bnext==NULL || bprev==NULL) + return 0; + + if(test=='t') { + /* bottom button is first button */ + if(b1->y1 < b2->y1) + dy= bnext->y1 - b1->y1; + /* bottom button is last button */ + else + dy= bprev->y1 - b2->y1; + } + else if(test=='b') { + /* bottom button is first button */ + if(b1->y1 < b2->y1) + dy= b1->y1 - bnext->y1; + /* bottom button is last button */ + else + dy= b2->y1 - bprev->y1; + } + if(dy) { + + for(b1= block->buttons.first; b1; b1= b1->next) { + b1->y1 -= dy; + b1->y2 -= dy; + } + /* set flags again */ + ui_popup_block_scrolltest(block); + + ED_region_tag_redraw(ar); + + return 1; + } + } + + return 0; +} + static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu)) { ARegion *ar; @@ -5603,11 +5676,22 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle * and don't handle events */ ui_mouse_motion_towards_init(menu, mx, my, 1); } - else if(event->type != TIMER) { + else if(event->type == TIMER) { + if(event->customdata == menu->scrolltimer) + ui_menu_scroll(ar, block, my); + } + else { /* for ui_mouse_motion_towards_block */ - if(event->type == MOUSEMOVE) + if(event->type == MOUSEMOVE) { ui_mouse_motion_towards_init(menu, mx, my, 0); - + + /* add menu scroll timer, if needed */ + if(ui_menu_scroll_test(block, my)) + if(menu->scrolltimer==NULL) + menu->scrolltimer= + WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL); + } + /* first block own event func */ if(block->block_event_func && block->block_event_func(C, block, event)); /* events not for active search menu button */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 037cc22f879..b92097d124b 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -945,6 +945,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al Icon *icon = NULL; DrawInfo *di = NULL; IconImage *iimg; + float fdraw_size= UI_DPI_FAC*draw_size; int w, h; icon = BKE_icon_get(icon_id); @@ -965,8 +966,8 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al } /* scale width and height according to aspect */ - w = (int)(draw_size/aspect + 0.5f); - h = (int)(draw_size/aspect + 0.5f); + w = (int)(fdraw_size/aspect + 0.5f); + h = (int)(fdraw_size/aspect + 0.5f); if(di->type == ICON_TYPE_VECTOR) { /* vector icons use the uiBlock transformation, they are not drawn diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index e95b544d0c0..d185e839fdd 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -45,6 +45,7 @@ struct uiHandleButtonData; struct wmEvent; struct wmOperatorType; struct wmWindow; +struct wmTimer; struct uiStyle; struct uiWidgetColors; struct uiLayout; @@ -107,8 +108,8 @@ typedef enum { #define UI_PANEL_MINY 70 /* uiBut->flag */ -#define UI_SELECT 1 /* use when the button is pressed */ -/*#define UI_MOUSE_OVER 2*/ /*UNUSED, free flag*/ +#define UI_SELECT 1 /* use when the button is pressed */ +#define UI_SCROLLED 2 /* temp hidden, scrolled away */ #define UI_ACTIVE 4 #define UI_HAS_ICON 8 #define UI_TEXTINPUT 16 @@ -395,6 +396,8 @@ struct uiPopupBlockHandle { void (*popup_func)(struct bContext *C, void *arg, int event); void (*cancel_func)(void *arg); void *popup_arg; + + struct wmTimer *scrolltimer; /* for operator popups */ struct wmOperatorType *optype; @@ -416,9 +419,11 @@ void ui_block_func_ICONTEXTROW(struct bContext *C, uiLayout *layout, void *arg_b struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but); void ui_tooltip_free(struct bContext *C, struct ARegion *ar); -uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but); +uiBut *ui_popup_menu_memory(struct uiBlock *block, struct uiBut *but); + +float *ui_block_hsv_get(struct uiBlock *block); +void ui_popup_block_scrolltest(struct uiBlock *block); -float *ui_block_hsv_get(uiBlock *block); /* searchbox for string button */ ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 6677f2b1bae..42017f749be 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -334,10 +334,13 @@ static void uiPanelPop(uiBlock *UNUSED(block)) void UI_DrawTriIcon(float x, float y, char dir) { if(dir=='h') { - ui_draw_anti_tria( x-3,y-5, x-3,y+5, x+7,y ); + ui_draw_anti_tria( x-3, y-5, x-3, y+5, x+7,y ); } - else { - ui_draw_anti_tria( x-5,y+3, x+5,y+3, x,y-7); + else if(dir=='t') { + ui_draw_anti_tria( x-5, y-7, x+5, y-7, x, y+3); + } + else { /* 'v' = vertical, down */ + ui_draw_anti_tria( x-5, y+3, x+5, y+3, x, y-7); } } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 8b20406e036..623651083d2 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -67,7 +67,6 @@ #include "interface_intern.h" -#define MENU_BUTTON_HEIGHT 20 #define MENU_SEPR_HEIGHT 6 #define B_NOP -1 #define MENU_SHADOW_SIDE 8 @@ -675,7 +674,7 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int icon int uiSearchBoxhHeight(void) { - return SEARCH_ITEMS*MENU_BUTTON_HEIGHT + 2*MENU_TOP; + return SEARCH_ITEMS*UI_UNIT_Y + 2*MENU_TOP; } /* ar is the search box itself */ @@ -972,8 +971,6 @@ static void ui_searchbox_region_free_cb(ARegion *ar) ar->regiondata= NULL; } -static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, uiBlock *block); - ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) { uiStyle *style= U.uistyles.first; // XXX pass on as arg @@ -1229,18 +1226,26 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, if(but) { int left=0, right=0, top=0, down=0; int winx, winy; - int offscreen; + // int offscreen; wm_window_get_size(window, &winx, &winy); if(block->direction & UI_CENTER) center= ysize/2; else center= 0; - + + /* check if there's space at all */ if( butrct.xmin-xsize > 0.0f) left= 1; if( butrct.xmax+xsize < winx) right= 1; if( butrct.ymin-ysize+center > 0.0f) down= 1; if( butrct.ymax+ysize-center < winy) top= 1; + if(top==0 && down==0) { + if (butrct.ymin-ysize < winy-butrct.ymax-ysize) + top= 1; + else + down= 1; + } + dir1= block->direction & UI_DIRECTION; /* secundary directions */ @@ -1305,7 +1310,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, if(top==0 && down==0) { if(dir1==UI_LEFT || dir1==UI_RIGHT) { // align with bottom of screen - yof= ysize; + // yof= ysize; (not with menu scrolls) } } @@ -1320,15 +1325,16 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, // apply requested offset in the block xof += block->xofs/block->aspect; yof += block->yofs/block->aspect; - +#if 0 /* clamp to window bounds, could be made into an option if its ever annoying */ if( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */ else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */ if( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */ else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */ +#endif } - /* apply */ + /* apply offset, buttons in window coords */ for(bt= block->buttons.first; bt; bt= bt->next) { ui_block_to_window_fl(butregion, but->block, &bt->x1, &bt->y1); @@ -1402,6 +1408,62 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar) uiDrawBlock(C, block); } +static void ui_popup_block_clip(wmWindow *window, uiBlock *block) +{ + int winx, winy; + + wm_window_get_size(window, &winx, &winy); + + if(block->minx < MENU_SHADOW_SIDE) + block->minx= MENU_SHADOW_SIDE; + if(block->maxx > winx-MENU_SHADOW_SIDE) + block->maxx= winx-MENU_SHADOW_SIDE; + + if(block->miny < MENU_SHADOW_BOTTOM) + block->miny= MENU_SHADOW_BOTTOM; + if(block->maxy > winy-MENU_TOP) + block->maxy= winy-MENU_TOP; +} + +void ui_popup_block_scrolltest(uiBlock *block) +{ + uiBut *bt; + + block->flag &= ~(UI_BLOCK_CLIPBOTTOM|UI_BLOCK_CLIPTOP); + + for(bt= block->buttons.first; bt; bt= bt->next) + bt->flag &= ~UI_SCROLLED; + + if(block->buttons.first==block->buttons.last) + return; + + /* mark buttons that are outside boundary and the ones next to it for arrow(s) */ + for(bt= block->buttons.first; bt; bt= bt->next) { + if(bt->y1 < block->miny) { + bt->flag |= UI_SCROLLED; + block->flag |= UI_BLOCK_CLIPBOTTOM; + /* make space for arrow */ + if(bt->y2 < block->miny +10) { + if(bt->next && bt->next->y1 > bt->y1) + bt->next->flag |= UI_SCROLLED; + if(bt->prev && bt->prev->y1 > bt->y1) + bt->prev->flag |= UI_SCROLLED; + } + } + if(bt->y2 > block->maxy) { + bt->flag |= UI_SCROLLED; + block->flag |= UI_BLOCK_CLIPTOP; + /* make space for arrow */ + if(bt->y1 > block->maxy -10) { + if(bt->next && bt->next->y2 < bt->y2) + bt->next->flag |= UI_SCROLLED; + if(bt->prev && bt->prev->y2 < bt->y2) + bt->prev->flag |= UI_SCROLLED; + } + } + } +} + uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg) { wmWindow *window= CTX_wm_window(C); @@ -1472,6 +1534,9 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut block->flag |= UI_BLOCK_POPUP|UI_BLOCK_NUMSELECT; } + /* clip block with window boundary */ + ui_popup_block_clip(window, block); + /* the block and buttons were positioned in window space as in 2.4x, now * these menu blocks are regions so we bring it back to region space. * additionally we add some padding for the menu shadow or rounded menus */ @@ -1479,7 +1544,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut ar->winrct.xmax= block->maxx + MENU_SHADOW_SIDE; ar->winrct.ymin= block->miny - MENU_SHADOW_BOTTOM; ar->winrct.ymax= block->maxy + MENU_TOP; - + block->minx -= ar->winrct.xmin; block->maxx -= ar->winrct.xmin; block->miny -= ar->winrct.ymin; @@ -1491,12 +1556,15 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut bt->y1 -= ar->winrct.ymin; bt->y2 -= ar->winrct.ymin; } - + block->flag |= UI_BLOCK_LOOP; /* adds subwindow */ ED_region_init(C, ar); + /* checks which buttons are visible, sets flags to prevent draw (do after region init) */ + ui_popup_block_scrolltest(block); + /* get winmat now that we actually have the subwindow */ wmSubWindowSet(window, ar->swinid); @@ -1511,6 +1579,10 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle) { ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region); + + if(handle->scrolltimer) + WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), handle->scrolltimer); + MEM_freeN(handle); } @@ -2171,7 +2243,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi the offset is negative because we are inverse moving the block to be under the mouse */ offset[0]= -(bt->x1 + 0.8f*(bt->x2 - bt->x1)); - offset[1]= -(bt->y1 + 0.5f*MENU_BUTTON_HEIGHT); + offset[1]= -(bt->y1 + 0.5f*UI_UNIT_Y); } else { /* position mouse at 0.8*width of the button and below the tile @@ -2180,7 +2252,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi for(bt=block->buttons.first; bt; bt=bt->next) offset[0]= MIN2(offset[0], -(bt->x1 + 0.8f*(bt->x2 - bt->x1))); - offset[1]= 1.5*MENU_BUTTON_HEIGHT; + offset[1]= 1.5*UI_UNIT_Y; } block->minbounds= minwidth; @@ -2284,10 +2356,10 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) if(icon) { sprintf(titlestr, " %s", title); - uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } else { - but= uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, ""); + but= uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->flag= UI_TEXT_LEFT; } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 69e3a1792c6..37c8c43e107 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -751,7 +751,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif if ((ob->type==OB_MESH) && modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) { /* -- convert to rna ? */ - but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, 16, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode"); + but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode"); if (index < cageIndex) uiButSetFlag(but, UI_BUT_DISABLED); uiButSetFunc(but, modifiers_setOnCage, ob, md); @@ -763,7 +763,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { /* add disabled pre-tesselated button, so users could have message for this modifiers */ - but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, 16, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "This modifier could be applied on splines' points only"); + but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "This modifier could be applied on splines' points only"); uiButSetFlag(but, UI_BUT_DISABLED); } else if (mti->type != eModifierTypeType_Constructive) { /* constructive modifiers tesselates curve before applying */ @@ -1993,7 +1993,7 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, else if(used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer)) icon = ICON_LAYER_USED; - but= uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, 10, 10); + but= uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X/2, UI_UNIT_Y/2); uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer)); but->type= TOG; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 58ed1e31b81..f767a432cd0 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -771,7 +771,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect) /* icons have been standardized... and this call draws in untransformed coordinates */ -#define ICON_HEIGHT 16.0f +#define ICON_HEIGHT UI_DPI_FAC*16.0f static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect) { @@ -3081,6 +3081,18 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) else wt->draw(&wt->wcol, rect, 0, 0); + if(block) { + if(block->flag & UI_BLOCK_CLIPTOP) { + /* XXX no scaling for UI here yet */ + glColor3ubv((unsigned char*)wt->wcol.text); + UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymax-8, 't'); + } + if(block->flag & UI_BLOCK_CLIPBOTTOM) { + /* XXX no scaling for UI here yet */ + glColor3ubv((unsigned char*)wt->wcol.text); + UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymin+10, 'v'); + } + } } void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 1a2a2906f1a..6d4d88da270 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1578,6 +1578,8 @@ void init_userdef_do_versions(void) } if (U.dragthreshold == 0 ) U.dragthreshold= 5; + if (U.widget_unit==0) + U.widget_unit= (U.dpi * 20 + 36)/72; /* funny name, but it is GE stuff, moves userdef stuff to engine */ // XXX space_set_commmandline_options(); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index c5ab840914e..6155929243b 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3970,18 +3970,6 @@ int PE_undo_valid(Scene *scene) return 0; } -static void PTCacheUndo_number(Scene *scene, PTCacheEdit *edit, int nr) -{ - PTCacheUndo *undo; - int a=1; - - for(undo= edit->undo.first; undo; undo= undo->next, a++) { - if(a==nr) break; - } - edit->curundo= undo; - PE_undo_step(scene, 0); -} - static void PTCacheUndo_clear(PTCacheEdit *edit) { PTCacheUndo *undo; @@ -4007,32 +3995,38 @@ void PE_redo(Scene *scene) PE_undo_step(scene, -1); } -void PE_undo_menu(Scene *scene, Object *ob) +void PE_undo_number(Scene *scene, int nr) { - PTCacheEdit *edit= PE_get_current(scene, ob); + PTCacheEdit *edit= PE_get_current(scene, OBACT); PTCacheUndo *undo; - DynStr *ds; - short event=0; - char *menu; - - if(!edit) return; + int a=0; - ds= BLI_dynstr_new(); - - BLI_dynstr_append(ds, "Particlemode Undo History %t"); - - for(undo= edit->undo.first; undo; undo= undo->next) { - BLI_dynstr_append(ds, "|"); - BLI_dynstr_append(ds, undo->name); + for(undo= edit->undo.first; undo; undo= undo->next, a++) { + if(a==nr) break; } + edit->curundo= undo; + PE_undo_step(scene, 0); +} + + +/* get name of undo item, return null if no item with this index */ +/* if active pointer, set it to 1 if true */ +char *PE_undo_get_name(Scene *scene, int nr, int *active) +{ + PTCacheEdit *edit= PE_get_current(scene, OBACT); + PTCacheUndo *undo; - menu= BLI_dynstr_get_cstring(ds); - BLI_dynstr_free(ds); + if(active) *active= 0; -// XXX event= pupmenu_col(menu, 20); - MEM_freeN(menu); - - if(event>0) PTCacheUndo_number(scene, edit, event); + if(edit) { + undo= BLI_findlink(&edit->undo, nr); + if(undo) { + if(active && undo==edit->curundo) + *active= 1; + return undo->name; + } + } + return NULL; } /************************ utilities ******************************/ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index a1a4f33d008..fb535f2fee5 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -650,8 +650,12 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int if(ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT) alignment= RGN_ALIGN_NONE; + /* prefsize, for header we stick to exception */ prefsizex= ar->sizex?ar->sizex:ar->type->prefsizex; - prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey; + if(ar->regiontype==RGN_TYPE_HEADER) + prefsizey= ar->type->prefsizey; + else + prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey; /* hidden is user flag */ if(ar->flag & RGN_FLAG_HIDDEN); @@ -953,6 +957,8 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) uiFreeBlocks(NULL, &ar->uiblocks); } + /* rechecks all 2d matrices */ + ar->v2d.flag &= ~V2D_IS_INITIALISED; } } @@ -1208,13 +1214,13 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) int xco= 8; but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D, - editortype_pup(), xco, yco, XIC+10, YIC, + editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y, &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0, "Displays current editor type. " "Click for menu of available types"); uiButSetFunc(but, spacefunc, NULL, NULL); - return xco + XIC + 14; + return xco + UI_UNIT_X + 14; } int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco) @@ -1230,21 +1236,21 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco) if (sa->flag & HEADER_NO_PULLDOWN) { uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, ICON_DISCLOSURE_TRI_RIGHT, - xco,yco,XIC,YIC-2, + xco,yco,UI_UNIT_X,UI_UNIT_Y-2, &(sa->flag), 0, 0, 0, 0, "Show pulldown menus"); } else { uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, ICON_DISCLOSURE_TRI_DOWN, - xco,yco,XIC,YIC-2, + xco,yco,UI_UNIT_X,UI_UNIT_Y-2, &(sa->flag), 0, 0, 0, 0, "Hide pulldown menus"); } uiBlockSetEmboss(block, UI_EMBOSS); - return xco + XIC; + return xco + UI_UNIT_X; } /************************ standard UI regions ************************/ @@ -1446,6 +1452,7 @@ void ED_region_header(const bContext *C, ARegion *ar) HeaderType *ht; Header header = {NULL}; int maxco, xco, yco; + int headery= ED_area_headersize(); /* clear */ UI_ThemeClearColor((ED_screen_area_active(C))?TH_HEADER:TH_HEADERDESEL); @@ -1455,12 +1462,12 @@ void ED_region_header(const bContext *C, ARegion *ar) UI_view2d_view_ortho(&ar->v2d); xco= maxco= 8; - yco= HEADERY-4; + yco= headery-4; /* draw all headers types */ for(ht= ar->type->headertypes.first; ht; ht= ht->next) { block= uiBeginBlock(C, ar, ht->idname, UI_EMBOSS); - layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, HEADERY-6, 1, style); + layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style); if(ht->draw) { header.type= ht; @@ -1484,7 +1491,7 @@ void ED_region_header(const bContext *C, ARegion *ar) } /* always as last */ - UI_view2d_totRect_set(&ar->v2d, maxco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, maxco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); /* restore view matrix? */ UI_view2d_view_restore(C); @@ -1495,3 +1502,8 @@ void ED_region_header_init(ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } +/* UI_UNIT_Y is defined as U variable now, depending dpi */ +int ED_area_headersize(void) +{ + return UI_UNIT_Y+6; +} diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 9bc2b1a402c..eb41dcd147b 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -671,9 +671,9 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) /* test for collapsed areas. This could happen in some blender version... */ /* ton: removed option now, it needs Context... */ - /* make each window at least HEADERY high */ + /* make each window at least ED_area_headersize() high */ for(sa= sc->areabase.first; sa; sa= sa->next) { - int headery= HEADERY+1; + int headery= ED_area_headersize()+1; if(sa->v1->vec.y+headery > sa->v2->vec.y) { /* lower edge */ @@ -1055,6 +1055,18 @@ void ED_screen_draw(wmWindow *win) win->screen->do_draw= 0; } +/* helper call for below, dpi changes headers */ +static void screen_refresh_headersizes(void) +{ + const ListBase *lb= BKE_spacetypes_list(); + SpaceType *st; + + for(st= lb->first; st; st= st->next) { + ARegionType *art= BKE_regiontype_from_id(st, RGN_TYPE_HEADER); + if(art) art->prefsizey= ED_area_headersize(); + } +} + /* make this screen usable */ /* for file read and first use, for scaling window, area moves */ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) @@ -1076,6 +1088,9 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) else wm_subwindow_position(win, win->screen->mainwin, &winrct); + /* header size depends on DPI, let's verify */ + screen_refresh_headersizes(); + for(sa= win->screen->areabase.first; sa; sa= sa->next) { /* set spacetype and region callbacks, calls init() */ /* sets subwindows for regions, adds handlers */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f454dd9ce02..d1d59457fd9 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -868,13 +868,14 @@ typedef struct sAreaMoveData { static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller) { ScrArea *sa; + int areaminy= ED_area_headersize()+1; /* we check all areas and test for free space with MINSIZE */ *bigger= *smaller= 100000; for(sa= sc->areabase.first; sa; sa= sa->next) { if(dir=='h') { - int y1= sa->v2->vec.y - sa->v1->vec.y-AREAMINY; + int y1= sa->v2->vec.y - sa->v1->vec.y-areaminy; /* if top or down edge selected, test height */ if(sa->v1->flag && sa->v4->flag) @@ -933,6 +934,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int bScreen *sc= CTX_wm_screen(C); ScrVert *v1; ScrArea *sa; + int areaminy= ED_area_headersize()+1; delta= CLAMPIS(delta, -smaller, bigger); @@ -950,8 +952,8 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int v1->vec.y-= (v1->vec.y % AREAGRID); /* prevent too small top header */ - if(v1->vec.y > win->sizey-AREAMINY) - v1->vec.y= win->sizey-AREAMINY; + if(v1->vec.y > win->sizey-areaminy) + v1->vec.y= win->sizey-areaminy; } } } @@ -1165,6 +1167,7 @@ static int area_split_init(bContext *C, wmOperator *op) { ScrArea *sa= CTX_wm_area(C); sAreaSplitData *sd; + int areaminy= ED_area_headersize()+1; int dir; /* required context */ @@ -1175,7 +1178,7 @@ static int area_split_init(bContext *C, wmOperator *op) /* minimal size */ if(dir=='v' && sa->winx < 2*AREAMINX) return 0; - if(dir=='h' && sa->winy < 2*AREAMINY) return 0; + if(dir=='h' && sa->winy < 2*areaminy) return 0; /* custom data */ sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split"); @@ -3314,6 +3317,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(ED_OT_undo); WM_operatortype_append(ED_OT_undo_push); WM_operatortype_append(ED_OT_redo); + WM_operatortype_append(ED_OT_undo_history); } @@ -3422,9 +3426,11 @@ void ED_keymap_screen(wmKeyConfig *keyconf) #ifdef __APPLE__ WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0); + WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_OSKEY, 0); #endif WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); + WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); /* render */ diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 10a1fe62cca..7a824e6bf9d 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -58,6 +58,7 @@ #include "UI_view2d.h" #include "ED_space_api.h" +#include "ED_screen.h" #include "ED_anim_api.h" #include "ED_markers.h" diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 8d48836704e..19c600be937 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -104,7 +104,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) { SpaceButs *sbuts= CTX_wm_space_buts(C); uiBlock *block; - int xco, yco= 1; + int xco, yco= 2; buttons_context_compute(C, sbuts); @@ -115,7 +115,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiBlockSetEmboss(block, UI_EMBOSS); - xco -= XIC; + xco -= UI_UNIT_X; // Default panels uiBlockBeginAlign(block); @@ -150,7 +150,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiBlockEndAlign(block); /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+(XIC/2), ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, xco+(UI_UNIT_X/2), ar->v2d.tot.ymax-ar->v2d.tot.ymin); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c index 57a1d36e3a2..d88d4296008 100644 --- a/source/blender/editors/space_script/script_header.c +++ b/source/blender/editors/space_script/script_header.c @@ -106,14 +106,14 @@ void script_header_buttons(const bContext *C, ARegion *ar) xmax= GetButStringLength("View"); uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C), - "View", xco, yco-2, xmax-3, 24, ""); - xco+=XIC+xmax; + "View", xco, yco-2, xmax-3, UI_UNIT_Y, ""); + xco+=UI_UNIT_X+xmax; } uiBlockSetEmboss(block, UI_EMBOSS); /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c index 60707e18187..2246eb310b5 100644 --- a/source/blender/editors/space_sound/sound_header.c +++ b/source/blender/editors/space_sound/sound_header.c @@ -113,14 +113,14 @@ void sound_header_buttons(const bContext *C, ARegion *ar) xmax= GetButStringLength("View"); uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C), - "View", xco, yco-2, xmax-3, 24, ""); - xco+=XIC+xmax; + "View", xco, yco-2, xmax-3, UI_UNIT_Y, ""); + xco+=UI_UNIT_X+xmax; } uiBlockSetEmboss(block, UI_EMBOSS); /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); + UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index fce23df3810..75c8d5cae73 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -445,9 +445,9 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) row= uiLayoutRow(layout, 1); block= uiLayoutGetBlock(row); - uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode"); - uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode"); - uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode"); + uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode"); + uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode"); + uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode"); BKE_mesh_end_editmesh(obedit->data, em); } @@ -485,7 +485,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBlockBeginAlign(block); uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) , - 0,0,126 * dpi_fac,20, &(v3d->modeselect), 0, 0, 0, 0, "Mode"); + 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, "Mode"); uiBlockEndAlign(block); /* Draw type */ @@ -508,10 +508,10 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) /* NDOF */ /* Not implemented yet if (G.ndofdevice ==0 ) { - uiDefIconTextButC(block, ICONTEXTROW,B_NDOF, ICON_NDOF_TURN, ndof_pup(), 0,0,XIC+10,YIC, &(v3d->ndofmode), 0, 3.0, 0, 0, "Ndof mode"); + uiDefIconTextButC(block, ICONTEXTROW,B_NDOF, ICON_NDOF_TURN, ndof_pup(), 0,0,UI_UNIT_X+10,UI_UNIT_Y, &(v3d->ndofmode), 0, 3.0, 0, 0, "Ndof mode"); uiDefIconButC(block, TOG, B_NDOF, ICON_NDOF_DOM, - 0,0,XIC,YIC, + 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->ndoffilter, 0, 1, 0, 0, "dominant axis"); } */ @@ -522,9 +522,9 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { - uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); - uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); - uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); + uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); + uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); + uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); } if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) { @@ -532,7 +532,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } str_menu = BIF_menustringTransformOrientation(C, "Orientation"); - uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, YIC, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); + uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); MEM_freeN((void *)str_menu); } diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 732e5087af2..bcbc134d06d 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -296,7 +296,7 @@ void undo_editmode_clear(void) } /* based on index nr it does a restore */ -static void undo_number(bContext *C, int nr) +void undo_editmode_number(bContext *C, int nr) { UndoElem *uel; int a=1; @@ -337,65 +337,27 @@ int undo_editmode_valid(const char *undoname) return undobase.last != undobase.first; } -/* ************** for interaction with menu/pullown */ -void undo_editmode_menu(bContext *C) +/* get name of undo item, return null if no item with this index */ +/* if active pointer, set it to 1 if true */ +char *undo_editmode_get_name(bContext *C, int nr, int *active) { UndoElem *uel; - DynStr *ds= BLI_dynstr_new(); - short event= 0; - char *menu; - - undo_clean_stack(C); // removes other objects from it - BLI_dynstr_append(ds, "Editmode Undo History %t"); + /* prevent wrong numbers to be returned */ + undo_clean_stack(C); - for(uel= undobase.first; uel; uel= uel->next) { - BLI_dynstr_append(ds, "|"); - BLI_dynstr_append(ds, uel->name); + if(active) *active= 0; + + uel= BLI_findlink(&undobase, nr); + if(uel) { + if(active && uel==curundo) + *active= 1; + return uel->name; } - - menu= BLI_dynstr_get_cstring(ds); - BLI_dynstr_free(ds); - -// XXX event= pupmenu_col(menu, 20); - MEM_freeN(menu); - - if(event>0) undo_number(C, event); + return NULL; } -static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event) -{ - Object *obedit= CTX_data_edit_object(C); - - if(obedit==NULL || event<1) return; - - undo_number(C, event-1); - -} - -uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg)) -{ - uiBlock *block; - UndoElem *uel; - short yco = 20, menuwidth = 120; - short item= 1; - - undo_clean_stack(C); // removes other objects from it - - block= uiBeginBlock(C, ar, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_editmode_undohistorymenu, NULL); - - for(uel= undobase.first; uel; uel= uel->next, item++) { - if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, uel->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, (float)item, ""); - if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - } - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; -} void *undo_editmode_get_prev(Object *ob) { diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index f4e27a5faf9..692a19a7198 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -68,6 +68,9 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "UI_interface.h" +#include "UI_resources.h" + #include "util_intern.h" #define MAXUNDONAME 64 /* XXX, make common define */ @@ -111,10 +114,12 @@ void ED_undo_push(bContext *C, const char *str) if(wm->file_saved) { wm->file_saved= 0; + /* notifier that data changed, for save-over warning or header */ WM_event_add_notifier(C, NC_WM|ND_DATACHANGED, NULL); } } +/* note: also check undo_history_exec() in bottom if you change notifiers */ static int ed_undo_step(bContext *C, int step, const char *undoname) { Object *obedit= CTX_data_edit_object(C); @@ -277,32 +282,6 @@ static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op)) return ed_undo_step(C, -1, NULL); } -#if 0 /* UNUSED */ -void ED_undo_menu(bContext *C) -{ - Object *obedit= CTX_data_edit_object(C); - Object *obact= CTX_data_active_object(C); - - if(obedit) { - //if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) - // undo_editmode_menu(); - } - else { - if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) - PE_undo_menu(CTX_data_scene(C), CTX_data_active_object(C)); - else if(U.uiflag & USER_GLOBALUNDO) { - char *menu= BKE_undo_menu_string(); - if(menu) { - short event= 0; // XXX pupmenu_col(menu, 20); - MEM_freeN(menu); - if(event>0) { - BKE_undo_number(C, event); - } - } - } - } -} -#endif /* ********************** */ @@ -399,3 +378,144 @@ void ED_undo_operator_repeat_cb_evt(bContext *C, void *arg_op, int UNUSED(arg_ev { ED_undo_operator_repeat(C, (wmOperator *)arg_op); } + + +/* ************************** */ + +#define UNDOSYSTEM_GLOBAL 1 +#define UNDOSYSTEM_EDITMODE 2 +#define UNDOSYSTEM_PARTICLE 3 + +static int get_undo_system(bContext *C) +{ + Object *obedit= CTX_data_edit_object(C); + + /* find out which undo system */ + if(obedit) { + if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) + return UNDOSYSTEM_EDITMODE; + } + else { + Object *obact= CTX_data_active_object(C); + + if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) + return UNDOSYSTEM_PARTICLE; + else if(U.uiflag & USER_GLOBALUNDO) + return UNDOSYSTEM_GLOBAL; + } + + return 0; +} + +/* create enum based on undo items */ +static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem) +{ + EnumPropertyItem item_tmp= {0}, *item= NULL; + int active, i= 0; + + while(TRUE) { + char *name= NULL; + + if(undosys==UNDOSYSTEM_PARTICLE) { + name= PE_undo_get_name(CTX_data_scene(C), i, &active); + } + else if(undosys==UNDOSYSTEM_EDITMODE) { + name= undo_editmode_get_name(C, i, &active); + } + else { + name= BKE_undo_get_name(i, &active); + } + + if(name) { + item_tmp.identifier= item_tmp.name= name; + if(active) + item_tmp.icon= ICON_RESTRICT_VIEW_OFF; + else + item_tmp.icon= ICON_NONE; + item_tmp.value= i++; + RNA_enum_item_add(&item, totitem, &item_tmp); + } + else + break; + } + + RNA_enum_item_end(&item, totitem); + + return item; +} + + +static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +{ + int undosys, totitem= 0; + + undosys= get_undo_system(C); + + if(undosys) { + EnumPropertyItem *item= rna_undo_itemf(C, undosys, &totitem); + + if(totitem > 0) { + uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); + uiLayout *layout= uiPupMenuLayout(pup); + uiLayout *split= uiLayoutSplit(layout, 0, 0), *column; + int i, c; + + for(c=0, i=totitem-1; i >= 0; i--, c++) { + if( (c % 20)==0 ) + column= uiLayoutColumn(split, 0); + if(item[i].identifier) + uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value); + + } + + MEM_freeN(item); + + uiPupMenuEnd(C, pup); + } + + } + return OPERATOR_CANCELLED; +} + +/* note: also check ed_undo_step() in top if you change notifiers */ +static int undo_history_exec(bContext *C, wmOperator *op) +{ + if(RNA_property_is_set(op->ptr, "item")) { + int undosys= get_undo_system(C); + int item= RNA_int_get(op->ptr, "item"); + + if(undosys==UNDOSYSTEM_PARTICLE) { + PE_undo_number(CTX_data_scene(C), item); + } + else if(undosys==UNDOSYSTEM_EDITMODE) { + undo_editmode_number(C, item+1); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, NULL); + } + else { + BKE_undo_number(C, item); + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, CTX_data_scene(C)); + } + WM_event_add_notifier(C, NC_WINDOW, NULL); + + return OPERATOR_FINISHED; + } + return OPERATOR_CANCELLED; +} + +void ED_OT_undo_history(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Undo History"; + ot->description= "Redo specific action in history"; + ot->idname= "ED_OT_undo_history"; + + /* api callbacks */ + ot->invoke= undo_history_invoke; + ot->exec= undo_history_exec; + ot->poll= ED_operator_screenactive; + + RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX); + +} + + diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h index 1a82668236d..bfa758b3faa 100644 --- a/source/blender/editors/util/util_intern.h +++ b/source/blender/editors/util/util_intern.h @@ -37,8 +37,12 @@ /* internal exports only */ /* editmode_undo.c */ -void undo_editmode_name(bContext *C, const char *undoname); -int undo_editmode_valid(const char *undoname); +void undo_editmode_name (struct bContext *C, const char *undoname); +int undo_editmode_valid (const char *undoname); +char *undo_editmode_get_name (struct bContext *C, int nr, int *active); +void *undo_editmode_get_prev (struct Object *ob); +void undo_editmode_step (struct bContext *C, int step); +void undo_editmode_number (struct bContext *C, int nr); #endif /* ED_UTIL_INTERN_H */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index cd19f4cb3de..b52ed35ddce 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -187,7 +187,6 @@ typedef struct ARegion { #define AREA_FLAG_DRAWSPLIT_H 16 #define AREA_FLAG_DRAWSPLIT_V 32 -/* If you change EDGEWIDTH, also do the global arrat edcol[] */ #define EDGEWIDTH 1 #define AREAGRID 4 #define AREAMINX 32 diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 1057eeae40f..50e66f91028 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -374,7 +374,8 @@ typedef struct UserDef { short scrcastfps; /* frame rate for screencast to be played back */ short scrcastwait; /* milliseconds between screencast snapshots */ - short pad8, pad[3]; /* Value for Dual/Single Column UI */ + short widget_unit; /* defaults to 20 for 72 DPI setting */ + short pad[3]; char versemaster[160]; char verseuser[160]; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 33808446757..b67805c97b9 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -69,6 +69,13 @@ static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe WM_main_add_notifier(NC_WINDOW, NULL); } +static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + U.widget_unit = (U.dpi * 20 + 36)/72; + WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */ + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); /* refresh region sizes */ +} + static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr) { UserDef *userdef = (UserDef *)ptr->data; @@ -2444,7 +2451,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "dpi"); RNA_def_property_range(prop, 48, 128); RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display"); - RNA_def_property_update(prop, 0, "rna_userdef_update"); + RNA_def_property_update(prop, 0, "rna_userdef_dpi_update"); prop= RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "scrollback"); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index a5ee01de2f1..5d005e23029 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -485,15 +485,16 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) /* prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. Screws up autosaves otherwise * can remove this eventually, only in a 2.53 and older, now its not written */ G.fileflags &= ~G_FILE_RELATIVE_REMAP; - + + /* check userdef before open window, keymaps etc */ + wm_init_userdef(C); + /* match the read WM with current WM */ wm_window_match_do(C, &wmbase); WM_check(C); /* opens window(s), checks keymaps */ G.main->name[0]= '\0'; - wm_init_userdef(C); - /* When loading factory settings, the reset solid OpenGL lights need to be applied. */ if (!G.background) GPU_default_lights(); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 34702558bc8..6959231a2fa 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -727,14 +727,14 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT); - //uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, 19, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy... - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, 0, 0, ""); + //uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy... + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); uiButSetSearchFunc(but, operator_enum_search_cb, op->type, operator_enum_call_cb, NULL); /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 180, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 9*UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); - uiPopupBoundsBlock(block, 6, 0, -20); /* move it downwards, mouse over button */ + uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ uiEndBlock(C, block); event= *(win->eventstate); /* XXX huh huh? make api call */ @@ -916,7 +916,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) assert(op->type->flag & OPTYPE_REGISTER); uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, arg_op); - layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, 20, style); + layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, style); if(ED_undo_valid(C, op->type->name)==0) uiLayoutSetEnabled(layout, 0); @@ -981,7 +981,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) col= uiLayoutColumn(layout, FALSE); col_block= uiLayoutGetBlock(col); /* Create OK button, the callback of which will execute op */ - btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, 20, NULL, 0, 0, 0, 0, ""); + btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); uiButSetFunc(btn, dialog_exec_cb, op, col_block); } @@ -1087,7 +1087,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op) static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RNA_int_set(op->ptr, "debug_value", G.rt); - return WM_operator_props_dialog_popup(C, op, 180, 20); + return WM_operator_props_dialog_popup(C, op, 9*UI_UNIT_X, UI_UNIT_Y); } static void WM_OT_debug_menu(wmOperatorType *ot) @@ -1185,8 +1185,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL); #ifdef NAN_BUILDINFO - uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, 20, NULL, 0, 0, 0, 0, NULL); - uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, 20, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); #endif //NAN_BUILDINFO layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style); @@ -1310,13 +1310,13 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_ block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT); - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, 0, 0, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL); /* fake button, it holds space for search items */ - uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 180, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); + uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 9*UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); - uiPopupBoundsBlock(block, 6, 0, -20); /* move it downwards, mouse over button */ + uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ uiEndBlock(C, block); event= *(win->eventstate); /* XXX huh huh? make api call */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 82fe42f2b42..9ee39132521 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -271,9 +271,11 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) void wm_window_title(wmWindowManager *wm, wmWindow *win) { - /* handle the 'temp' window */ + /* handle the 'temp' window, only set title when not set before */ if(win->screen && win->screen->temp) { - GHOST_SetTitle(win->ghostwin, "Blender"); + char *title= GHOST_GetTitle(win->ghostwin); + if(title==NULL || title[0]==0) + GHOST_SetTitle(win->ghostwin, "Blender"); } else { From bd0d5247f46df18bb0c62ba767bc84322e9e469f Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Sat, 4 Jun 2011 23:02:44 +0000 Subject: [PATCH 037/105] Changed "Convert" to "Convert to" since the first one is incorrect. Removed some dots at the end of tooltips following the standard --- source/blender/editors/object/object_add.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index c425ef5a36a..c5236a38970 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -174,14 +174,14 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) PropertyRNA *prop; /* note: this property gets hidden for add-camera operator */ - RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view."); + RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view"); if(do_editmode) { - prop= RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", "Enter editmode when adding this object."); + prop= RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", "Enter editmode when adding this object"); RNA_def_property_flag(prop, PROP_HIDDEN); } - RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX); + RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX); RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX); prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); @@ -637,7 +637,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op) else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); if(obedit==NULL) { - BKE_report(op->reports, RPT_ERROR, "Cannot create editmode armature."); + BKE_report(op->reports, RPT_ERROR, "Cannot create editmode armature"); return OPERATOR_CANCELLED; } @@ -1382,7 +1382,7 @@ static int convert_exec(bContext *C, wmOperator *op) void OBJECT_OT_convert(wmOperatorType *ot) { /* identifiers */ - ot->name= "Convert"; + ot->name= "Convert to"; ot->description = "Convert selected objects to another type"; ot->idname= "OBJECT_OT_convert"; @@ -1395,8 +1395,8 @@ void OBJECT_OT_convert(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - ot->prop= RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to."); - RNA_def_boolean(ot->srna, "keep_original", 0, "Keep Original", "Keep original objects instead of replacing them."); + ot->prop= RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to"); + RNA_def_boolean(ot->srna, "keep_original", 0, "Keep Original", "Keep original objects instead of replacing them"); } /**************************** Duplicate ************************/ @@ -1716,7 +1716,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_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data"); prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); RNA_def_property_flag(prop, PROP_HIDDEN); } @@ -1786,8 +1786,8 @@ void OBJECT_OT_add_named(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data."); - RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add."); + RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data"); + RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add"); } @@ -1812,11 +1812,11 @@ static int join_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); if(scene->obedit) { - BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode."); + BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode"); return OPERATOR_CANCELLED; } else if(object_data_is_libdata(ob)) { - BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata."); + BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); return OPERATOR_CANCELLED; } @@ -1865,11 +1865,11 @@ static int join_shapes_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_active_object(C); if(scene->obedit) { - BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode."); + BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode"); return OPERATOR_CANCELLED; } else if(object_data_is_libdata(ob)) { - BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata."); + BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); return OPERATOR_CANCELLED; } From a79072c80dedf987de185ef9fd3f06adf243a27a Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Sun, 5 Jun 2011 00:10:20 +0000 Subject: [PATCH 038/105] SVN maintenance. --- intern/ghost/intern/GHOST_DisplayManagerNULL.h | 2 +- intern/ghost/intern/GHOST_SystemNULL.h | 2 +- intern/ghost/intern/GHOST_WindowNULL.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intern/ghost/intern/GHOST_DisplayManagerNULL.h b/intern/ghost/intern/GHOST_DisplayManagerNULL.h index e2902afd29b..ba4a36ee3d1 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerNULL.h +++ b/intern/ghost/intern/GHOST_DisplayManagerNULL.h @@ -1,5 +1,5 @@ /* - * $Id: + * $Id$ * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h index 00277449ceb..3bc68b45b0d 100644 --- a/intern/ghost/intern/GHOST_SystemNULL.h +++ b/intern/ghost/intern/GHOST_SystemNULL.h @@ -1,5 +1,5 @@ /* - * $Id: + * $Id$ * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h index c0162f412c5..0ec3c6f5700 100644 --- a/intern/ghost/intern/GHOST_WindowNULL.h +++ b/intern/ghost/intern/GHOST_WindowNULL.h @@ -1,5 +1,5 @@ /* - * $Id: + * $Id$ * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or From 3a6adc0ed30be1d940f8069ad5e35bb27140ada6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 04:52:32 +0000 Subject: [PATCH 039/105] fix [#27554] vertex group names - duplicate vertex group names were not being checked for. - also made the first duplicate end with .001 rather than .000 --- source/blender/blenlib/intern/path_util.c | 6 ++++-- source/blender/makesrna/intern/rna_object.c | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index e0a08d0b890..6106dca2633 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -153,8 +153,10 @@ void BLI_stringenc(char *string, const char *head, const char *tail, unsigned sh int BLI_split_name_num(char *left, int *nr, const char *name, const char delim) { int a; - - *nr= 0; + + /* could use '0', but this would mean the first + * duplicate would become FooBar.000 */ + *nr= 1; a= strlen(name); memcpy(left, name, (a + 1) * sizeof(char)); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 9305380d06c..8ee8652e2e5 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -454,6 +454,14 @@ static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value) BKE_report(NULL, RPT_ERROR, "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle"); } +void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= (Object *)ptr->id.data; + bDeformGroup *dg= (bDeformGroup *)ptr->data; + BLI_strncpy(dg->name, value, sizeof(dg->name)); + defgroup_unique_name(dg, ob); +} + static int rna_VertexGroup_index_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; @@ -1236,6 +1244,7 @@ static void rna_def_vertex_group(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Vertex group name"); RNA_def_struct_name_property(srna, prop); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set"); RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */ prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); From b727202921f537b50ab5ebdf7367da1c4416120d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 07:55:18 +0000 Subject: [PATCH 040/105] compile without splash and icons when WITH_HEADLESS is set. --- .../blender/editors/datafiles/CMakeLists.txt | 71 ++++++++++--------- .../blender/editors/interface/CMakeLists.txt | 4 ++ .../editors/interface/interface_draw.c | 4 ++ .../editors/interface/interface_icons.c | 9 ++- .../blender/editors/space_file/CMakeLists.txt | 4 ++ source/blender/editors/space_file/filelist.c | 4 ++ 6 files changed, 63 insertions(+), 33 deletions(-) diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index 8761297b979..ae86905a91d 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -29,41 +29,48 @@ set(INC_SYS set(SRC Bfont.c - add.png.c bfont.ttf.c - blenderbuttons.c - blob.png.c - blur.png.c bmonofont.ttf.c - clay.png.c - clone.png.c - crease.png.c - darken.png.c - draw.png.c - fill.png.c - flatten.png.c - grab.png.c - inflate.png.c - layer.png.c - lighten.png.c - mix.png.c - multiply.png.c - nudge.png.c - pinch.png.c - preview.blend.c - prvicons.c - scrape.png.c - smear.png.c - smooth.png.c - snake_hook.png.c - soften.png.c - splash.png.c startup.blend.c - subtract.png.c - texdraw.png.c - thumb.png.c - twist.png.c - vertexdraw.png.c + preview.blend.c ) +if(NOT WITH_HEADLESS) + list(APPEND SRC + splash.png.c + blenderbuttons.c + + # brushes + add.png.c + blob.png.c + blur.png.c + clay.png.c + clone.png.c + crease.png.c + darken.png.c + draw.png.c + fill.png.c + flatten.png.c + grab.png.c + inflate.png.c + layer.png.c + lighten.png.c + mix.png.c + multiply.png.c + nudge.png.c + pinch.png.c + prvicons.c + scrape.png.c + smear.png.c + smooth.png.c + snake_hook.png.c + soften.png.c + subtract.png.c + texdraw.png.c + thumb.png.c + twist.png.c + vertexdraw.png.c + ) +endif() + blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 9902cac8857..6dd7af70e33 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -63,6 +63,10 @@ if(WITH_INTERNATIONAL) add_definitions(-DINTERNATIONAL) endif() +if(WITH_HEADLESS) + add_definitions(-DWITH_HEADLESS) +endif() + if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index f9c97c36bdd..710d4d58825 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -471,6 +471,9 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel) void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect) { +#ifdef WITH_HEADLESS + (void)rect; +#else extern char datatoc_splash_png[]; extern int datatoc_splash_png_size; ImBuf *ibuf; @@ -507,6 +510,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors * */ IMB_freeImBuf(ibuf); +#endif } #if 0 diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index b92097d124b..3bf2a9ddd02 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -461,6 +461,7 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha) glDisable(GL_LINE_SMOOTH); } +#ifndef WITH_HEADLESS static void init_brush_icons(void) { @@ -588,7 +589,7 @@ static void init_internal_icons(void) IMB_freeImBuf(bbuf); } - +#endif // WITH_HEADLESS static void init_iconfile_list(struct ListBase *list) { @@ -704,6 +705,7 @@ ListBase *UI_iconfile_list(void) void UI_icons_free(void) { +#ifndef WITH_HEADLESS if(icongltex.id) { glDeleteTextures(1, &icongltex.id); icongltex.id= 0; @@ -711,6 +713,7 @@ void UI_icons_free(void) free_iconfile_list(&iconfilelist); BKE_icons_free(); +#endif } void UI_icons_free_drawinfo(void *drawinfo) @@ -792,10 +795,14 @@ int UI_icon_get_height(int icon_id) void UI_icons_init(int first_dyn_id) { +#ifdef WITH_HEADLESS + (void)first_dyn_id; +#else init_iconfile_list(&iconfilelist); BKE_icons_init(first_dyn_id); init_internal_icons(); init_brush_icons(); +#endif } /* Render size for preview images and icons diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index e161e2d4b9b..afa746ea359 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -51,6 +51,10 @@ set(SRC fsmenu.h ) +if(WITH_HEADLESS) + add_definitions(-DWITH_HEADLESS) +endif() + if(WITH_IMAGE_OPENEXR) add_definitions(-DWITH_OPENEXR) endif() diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 9b65589ef4c..32b725e0b1f 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -373,7 +373,11 @@ void filelist_init_icons(void) short x, y, k; ImBuf *bbuf; ImBuf *ibuf; +#ifdef WITH_HEADLESS + bbuf = NULL; +#else bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_prvicons, datatoc_prvicons_size, IB_rect); +#endif if (bbuf) { for (y=0; y Date: Sun, 5 Jun 2011 08:18:37 +0000 Subject: [PATCH 041/105] py/drivers disable dont interning strings, no need really since this isnt done on every execution. --- source/blender/python/intern/bpy_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 6f124d959cb..c154b139146 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -190,7 +190,7 @@ float BPY_driver_exec(ChannelDriver *driver) PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 1, expr_vars); for (dvar= driver->variables.first, i=0; dvar; dvar= dvar->next) { - PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_InternFromString(dvar->name)); + PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name)); } driver->flag &= ~DRIVER_FLAG_RENAMEVAR; From 07619d8fc0cf13ee852db9a793a02b8955068636 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 09:00:36 +0000 Subject: [PATCH 042/105] with the new scalable UI. hard coded values were still used for resizing the headers, with DPI of 56 the headers could not be un-hidden. --- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/screen/screen_ops.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c15acb4f5ca..bef56aabbe8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6280,7 +6280,7 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb) BLI_addtail(lb, ar); ar->regiontype= RGN_TYPE_HEADER; - if(sa->headertype==1) + if(sa->headertype==HEADERDOWN) ar->alignment= RGN_ALIGN_BOTTOM; else ar->alignment= RGN_ALIGN_TOP; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d1d59457fd9..9e840e75578 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1631,7 +1631,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) rmd->ar->sizex= rmd->origval + delta; CLAMP(rmd->ar->sizex, 0, rmd->maxsize); - if(rmd->ar->sizex < 24) { + if(rmd->ar->sizex < UI_UNIT_X) { rmd->ar->sizex= rmd->origval; if(!(rmd->ar->flag & RGN_FLAG_HIDDEN)) ED_region_toggle_hidden(C, rmd->ar); @@ -1646,11 +1646,17 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) rmd->ar->sizey= rmd->origval + delta; CLAMP(rmd->ar->sizey, 0, rmd->maxsize); - - if(rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) - maxsize = rmd->maxsize - ((rmd->sa->headertype==2)?48:24) - 10; - if(rmd->ar->sizey < 24 || (maxsize > 0 && (rmd->ar->sizey > maxsize)) ) { + if(rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) { + /* this calculation seems overly verbose + * can someone explain why this method is necessary? - campbell */ + maxsize = rmd->maxsize - ((rmd->sa->headertype==HEADERTOP)?UI_UNIT_Y*2:UI_UNIT_Y) - (UI_UNIT_Y/4); + } + + /* note, 'UI_UNIT_Y/4' means you need to drag the header almost + * all the way down for it to become hidden, this is done + * otherwise its too easy to do this by accident */ + if(rmd->ar->sizey < UI_UNIT_Y/4 || (maxsize > 0 && (rmd->ar->sizey > maxsize)) ) { rmd->ar->sizey= rmd->origval; if(!(rmd->ar->flag & RGN_FLAG_HIDDEN)) ED_region_toggle_hidden(C, rmd->ar); From 1d236097ab2ddb61c52ff68ed0f487e54bc0e4a0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 09:22:14 +0000 Subject: [PATCH 043/105] workaround for supremely annoying UI glitch where you could accidentally hide the file selector header by accident. using the logic - that a header taking up the full screen-area height will not have an action-zone added for resizing. --- source/blender/editors/screen/area.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index fb535f2fee5..f37e2618ed4 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -815,8 +815,18 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int ar->winrct.xmax= ar->winrct.xmin; } /* in end, add azones, where appropriate */ - region_azone_add(sa, ar, alignment); - + if(ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) { + /* The logic for this is: when the header takes up the full area, + * disallow hiding it to view the main window. + * + * Without this, uou can drag down the file selectors header and hide it + * by accident very easily (highly annoying!), the value 6 is arbitrary + * but accounts for small common rounding problems when scaling the UI, + * must be minimum '4' */ + } + else { + region_azone_add(sa, ar, alignment); + } region_rect_recursive(sa, ar->next, remainder, quad); } From 24292793a043f47d8b19653652d1c5c036441354 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 10:05:13 +0000 Subject: [PATCH 044/105] scale the file selector UI with the DPI, the region size can still be wrong though. --- source/blender/editors/space_file/file_draw.c | 6 ------ source/blender/editors/space_file/file_intern.h | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 903af649caa..8cef65ea4a2 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -74,12 +74,6 @@ #include "file_intern.h" // own include -/* ui geometry */ -#define IMASEL_BUTTONS_HEIGHT 40 -#define IMASEL_BUTTONS_MARGIN 6 -#define TILE_BORDER_X 8 -#define TILE_BORDER_Y 8 - /* button events */ enum { B_FS_DIRNAME, diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index f171c4936fc..1965c661685 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -43,8 +43,12 @@ struct SpaceFile; struct ARegion *file_buttons_region(struct ScrArea *sa); /* file_draw.c */ -#define TILE_BORDER_X 8 -#define TILE_BORDER_Y 8 +#define TILE_BORDER_X (UI_UNIT_X/4) +#define TILE_BORDER_Y (UI_UNIT_Y/4) + +/* ui geometry */ +#define IMASEL_BUTTONS_HEIGHT (UI_UNIT_Y*2) +#define IMASEL_BUTTONS_MARGIN (UI_UNIT_Y/6) void file_draw_buttons(const bContext *C, ARegion *ar); void file_calc_previews(const bContext *C, ARegion *ar); From 619df86faddf99bffa84b2d20bba69e68c4dc6a5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 12:47:17 +0000 Subject: [PATCH 045/105] panel headers were not scaling with DPI properly --- source/blender/editors/interface/interface_intern.h | 4 ++-- source/blender/editors/interface/interface_panel.c | 2 +- source/blender/editors/screen/area.c | 8 ++++---- source/blender/python/intern/bpy_driver.c | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index d185e839fdd..3f3665aae38 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -117,8 +117,8 @@ typedef enum { /* warn: rest of uiBut->flag in UI_interface.h */ /* internal panel drawing defines */ -#define PNL_GRID 4 -#define PNL_HEADER 20 +#define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */ +#define PNL_HEADER UI_UNIT_Y /* 20 default */ /* panel->flag */ #define PNL_SELECT 1 diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 42017f749be..9ed3cabb4cb 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -384,7 +384,7 @@ static void ui_draw_x_icon(float x, float y) } -#define PNL_ICON 20 +#define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */ static void ui_draw_panel_scalewidget(rcti *rect) { diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index f37e2618ed4..05214a63325 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1281,11 +1281,11 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * if(vertical) { w= v2d->cur.xmax - v2d->cur.xmin; - em= (ar->type->prefsizex)? 10: 20; + em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y; } else { w= UI_PANEL_WIDTH; - em= (ar->type->prefsizex)? 10: 20; + em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y; } x= 0; @@ -1309,8 +1309,8 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * panel= uiBeginPanel(sa, ar, block, pt, &open); /* bad fixed values */ - header= (pt->flag & PNL_NO_HEADER)? 0: 20; - triangle= 22; + header= (pt->flag & PNL_NO_HEADER)? 0: UI_UNIT_Y; + triangle= (int)(UI_UNIT_Y * 1.1f); if(vertical) y -= header; diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index c154b139146..dec393bd1e4 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -185,7 +185,6 @@ float BPY_driver_exec(ChannelDriver *driver) expr_vars= PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1); Py_XDECREF(expr_vars); - /* intern the arg names so creating the namespace for every run is faster */ expr_vars= PyTuple_New(BLI_countlist(&driver->variables)); PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 1, expr_vars); @@ -211,7 +210,7 @@ float BPY_driver_exec(ChannelDriver *driver) /* try to add to dictionary */ /* if (PyDict_SetItemString(driver_vars, dvar->name, driver_arg)) { */ - if (PyDict_SetItem(driver_vars, PyTuple_GET_ITEM(expr_vars, i++), driver_arg) < 0) { /* use string interning for faster namespace creation */ + if (PyDict_SetItem(driver_vars, PyTuple_GET_ITEM(expr_vars, i++), driver_arg) < 0) { /* this target failed - bad name */ if (targets_ok) { /* first one - print some extra info for easier identification */ From 485a89f5d322358c8e32aee372fd6fa5cca4b3ee Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 5 Jun 2011 12:57:09 +0000 Subject: [PATCH 046/105] Bugfix: new DPI-controlled UI size code was setting 'view2d re-init' flag on ED_area_initialize(). This however was causing 2 problems; - the view state got reset (popping window view back) - the view2d operator polls failed (sliders didnt work) This re-init was only needed for the headers though, limiting it to these types of regions solves it. --- source/blender/editors/screen/area.c | 5 +++-- source/blender/editors/space_api/spacetypes.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 05214a63325..828699e85ce 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -967,8 +967,9 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) uiFreeBlocks(NULL, &ar->uiblocks); } - /* rechecks all 2d matrices */ - ar->v2d.flag &= ~V2D_IS_INITIALISED; + /* rechecks 2d matrix for header on dpi changing, do not do for other regions, it resets view && blocks view2d operator polls (ton) */ + if(ar->regiontype==RGN_TYPE_HEADER) + ar->v2d.flag &= ~V2D_IS_INITIALISED; } } diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 8d8cdcc7183..4f8cb8a57b2 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -70,6 +70,9 @@ void ED_spacetypes_init(void) const ListBase *spacetypes; SpaceType *type; + /* UI_UNIT_X is now a variable, is used in some spacetype inits? */ + U.widget_unit= 20; + /* create space types */ ED_spacetype_outliner(); ED_spacetype_time(); From 56befd2666eb97ae9de1b5fa0aff6be5772d452a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 13:20:30 +0000 Subject: [PATCH 047/105] colorband and image header were ignoring DPI size --- .../editors/interface/interface_templates.c | 31 ++++++++++--------- .../editors/space_image/image_buttons.c | 6 ++-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 37c8c43e107..bbd1bd8773b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1281,31 +1281,32 @@ static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v) /* offset aligns from bottom, standard width 300, height 115 */ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand *coba, int xoffs, int yoffs, RNAUpdateCb *cb) { - uiBut *bt; uiLayout *row; + const int line1_y= yoffs + 65 + UI_UNIT_Y + 2; /* 2 for some space between the buttons */ + const int line2_y= yoffs + 65; if(coba==NULL) return; - bt= uiDefBut(block, BUT, 0, "Add", 0+xoffs,100+yoffs,40,20, NULL, 0, 0, 0, 0, "Add a new color stop to the colorband"); + bt= uiDefBut(block, BUT, 0, "Add", 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Add a new color stop to the colorband"); uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, "Delete", 45+xoffs,100+yoffs,45,20, NULL, 0, 0, 0, 0, "Delete the active position"); + bt= uiDefBut(block, BUT, 0, "Delete", 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Delete the active position"); uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba); /* XXX, todo for later - convert to operator - campbell */ - bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,100+yoffs,20,20, NULL, 0, 0, 0, 0, "Flip colorband"); + bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,line1_y,20,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Flip colorband"); uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); - uiDefButS(block, NUM, 0, "", 120+xoffs,100+yoffs,80, 20, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, "Choose active color stop"); + uiDefButS(block, NUM, 0, "", 120+xoffs,line1_y,80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, "Choose active color stop"); bt= uiDefButS(block, MENU, 0, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4", - 210+xoffs, 100+yoffs, 90, 20, &coba->ipotype, 0.0, 0.0, 0, 0, "Set interpolation between color stops"); + 210+xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, "Set interpolation between color stops"); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); uiBlockEndAlign(block); - bt= uiDefBut(block, BUT_COLORBAND, 0, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, ""); + bt= uiDefBut(block, BUT_COLORBAND, 0, "", xoffs,line2_y,300,UI_UNIT_Y, coba, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); @@ -1330,11 +1331,11 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand float xs= butr->xmin; uiBlockBeginAlign(block); - bt= uiDefBut(block, BUT, 0, "Add", xs,butr->ymin+20.0f,2.0f*unit,20, NULL, 0, 0, 0, 0, "Add a new color stop to the colorband"); + bt= uiDefBut(block, BUT, 0, "Add", xs,butr->ymin+UI_UNIT_Y,2.0f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Add a new color stop to the colorband"); uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, "Delete", xs+2.0f*unit,butr->ymin+20.0f,1.5f*unit,20, NULL, 0, 0, 0, 0, "Delete the active position"); + bt= uiDefBut(block, BUT, 0, "Delete", xs+2.0f*unit,butr->ymin+UI_UNIT_Y,1.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Delete the active position"); uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+20.0f,0.5f*unit,20, NULL, 0, 0, 0, 0, "Flip the color ramp"); + bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+UI_UNIT_Y,0.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, "Flip the color ramp"); uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); uiBlockEndAlign(block); @@ -1346,10 +1347,10 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand } bt= uiDefButS(block, MENU, 0, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4", - xs+10.0f*unit, butr->ymin+20.0f, unit*4, 20, &coba->ipotype, 0.0, 0.0, 0, 0, "Set interpolation between color stops"); + xs+10.0f*unit, butr->ymin+UI_UNIT_Y, unit*4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, "Set interpolation between color stops"); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); - bt= uiDefBut(block, BUT_COLORBAND, 0, "", xs,butr->ymin,butr->xmax-butr->xmin,20.0f, coba, 0, 0, 0, 0, ""); + bt= uiDefBut(block, BUT_COLORBAND, 0, "", xs,butr->ymin,butr->xmax-butr->xmin,UI_UNIT_Y, coba, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); uiBlockEndAlign(block); @@ -1422,7 +1423,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname hist = (Histogram *)cptr.data; - hist->height= (hist->height<=20)?20:hist->height; + hist->height= (hist->height<=UI_UNIT_Y)?UI_UNIT_Y:hist->height; bt= uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, hist->height, hist, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); @@ -1459,7 +1460,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname) block= uiLayoutAbsoluteBlock(layout); - scopes->wavefrm_height= (scopes->wavefrm_height<=20)?20:scopes->wavefrm_height; + scopes->wavefrm_height= (scopes->wavefrm_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->wavefrm_height; bt= uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->wavefrm_height, scopes, 0, 0, 0, 0, ""); (void)bt; // UNUSED @@ -1496,7 +1497,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna block= uiLayoutAbsoluteBlock(layout); - scopes->vecscope_height= (scopes->vecscope_height<=20)?20:scopes->vecscope_height; + scopes->vecscope_height= (scopes->vecscope_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->vecscope_height; bt= uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->vecscope_height, scopes, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 7e881e7e62f..adce540cee4 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -556,20 +556,20 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image /* menu buts */ if(render_slot) { strp= slot_menu(); - but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, 20, render_slot, 0,0,0,0, "Select Slot"); + but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, UI_UNIT_Y, render_slot, 0,0,0,0, "Select Slot"); uiButSetFunc(but, image_multi_cb, rr, iuser); MEM_freeN(strp); } if(rr) { strp= layer_menu(rr, &iuser->layer); - but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu2, 20, &iuser->layer, 0,0,0,0, "Select Layer"); + but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu2, UI_UNIT_Y, &iuser->layer, 0,0,0,0, "Select Layer"); uiButSetFunc(but, image_multi_cb, rr, iuser); MEM_freeN(strp); rl= BLI_findlink(&rr->layers, iuser->layer - (rr->rectf?1:0)); /* fake compo layer, return NULL is meant to be */ strp= pass_menu(rl, &iuser->pass); - but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu3, 20, &iuser->pass, 0,0,0,0, "Select Pass"); + but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu3, UI_UNIT_Y, &iuser->pass, 0,0,0,0, "Select Pass"); uiButSetFunc(but, image_multi_cb, rr, iuser); MEM_freeN(strp); } From 08f44adba965dbf4f7c56eb096b0e2709df80e5c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 14:00:06 +0000 Subject: [PATCH 048/105] file selector now scales with DPI better --- source/blender/editors/include/UI_interface_icons.h | 4 ++++ source/blender/editors/space_file/file_draw.c | 4 ++-- source/blender/editors/space_file/filesel.c | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 50b14cb832a..b6837a4b3c9 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -49,6 +49,10 @@ typedef struct IconFile { #define ICON_DEFAULT_HEIGHT 16 #define ICON_DEFAULT_WIDTH 16 + +#define ICON_DEFAULT_HEIGHT_SCALE (UI_UNIT_Y * 0.8f) +#define ICON_DEFAULT_WIDTH_SCALE (UI_UNIT_X * 0.8f) + #define PREVIEW_DEFAULT_HEIGHT 96 /* diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 8cef65ea4a2..a6fee359197 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -517,8 +517,8 @@ void file_draw_list(const bContext *C, ARegion *ar) file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE)); } else { - file_draw_icon(block, file->path, sx, sy-3, get_file_icon(file), ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH); - sx += ICON_DEFAULT_WIDTH + 4; + file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_WIDTH_SCALE); + sx += ICON_DEFAULT_WIDTH_SCALE + 4; } UI_ThemeColor4(TH_TEXT); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 968953abf62..793267bfa8c 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -403,10 +403,12 @@ float file_font_pointsize(void) uiStyleFontSet(&style->widget); s = BLF_height(style->widget.uifont_id, tmp); return style->widget.points; -#else +#elif 0 uiStyle *style= U.uistyles.first; uiStyleFontSet(&style->widget); return style->widget.points; +#else + return UI_UNIT_Y * 0.6666f; #endif } @@ -497,11 +499,11 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar) column_widths(sfile->files, layout); if (params->display == FILE_SHORTDISPLAY) { - maxlen = ICON_DEFAULT_WIDTH + 4 + + maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 + (int)layout->column_widths[COLUMN_NAME] + 12 + (int)layout->column_widths[COLUMN_SIZE] + 12; } else { - maxlen = ICON_DEFAULT_WIDTH + 4 + + maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 + (int)layout->column_widths[COLUMN_NAME] + 12 + #ifndef WIN32 (int)layout->column_widths[COLUMN_MODE1] + 12 + From 68d4c64db82310ed00a139278866573f952b79c2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 15:29:50 +0000 Subject: [PATCH 049/105] own commit r37199 gave problems with duplicating objects, use different fix. --- source/blender/blenlib/intern/path_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 6106dca2633..b2b48176bca 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -156,7 +156,7 @@ int BLI_split_name_num(char *left, int *nr, const char *name, const char delim) /* could use '0', but this would mean the first * duplicate would become FooBar.000 */ - *nr= 1; + *nr= 0; a= strlen(name); memcpy(left, name, (a + 1) * sizeof(char)); @@ -218,13 +218,13 @@ int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, cons int number; int len= BLI_split_name_num(left, &number, name, delim); do { - int newlen= BLI_snprintf(tempname, name_len, "%s%c%03d", left, delim, number); + int newlen= BLI_snprintf(tempname, name_len, "%s%c%03d", left, delim, ++number); if(newlen >= name_len) { len -= ((newlen + 1) - name_len); if(len < 0) len= number= 0; left[len]= '\0'; } - } while(number++, unique_check(arg, tempname)); + } while(unique_check(arg, tempname)); BLI_strncpy(name, tempname, name_len); From 68a3303013de4bad2d166c7a2b7b1dc44668dc64 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 17:02:57 +0000 Subject: [PATCH 050/105] operator buttons get a red highlight when alert is set for the layout --- source/blender/blenlib/intern/path_util.c | 2 -- source/blender/editors/interface/interface_layout.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index b2b48176bca..af87707fb90 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -154,8 +154,6 @@ int BLI_split_name_num(char *left, int *nr, const char *name, const char delim) { int a; - /* could use '0', but this would mean the first - * duplicate would become FooBar.000 */ *nr= 0; a= strlen(name); memcpy(left, name, (a + 1) * sizeof(char)); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b68634acd1e..55c1488291b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -651,6 +651,9 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i if (flag & UI_ITEM_R_NO_BG) uiBlockSetEmboss(block, UI_EMBOSS); + if(layout->redalert) + uiButSetFlag(but, UI_BUT_REDALERT); + /* assign properties */ if(properties || (flag & UI_ITEM_O_RETURN_PROPS)) { PointerRNA *opptr= uiButGetOperatorPtrRNA(but); From a580b5ec80d5c0744b63f9b7e8048c0f16681a38 Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Sun, 5 Jun 2011 18:00:24 +0000 Subject: [PATCH 051/105] fixed warning, signed/unsigned mismatch, blo/readfile.c line 1742 --- source/blender/blenloader/intern/readfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index bef56aabbe8..a01b8b58c82 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1723,7 +1723,6 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) static void direct_link_fmodifiers(FileData *fd, ListBase *list) { FModifier *fcm; - int a; for (fcm= list->first; fcm; fcm= fcm->next) { /* relink general data */ @@ -1739,6 +1738,7 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list) data->coefficients= newdataadr(fd, data->coefficients); if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { + unsigned a; for(a = 0; a < data->arraysize; a++) SWITCH_INT(data->coefficients[a]); } From a1c22262fef25de91dbafd7b401e349538dc3d61 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 5 Jun 2011 20:54:04 +0000 Subject: [PATCH 052/105] Bake from multires mesh ======================= Added option to baked named "Bake From Multires" which is avaliable for normals baking and displacement baking. If this option is enabled, then no additional hi-res meshes and render structures would be created . This saves plenty of memory and meshes with millions of faces could be successfully baked in few minutes. Baking happens from highest level against viewport subdivision level, so workflow is following: - Set viewport level to level at which texture would be applied during final rendering. - Choose Displacement/Normals baking. - Enable "Bake From Multires" option. - You're ready to bake. Displacement baker had aditional option named "Low Resolution Mesh". This option is used to set if you want texture for realtime (games) usage. Internally it does the following: - If it's disabled, displacement is calculated from subdivided viewport level, so texture looks "smooth" (it's how default baked works). - If it's enabled, dispalcement is calculated against unsubdivided viewport levels. This leads to "scales". This isn;t useful for offline renders much, but very useful for creating game textures. Special thanks to Morten Mikkelsen (aka sparky) for all mathematics and other work he've done fr this patch! --- .../startup/bl_ui/properties_render.py | 48 +- source/blender/blenkernel/BKE_multires.h | 1 + source/blender/blenkernel/intern/customdata.c | 2 +- source/blender/blenkernel/intern/multires.c | 58 +- source/blender/blenlib/BLI_math_geom.h | 3 + source/blender/blenlib/intern/math_geom.c | 74 + source/blender/editors/object/object_bake.c | 1281 ++++++++++++++++- source/blender/imbuf/IMB_imbuf.h | 7 + source/blender/imbuf/intern/filter.c | 64 + source/blender/makesdna/DNA_scene_types.h | 3 +- source/blender/makesrna/intern/rna_scene.c | 8 + .../blender/render/intern/source/rendercore.c | 80 +- 12 files changed, 1472 insertions(+), 157 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index a3b10702fa7..c313942bea0 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -613,29 +613,41 @@ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel): layout.prop(rd, "bake_type") - if rd.bake_type == 'NORMALS': - layout.prop(rd, "bake_normal_space") - elif rd.bake_type in {'DISPLACEMENT', 'AO'}: - layout.prop(rd, "use_bake_normalize") + multires_bake = False + if rd.bake_type in ['NORMALS', 'DISPLACEMENT']: + layout.prop(rd, 'use_bake_multires') + multires_bake = rd.use_bake_multires - # col.prop(rd, "bake_aa_mode") - # col.prop(rd, "use_bake_antialiasing") + if not multires_bake: + if rd.bake_type == 'NORMALS': + layout.prop(rd, "bake_normal_space") + elif rd.bake_type in {'DISPLACEMENT', 'AO'}: + layout.prop(rd, "use_bake_normalize") - layout.separator() + # col.prop(rd, "bake_aa_mode") + # col.prop(rd, "use_bake_antialiasing") - split = layout.split() + layout.separator() - col = split.column() - col.prop(rd, "use_bake_clear") - col.prop(rd, "bake_margin") - col.prop(rd, "bake_quad_split", text="Split") + split = layout.split() - col = split.column() - col.prop(rd, "use_bake_selected_to_active") - sub = col.column() - sub.active = rd.use_bake_selected_to_active - sub.prop(rd, "bake_distance") - sub.prop(rd, "bake_bias") + col = split.column() + col.prop(rd, "use_bake_clear") + col.prop(rd, "bake_margin") + col.prop(rd, "bake_quad_split", text="Split") + + col = split.column() + col.prop(rd, "use_bake_selected_to_active") + sub = col.column() + sub.active = rd.use_bake_selected_to_active + sub.prop(rd, "bake_distance") + sub.prop(rd, "bake_bias") + else: + if rd.bake_type == 'DISPLACEMENT': + layout.prop(rd, "use_bake_lores_mesh") + + layout.prop(rd, "use_bake_clear") + layout.prop(rd, "bake_margin") if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index ea34ff4aa07..ba23b2d79c0 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -91,6 +91,7 @@ void multires_topology_changed(struct Scene *scene, struct Object *ob); void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v); void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v); int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y); +int mdisp_rot_face_to_quad_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y); void mdisp_apply_weight(const int S, const int corners, int x, int y, const int face_side, float crn_weight[4][2], float *u_r, float *v_r); void mdisp_flip_disp(const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3]); void mdisp_join_tris(struct MDisps *dst, struct MDisps *tri1, struct MDisps *tri2); diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index f5f069767eb..45faba8439c 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -540,7 +540,7 @@ static void layerInterp_mdisps(void **sources, float *UNUSED(weights), float face_u, face_v, crn_u, crn_v; mdisp_apply_weight(S, dst_corners, x, y, st, crn_weight, &face_u, &face_v); - crn = mdisp_rot_face_to_crn(src_corners, st, face_u, face_v, &crn_u, &crn_v); + crn = mdisp_rot_face_to_quad_crn(src_corners, st, face_u, face_v, &crn_u, &crn_v); old_mdisps_bilinear((*out), &s->disps[crn*side*side], side, crn_u, crn_v); mdisp_flip_disp(crn, dst_corners, axis_x, axis_y, *out); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 13ab89200db..5802bb2b697 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1997,11 +1997,67 @@ void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, } } +/* Find per-corner coordinate with given per-face UV coord */ int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y) { const float offset = face_side*0.5f - 0.5f; int S = 0; + if (corners == 4) { + if(u <= offset && v <= offset) S = 0; + else if(u > offset && v <= offset) S = 1; + else if(u > offset && v > offset) S = 2; + else if(u <= offset && v >= offset) S = 3; + + if(S == 0) { + *y = offset - u; + *x = offset - v; + } else if(S == 1) { + *x = u - offset; + *y = offset - v; + } else if(S == 2) { + *y = u - offset; + *x = v - offset; + } else if(S == 3) { + *x= offset - u; + *y = v - offset; + } + } else { + int grid_size = offset; + float w = (face_side - 1) - u - v; + float W1, W2; + + if (u >= v && u >= w) {S = 0; W1= w; W2= v;} + else if (v >= u && v >= w) {S = 1; W1 = u; W2 = w;} + else {S = 2; W1 = v; W2 = u;} + + W1 /= (face_side-1); + W2 /= (face_side-1); + + *x = (1-(2*W1)/(1-W2)) * grid_size; + *y = (1-(2*W2)/(1-W1)) * grid_size; + } + + return S; +} + +/* Find per-corner coordinate with given per-face UV coord + Practically as the previous funciton but it assumes a bit different coordinate system for triangles + which is optimized for MDISP layer interpolation: + + v + ^ + | /| + | / | + | / | + |/______|___> u + + */ +int mdisp_rot_face_to_quad_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y) +{ + const float offset = face_side*0.5f - 0.5f; + int S = 0; + if (corners == 4) { if(u <= offset && v <= offset) S = 0; else if(u > offset && v <= offset) S = 1; @@ -2148,7 +2204,7 @@ void mdisp_join_tris(MDisps *dst, MDisps *tri1, MDisps *tri2) face_v = st - 1 - face_v; } else src = tri1; - crn = mdisp_rot_face_to_crn(3, st, face_u, face_v, &crn_u, &crn_v); + crn = mdisp_rot_face_to_quad_crn(3, st, face_u, face_v, &crn_u, &crn_v); old_mdisps_bilinear((*out), &src->disps[crn*side*side], side, crn_u, crn_v); (*out)[0] = 0; diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 634634f02e5..b34b9c4b70f 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -162,6 +162,9 @@ void barycentric_transform(float pt_tar[3], float const pt_src[3], void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]); +void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); +void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); + /***************************** View & Projection *****************************/ void lookat_m4(float mat[4][4], float vx, float vy, diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 5979a24c807..96ed788a49f 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -1809,6 +1809,80 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3 v[2]= 3*a[2]*t2 + 2*b[2]*t + v1[2]; } +/* unfortunately internal calculations have to be done at double precision to achieve correct/stable results. */ + +#define IS_ZERO(x) ((x>(-DBL_EPSILON) && x0 ? (-1.0) : 1.0; + + uv[0]= (float)(( (a-b) + s * desc ) / denom); + } + + /* find UV such that + fST = (1-u)(1-v)*ST0 + u*(1-v)*ST1 + u*v*ST2 + (1-u)*v*ST3 */ + { + const double denom_s= (1-uv[0])*(st0[0]-st3[0]) + uv[0]*(st1[0]-st2[0]); + const double denom_t= (1-uv[0])*(st0[1]-st3[1]) + uv[0]*(st1[1]-st2[1]); + int i= 0; double denom= denom_s; + + if(fabs(denom_s)mface[face_num].v1, data->mface[face_num].v2, + data->mface[face_num].v3, data->mface[face_num].v4}; + const int smoothnormal= (data->mface[face_num].flag & ME_SMOOTH); + + if(!smoothnormal) { /* flat */ + if(data->precomputed_normals) { + copy_v3_v3(norm, &data->precomputed_normals[3*face_num]); + } else { + float nor[3]; + float *p0, *p1, *p2; + const int iGetNrVerts= data->mface[face_num].v4!=0 ? 4 : 3; + + p0= data->mvert[indices[0]].co; + p1= data->mvert[indices[1]].co; + p2= data->mvert[indices[2]].co; + + if(iGetNrVerts==4) { + float *p3= data->mvert[indices[3]].co; + normal_quad_v3(nor, p0, p1, p2, p3); + } else { + normal_tri_v3(nor, p0, p1, p2); + } + + copy_v3_v3(norm, nor); + } + } else { + short *no= data->mvert[indices[vert_index]].no; + + normal_short_to_float_v3(norm, no); + normalize_v3(norm); + } +} + +static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResolvePixelData *data, MFlushPixel flush_pixel) +{ + memset(bake_rast, 0, sizeof(MBakeRast)); + + bake_rast->texels = ibuf->userdata; + bake_rast->w= ibuf->x; + bake_rast->h= ibuf->y; + bake_rast->data= data; + bake_rast->flush_pixel= flush_pixel; +} + +static void flush_pixel(const MResolvePixelData *data, const int x, const int y) +{ + float st[2]= {(x+0.5f)/data->w, (y+0.5f)/data->h}; + float *st0, *st1, *st2; + float *tang0, *tang1, *tang2; + float no0[3], no1[3], no2[3]; + float fUV[2], from_tang[3][3], to_tang[3][3]; + float u, v, w, sign; + int r; + + const int i0= data->i0; + const int i1= data->i1; + const int i2= data->i2; + + st0= data->mtface[data->face_index].uv[i0]; + st1= data->mtface[data->face_index].uv[i1]; + st2= data->mtface[data->face_index].uv[i2]; + + tang0= data->pvtangent + data->face_index*16 + i0*4; + tang1= data->pvtangent + data->face_index*16 + i1*4; + tang2= data->pvtangent + data->face_index*16 + i2*4; + + multiresbake_get_normal(data, no0, data->face_index, i0); /* can optimize these 3 into one call */ + multiresbake_get_normal(data, no1, data->face_index, i1); + multiresbake_get_normal(data, no2, data->face_index, i2); + + resolve_tri_uv(fUV, st, st0, st1, st2); + + u= fUV[0]; + v= fUV[1]; + w= 1-u-v; + + /* the sign is the same at all face vertices for any non degenerate face. + Just in case we clamp the interpolated value though. */ + sign= (tang0[3]*u + tang1[3]*v + tang2[3]*w)<0 ? (-1.0f) : 1.0f; + + /* this sequence of math is designed specifically as is with great care + to be compatible with our shader. Please don't change without good reason. */ + for(r= 0; r<3; r++) { + from_tang[0][r]= tang0[r]*u + tang1[r]*v + tang2[r]*w; + from_tang[2][r]= no0[r]*u + no1[r]*v + no2[r]*w; + } + + cross_v3_v3v3(from_tang[1], from_tang[2], from_tang[0]); /* B = sign * cross(N, T) */ + mul_v3_fl(from_tang[1], sign); + invert_m3_m3(to_tang, from_tang); + /* sequence end */ + + data->pass_data(data->lores_dm, data->hires_dm, data->bake_data, + data->face_index, data->lvl, st, to_tang, x, y); +} + +static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int y) +{ + const int w= bake_rast->w; + const int h= bake_rast->h; + + if(x>=0 && x=0 && ytexels[y*w+x])==0) { + flush_pixel(bake_rast->data, x, y); + bake_rast->texels[y*w+x]= FILTER_MASK_USED; + } + } +} + +static void rasterize_half(const MBakeRast *bake_rast, + const float s0_s, const float t0_s, const float s1_s, const float t1_s, + const float s0_l, const float t0_l, const float s1_l, const float t1_l, + const int y0_in, const int y1_in, const int is_mid_right) +{ + const int s_stable= fabsf(t1_s-t0_s)>FLT_EPSILON ? 1 : 0; + const int l_stable= fabsf(t1_l-t0_l)>FLT_EPSILON ? 1 : 0; + const int w= bake_rast->w; + const int h= bake_rast->h; + int y, y0, y1; + + if(y1_in<=0 || y0_in>=h) + return; + + y0= y0_in<0 ? 0 : y0_in; + y1= y1_in>=h ? h : y1_in; + + for(y= y0; y0 && iXl=w?w:iXr; + + for(x= iXl; xw; + const int h= bake_rast->h; + float slo= st0_in[0]*w - 0.5f; + float tlo= st0_in[1]*h - 0.5f; + float smi= st1_in[0]*w - 0.5f; + float tmi= st1_in[1]*h - 0.5f; + float shi= st2_in[0]*w - 0.5f; + float thi= st2_in[1]*h - 0.5f; + int is_mid_right= 0, ylo, yhi, yhi_beg; + + /* skip degenerates */ + if((slo==smi && tlo==tmi) || (slo==shi && tlo==thi) || (smi==shi && tmi==thi)) + return; + + /* sort by T */ + if(tlo>tmi && tlo>thi) { + SWAP(float, shi, slo); + SWAP(float, thi, tlo); + } else if(tmi>thi) { + SWAP(float, shi, smi); + SWAP(float, thi, tmi); + } + + if(tlo>tmi) { + SWAP(float, slo, smi); + SWAP(float, tlo, tmi); + } + + /* check if mid point is to the left or to the right of the lo-hi edge */ + is_mid_right= (-(shi-slo)*(tmi-thi) + (thi-tlo)*(smi-shi))>0 ? 1 : 0; + ylo= (int) ceilf(tlo); + yhi_beg= (int) ceilf(tmi); + yhi= (int) ceilf(thi); + + /*if(fTmi>ceilf(fTlo))*/ + rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right); + rasterize_half(bake_rast, smi, tmi, shi, thi, slo, tlo, shi, thi, yhi_beg, yhi, is_mid_right); +} + +static int multiresbake_test_break(MultiresBakeRender *bkr) +{ + if(!bkr->stop) { + /* this means baker is executed outside from job system */ + return 0; + } + + return G.afbreek; +} + +static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData passKnownData, + MInitBakeData initBakeData, MApplyBakeData applyBakeData, MFreeBakeData freeBakeData) +{ + DerivedMesh *dm= bkr->lores_dm; + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + const int lvl= bkr->lvl; + const int tot_face= dm->getNumFaces(dm); + MVert *mvert= dm->getVertArray(dm); + MFace *mface= dm->getFaceArray(dm); + MTFace *mtface= dm->getFaceDataArray(dm, CD_MTFACE); + float *pvtangent= NULL; + + if(CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1) + DM_add_tangent_layer(dm); + + pvtangent= DM_get_face_data_layer(dm, CD_TANGENT); + + if(tot_face > 0) { /* sanity check */ + int f= 0; + MBakeRast bake_rast; + MResolvePixelData data={NULL}; + + data.mface= mface; + data.mvert= mvert; + data.mtface= mtface; + data.pvtangent= pvtangent; + data.precomputed_normals= dm->getFaceDataArray(dm, CD_NORMAL); /* don't strictly need this */ + data.w= ibuf->x; + data.h= ibuf->y; + data.lores_dm= dm; + data.hires_dm= bkr->hires_dm; + data.lvl= lvl; + data.pass_data= passKnownData; + + if(initBakeData) + data.bake_data= initBakeData(bkr, ima); + + init_bake_rast(&bake_rast, ibuf, &data, flush_pixel); + + for(f= 0; ftpage!=ima) + continue; + + data.face_index= f; + + /* might support other forms of diagonal splits later on such as + split by shortest diagonal.*/ + verts[0][0]=0; + verts[1][0]=1; + verts[2][0]=2; + + verts[0][1]=0; + verts[1][1]=2; + verts[2][1]=3; + + nr_tris= mface[f].v4!=0 ? 2 : 1; + for(t= 0; tuv[data.i0], mtfate->uv[data.i1], mtfate->uv[data.i2]); + } + + bkr->baked_faces++; + + if(bkr->do_update) + *bkr->do_update= 1; + + if(bkr->progress) + *bkr->progress= ((float)bkr->baked_objects + (float)bkr->baked_faces / tot_face) / bkr->tot_obj; + } + + if(applyBakeData) + applyBakeData(data.bake_data); + + if(freeBakeData) + freeBakeData(data.bake_data); + } +} + +static void interp_bilinear_quad_data(float data[4][3], float u, float v, float res[3]) +{ + float vec[3]; + + copy_v3_v3(res, data[0]); + mul_v3_fl(res, (1-u)*(1-v)); + copy_v3_v3(vec, data[1]); + mul_v3_fl(vec, u*(1-v)); add_v3_v3(res, vec); + copy_v3_v3(vec, data[2]); + mul_v3_fl(vec, u*v); add_v3_v3(res, vec); + copy_v3_v3(vec, data[3]); + mul_v3_fl(vec, (1-u)*v); add_v3_v3(res, vec); +} + +static void interp_barycentric_tri_data(float data[3][3], float u, float v, float res[3]) +{ + float vec[3]; + + copy_v3_v3(res, data[0]); + mul_v3_fl(res, u); + copy_v3_v3(vec, data[1]); + mul_v3_fl(vec, v); add_v3_v3(res, vec); + copy_v3_v3(vec, data[2]); + mul_v3_fl(vec, 1.0f-u-v); add_v3_v3(res, vec); +} + +/* mode = 0: interpolate normals, + mode = 1: interpolate coord */ +static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, float crn_y, int mode, float res[3]) +{ + int x0, x1, y0, y1; + float u, v; + float data[4][3]; + + x0= (int) crn_x; + x1= x0>=(grid_size-1) ? (grid_size-1) : (x0+1); + + y0= (int) crn_y; + y1= y0>=(grid_size-1) ? (grid_size-1) : (y0+1); + + u= crn_x-x0; + v= crn_y-y0; + + if(mode == 0) { + copy_v3_v3(data[0], grid[y0 * grid_size + x0].no); + copy_v3_v3(data[1], grid[y0 * grid_size + x1].no); + copy_v3_v3(data[2], grid[y1 * grid_size + x1].no); + copy_v3_v3(data[3], grid[y1 * grid_size + x0].no); + } else { + copy_v3_v3(data[0], grid[y0 * grid_size + x0].co); + copy_v3_v3(data[1], grid[y0 * grid_size + x1].co); + copy_v3_v3(data[2], grid[y1 * grid_size + x1].co); + copy_v3_v3(data[3], grid[y1 * grid_size + x0].co); + } + + interp_bilinear_quad_data(data, u, v, res); +} + +static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int lvl, const int face_index, const float u, const float v, float co[3], float n[3]) +{ + MFace mface; + DMGridData **grid_data; + float crn_x, crn_y; + int grid_size, num_grids, S, face_side; + int *grid_offset, g_index; + + lodm->getFace(lodm, face_index, &mface); + + num_grids= hidm->getNumGrids(hidm); + grid_size= hidm->getGridSize(hidm); + grid_data= hidm->getGridData(hidm); + grid_offset= hidm->getGridOffset(hidm); + + face_side= (grid_size<<1)-1; + + if(lvl==0) { + g_index= grid_offset[face_index]; + S= mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u*(face_side-1), v*(face_side-1), &crn_x, &crn_y); + } else { + const int *index= lodm->getFaceDataArray(lodm, CD_ORIGINDEX); + int side= (1 << (lvl-1)) + 1; + int grid_index= index[face_index]; + int loc_offs= face_index % (1<<(2*lvl)); + int cell_index= loc_offs % ((side-1)*(side-1)); + int cell_side= grid_size / (side-1); + int row= cell_index / (side-1); + int col= cell_index % (side-1); + + S= face_index / (1<<(2*(lvl-1))) - grid_offset[grid_index]; + g_index= grid_offset[grid_index]; + + crn_y= (row * cell_side) + u * cell_side; + crn_x= (col * cell_side) + v * cell_side; + } + + CLAMP(crn_x, 0.0f, grid_size); + CLAMP(crn_y, 0.0f, grid_size); + + if(n != NULL) + interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 0, n); + + if(co != NULL) + interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 1, co); +} + +/* mode = 0: interpolate normals, + mode = 1: interpolate coord */ +static void interp_bilinear_mface(DerivedMesh *dm, MFace *mface, const float u, const float v, const int mode, float res[3]) +{ + float data[4][3]; + + if(mode == 0) { + dm->getVertNo(dm, mface->v1, data[0]); + dm->getVertNo(dm, mface->v2, data[1]); + dm->getVertNo(dm, mface->v3, data[2]); + dm->getVertNo(dm, mface->v4, data[3]); + } else { + dm->getVertCo(dm, mface->v1, data[0]); + dm->getVertCo(dm, mface->v2, data[1]); + dm->getVertCo(dm, mface->v3, data[2]); + dm->getVertCo(dm, mface->v4, data[3]); + } + + interp_bilinear_quad_data(data, u, v, res); +} + +/* mode = 0: interpolate normals, + mode = 1: interpolate coord */ +static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float u, const float v, const int mode, float res[3]) +{ + float data[3][3]; + + if(mode == 0) { + dm->getVertNo(dm, mface->v1, data[0]); + dm->getVertNo(dm, mface->v2, data[1]); + dm->getVertNo(dm, mface->v3, data[2]); + } else { + dm->getVertCo(dm, mface->v1, data[0]); + dm->getVertCo(dm, mface->v2, data[1]); + dm->getVertCo(dm, mface->v3, data[2]); + } + + interp_barycentric_tri_data(data, u, v, res); +} + +static void *init_heights_data(MultiresBakeRender *bkr, Image* ima) +{ + MHeightBakeData *height_data; + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + + height_data= MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData"); + + height_data->ima= ima; + height_data->heights= MEM_callocN(sizeof(float)*ibuf->x*ibuf->y, "MultiresBake heights"); + height_data->height_max= -FLT_MAX; + height_data->height_min= FLT_MAX; + + if(!bkr->use_lores_mesh) { + SubsurfModifierData smd= {{NULL}}; + int ss_lvl= bkr->tot_lvl - bkr->lvl; + + CLAMP(ss_lvl, 0, 6); + + smd.levels= smd.renderLevels= ss_lvl; + smd.flags|= eSubsurfModifierFlag_SubsurfUv; + + if(bkr->simple) + smd.subdivType= ME_SIMPLE_SUBSURF; + + height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0); + } + + return (void*)height_data; +} + +static void apply_heights_data(void *bake_data) +{ + MHeightBakeData *height_data= (MHeightBakeData*)bake_data; + ImBuf *ibuf= BKE_image_get_ibuf(height_data->ima, NULL); + int x, y, i; + float height, *heights= height_data->heights; + float min= height_data->height_min, max= height_data->height_max; + + for(x= 0; xx; x++) { + for(y =0; yy; y++) { + i= ibuf->x*y + x; + + if(((char*)ibuf->userdata)[i] != FILTER_MASK_USED) + continue; + + if(ibuf->rect_float) { + float *rrgbf= ibuf->rect_float + i*4; + + if(max-min > 1e-5) height= (heights[i]-min)/(max-min); + else height= 0; + + rrgbf[0]=rrgbf[1]=rrgbf[2]= height; + } else { + char *rrgb= (char*)ibuf->rect + i*4; + + if(max-min > 1e-5) height= (heights[i]-min)/(max-min); + else height= 0; + + rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height); + } + } + } +} + +static void free_heights_data(void *bake_data) +{ + MHeightBakeData *height_data= (MHeightBakeData*)bake_data; + + if(height_data->ssdm) + height_data->ssdm->release(height_data->ssdm); + + MEM_freeN(height_data->heights); + MEM_freeN(height_data); +} + +/* MultiresBake callback for heights baking + general idea: + - find coord of point with specified UV in hi-res mesh (let's call it p1) + - find coord of point and normal with specified UV in lo-res mesh (or subdivided lo-res + mesh to make texture smoother) let's call this point p0 and n. + - height wound be dot(n, p1-p0) */ +static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data, + const int face_index, const int lvl, const float st[2], + float UNUSED(tangmat[3][3]), const int x, const int y) +{ + MTFace *mtface= CustomData_get_layer(&lores_dm->faceData, CD_MTFACE); + MFace mface; + Image *ima= mtface[face_index].tpage; + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + MHeightBakeData *height_data= (MHeightBakeData*)bake_data; + float uv[2], *st0, *st1, *st2, *st3; + int pixel= ibuf->x*y + x; + float vec[3], p0[3], p1[3], n[3], len; + + lores_dm->getFace(lores_dm, face_index, &mface); + + if(x==0 && y==0) { + zero_v3(p0); + } + + st0= mtface[face_index].uv[0]; + st1= mtface[face_index].uv[1]; + st2= mtface[face_index].uv[2]; + + if(mface.v4) { + st3= mtface[face_index].uv[3]; + resolve_quad_uv(uv, st, st0, st1, st2, st3); + } else + resolve_tri_uv(uv, st, st0, st1, st2); + + CLAMP(uv[0], 0.0f, 1.0f); + CLAMP(uv[1], 0.0f, 1.0f); + + get_ccgdm_data(lores_dm, hires_dm, lvl, face_index, uv[0], uv[1], p1, 0); + + if(height_data->ssdm) { + //get_ccgdm_data_ss(lores_dm, height_data->ssdm, lvl, face_index, uv[0], uv[1], p0, n); + get_ccgdm_data(lores_dm, height_data->ssdm, 0, face_index, uv[0], uv[1], p0, n); + } else { + MFace mface; + lores_dm->getFace(lores_dm, face_index, &mface); + + if(mface.v4) { + interp_bilinear_mface(lores_dm, &mface, uv[0], uv[1], 1, p0); + interp_bilinear_mface(lores_dm, &mface, uv[0], uv[1], 0, n); + } else { + interp_barycentric_mface(lores_dm, &mface, uv[0], uv[1], 1, p0); + interp_barycentric_mface(lores_dm, &mface, uv[0], uv[1], 0, n); + } + } + + sub_v3_v3v3(vec, p1, p0); + //len= len_v3(vec); + len= dot_v3v3(n, vec); + + height_data->heights[pixel]= len; + if(lenheight_min) height_data->height_min= len; + if(len>height_data->height_max) height_data->height_max= len; + + if(ibuf->rect_float) { + float *rrgbf= ibuf->rect_float + pixel*4; + rrgbf[3]= 1.0f; + } else { + char *rrgb= (char*)ibuf->rect + pixel*4; + rrgb[3]= 255; + } +} + +/* MultiresBake callback for normals' baking + general idea: + - find coord and normal of point with specified UV in hi-res mesh + - multiply it by tangmat + - vector in color space would be norm(vec) /2 + (0.5, 0.5, 0.5) */ +static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *UNUSED(bake_data), + const int face_index, const int lvl, const float st[2], + float tangmat[3][3], const int x, const int y) +{ + MTFace *mtface= CustomData_get_layer(&lores_dm->faceData, CD_MTFACE); + MFace mface; + Image *ima= mtface[face_index].tpage; + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + float uv[2], *st0, *st1, *st2, *st3; + int pixel= ibuf->x*y + x; + float n[3], vec[3], tmp[3]= {0.5, 0.5, 0.5}; + + lores_dm->getFace(lores_dm, face_index, &mface); + + st0= mtface[face_index].uv[0]; + st1= mtface[face_index].uv[1]; + st2= mtface[face_index].uv[2]; + + if(mface.v4) { + st3= mtface[face_index].uv[3]; + resolve_quad_uv(uv, st, st0, st1, st2, st3); + } else + resolve_tri_uv(uv, st, st0, st1, st2); + + CLAMP(uv[0], 0.0f, 1.0f); + CLAMP(uv[1], 0.0f, 1.0f); + + get_ccgdm_data(lores_dm, hires_dm, lvl, face_index, uv[0], uv[1], NULL, n); + + mul_v3_m3v3(vec, tangmat, n); + normalize_v3(vec); + mul_v3_fl(vec, 0.5); + add_v3_v3(vec, tmp); + + if(ibuf->rect_float) { + float *rrgbf= ibuf->rect_float + pixel*4; + rrgbf[0]= vec[0]; + rrgbf[1]= vec[1]; + rrgbf[2]= vec[2]; + rrgbf[3]= 1.0f; + } else { + char *rrgb= (char*)ibuf->rect + pixel*4; + rrgb[0]= FTOCHAR(vec[0]); + rrgb[1]= FTOCHAR(vec[1]); + rrgb[2]= FTOCHAR(vec[2]); + rrgb[3]= 255; + } +} + +static void count_images(MultiresBakeRender *bkr) +{ + int a, totface; + DerivedMesh *dm= bkr->lores_dm; + MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE); + + bkr->image.first= bkr->image.last= NULL; + bkr->tot_image= 0; + + totface= dm->getNumFaces(dm); + + for(a= 0; aid.flag&= ~LIB_DOIT; + + for(a= 0; aid.flag&LIB_DOIT)==0) { + LinkData *data= BLI_genericNodeN(ima); + BLI_addtail(&bkr->image, data); + bkr->tot_image++; + ima->id.flag|= LIB_DOIT; + } + } + + for(a= 0; aid.flag&= ~LIB_DOIT; +} + +static void bake_images(MultiresBakeRender *bkr) +{ + LinkData *link; + + for(link= bkr->image.first; link; link= link->next) { + Image *ima= (Image*)link->data; + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + + if(ibuf->x>0 && ibuf->y>0) { + ibuf->userdata= MEM_callocN(ibuf->y*ibuf->x, "MultiresBake imbuf mask"); + + switch(bkr->mode) { + case RE_BAKE_NORMALS: + do_multires_bake(bkr, ima, apply_tangmat_callback, NULL, NULL, NULL); + break; + case RE_BAKE_DISPLACEMENT: + do_multires_bake(bkr, ima, apply_heights_callback, init_heights_data, + apply_heights_data, free_heights_data); + break; + } + } + + ima->id.flag|= LIB_DOIT; + } +} + +static void finish_images(MultiresBakeRender *bkr) +{ + LinkData *link; + + for(link= bkr->image.first; link; link= link->next) { + Image *ima= (Image*)link->data; + int i; + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + + if(ibuf->x<=0 || ibuf->y<=0) + continue; + + /* Margin */ + if(bkr->bake_filter) { + char *temprect; + + /* extend the mask +2 pixels from the image, + * this is so colors dont blend in from outside */ + + for(i=0; ibake_filter; i++) + IMB_mask_filter_extend((char *)ibuf->userdata, ibuf->x, ibuf->y); + + temprect = MEM_dupallocN(ibuf->userdata); + + /* expand twice to clear this many pixels, so they blend back in */ + IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y); + IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y); + + /* clear all pixels in the margin */ + IMB_mask_clear(ibuf, temprect, FILTER_MASK_MARGIN); + MEM_freeN(temprect); + + for(i= 0; ibake_filter; i++) + IMB_filter_extend(ibuf, (char *)ibuf->userdata); + } + + ibuf->userflags|= IB_BITMAPDIRTY; + if(ibuf->mipmap[0]) { + ibuf->userflags|= IB_MIPMAP_INVALID; + imb_freemipmapImBuf(ibuf); + } + + if(ibuf->userdata) { + MEM_freeN(ibuf->userdata); + ibuf->userdata= NULL; + } + } +} + +static void multiresbake_start(MultiresBakeRender *bkr) +{ + count_images(bkr); + bake_images(bkr); + finish_images(bkr); +} + +static int multiresbake_check(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); + Object *ob; + Mesh *me; + MultiresModifierData *mmd; + int ok= 1, a; + + CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { + ob= base->object; + + if(ob->type != OB_MESH) { + BKE_report(op->reports, RPT_ERROR, "Basking of multires data only works with active object which is a mesh"); + + ok= 0; + break; + } + + me= (Mesh*)ob->data; + mmd= get_multires_modifier(scene, ob, 0); + + /* Multi-resolution should be and be last in the stack */ + if(ok && mmd) { + ModifierData *md; + + ok= mmd->totlvl>0; + + for(md = (ModifierData*)mmd->modifier.next; md && ok; md = md->next) { + if (modifier_isEnabled(scene, md, eModifierMode_Realtime)) { + ok= 0; + } + } + } else ok= 0; + + if(!ok) { + BKE_report(op->reports, RPT_ERROR, "Multires data baking requires multi-resolution object"); + + break; + } + + if(!me->mtface) { + BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking"); + + ok= 0; + } else { + a= me->totface; + while (ok && a--) { + Image *ima= me->mtface[a].tpage; + + if(!ima) { + BKE_report(op->reports, RPT_ERROR, "You should have active texture to use multires baker"); + + ok= 0; + } else { + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + + if(!ibuf) { + BKE_report(op->reports, RPT_ERROR, "Baking should happend to image with image buffer"); + + ok= 0; + } else { + if(ibuf->rect==NULL && ibuf->rect_float==NULL) + ok= 0; + + if(ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4)) + ok= 0; + + if(!ok) + BKE_report(op->reports, RPT_ERROR, "Baking to unsupported image type"); + } + } + } + } + + if(!ok) + break; + } + CTX_DATA_END; + + return ok; +} + +static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *lvl) +{ + DerivedMesh *dm; + MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0); + Mesh *me= (Mesh*)ob->data; + + *lvl= mmd->lvl; + + if(mmd->lvl==0) { + DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob); + dm= CDDM_copy(tmp_dm); + tmp_dm->release(tmp_dm); + } else { + MultiresModifierData tmp_mmd= *mmd; + DerivedMesh *cddm= CDDM_from_mesh(me, ob); + + tmp_mmd.lvl= mmd->lvl; + dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0); + cddm->release(cddm); + } + + return dm; +} + +static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *lvl, int *simple) +{ + Mesh *me= (Mesh*)ob->data; + MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0); + MultiresModifierData tmp_mmd= *mmd; + DerivedMesh *cddm= CDDM_from_mesh(me, ob); + DerivedMesh *dm; + + *lvl= mmd->totlvl; + *simple= mmd->simple; + + tmp_mmd.lvl= mmd->totlvl; + dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0); + cddm->release(cddm); + + return dm; +} + +static void clear_images(MTFace *mtface, int totface) +{ + int a; + float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f}; + + for(a= 0; aid.flag&= ~LIB_DOIT; + + for(a= 0; aid.flag&LIB_DOIT)==0) { + ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); + + IMB_rectfill(ibuf, vec); + ima->id.flag|= LIB_DOIT; + } + } + + for(a= 0; aid.flag&= ~LIB_DOIT; +} + +static int multiresbake_image_exec_locked(bContext *C, wmOperator *op) +{ + Object *ob; + Scene *scene= CTX_data_scene(C); + + if(!multiresbake_check(C, op)) + return OPERATOR_CANCELLED; + + if(scene->r.bake_flag&R_BAKE_CLEAR) { /* clear images */ + CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { + Mesh *me; + + ob= base->object; + me= (Mesh*)ob->data; + + clear_images(me->mtface, me->totface); + } + CTX_DATA_END; + } + + CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { + MultiresBakeRender bkr= {0}; + + ob= base->object; + + /* copy data stored in job descriptor */ + bkr.bake_filter= scene->r.bake_filter; + bkr.mode= scene->r.bake_mode; + bkr.use_lores_mesh= scene->r.bake_flag&R_BAKE_LORES_MESH; + + /* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */ + bkr.lores_dm= multiresbake_create_loresdm(scene, ob, &bkr.lvl); + bkr.hires_dm= multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple); + + multiresbake_start(&bkr); + + BLI_freelistN(&bkr.image); + + bkr.lores_dm->release(bkr.lores_dm); + bkr.hires_dm->release(bkr.hires_dm); + } + CTX_DATA_END; + + return OPERATOR_FINISHED; +} + +/* Multiresbake adopted for job-system executing */ +static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj) +{ + Scene *scene= CTX_data_scene(C); + Object *ob; + + /* backup scene settings, so their changing in UI would take no effect on baker */ + bkj->bake_filter= scene->r.bake_filter; + bkj->mode= scene->r.bake_mode; + bkj->use_lores_mesh= scene->r.bake_flag&R_BAKE_LORES_MESH; + bkj->bake_clear= scene->r.bake_flag&R_BAKE_CLEAR; + + CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { + MultiresBakerJobData *data; + ob= base->object; + + data= MEM_callocN(sizeof(MultiresBakerJobData), "multiresBaker derivedMesh_data"); + data->lores_dm = multiresbake_create_loresdm(scene, ob, &data->lvl); + data->hires_dm = multiresbake_create_hiresdm(scene, ob, &data->tot_lvl, &data->simple); + BLI_addtail(&bkj->data, data); + } + CTX_DATA_END; +} + +static void multiresbake_startjob(void *bkv, short *stop, short *do_update, float *progress) +{ + MultiresBakerJobData *data; + MultiresBakeJob *bkj= bkv; + int baked_objects= 0, tot_obj; + + tot_obj= BLI_countlist(&bkj->data); + + if(bkj->bake_clear) { /* clear images */ + for(data= bkj->data.first; data; data= data->next) { + DerivedMesh *dm= data->lores_dm; + MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE); + + clear_images(mtface, dm->getNumFaces(dm)); + } + } + + for(data= bkj->data.first; data; data= data->next) { + MultiresBakeRender bkr= {0}; + + /* copy data stored in job descriptor */ + bkr.bake_filter= bkj->bake_filter; + bkr.mode= bkj->mode; + bkr.use_lores_mesh= bkj->use_lores_mesh; + + /* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */ + bkr.lores_dm= data->lores_dm; + bkr.hires_dm= data->hires_dm; + bkr.tot_lvl= data->tot_lvl; + bkr.lvl= data->lvl; + bkr.simple= data->simple; + + /* needed for proper progress bar */ + bkr.tot_obj= tot_obj; + bkr.baked_objects= baked_objects; + + bkr.stop= stop; + bkr.do_update= do_update; + bkr.progress= progress; + + multiresbake_start(&bkr); + + BLI_freelistN(&bkr.image); + + baked_objects++; + } +} + +static void multiresbake_freejob(void *bkv) +{ + MultiresBakeJob *bkj= bkv; + MultiresBakerJobData *data, *next; + + data= bkj->data.first; + while (data) { + next= data->next; + data->lores_dm->release(data->lores_dm); + data->hires_dm->release(data->hires_dm); + MEM_freeN(data); + data= next; + } + + MEM_freeN(bkj); +} + +static int multiresbake_image_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + MultiresBakeJob *bkr; + wmJob *steve; + + if(!multiresbake_check(C, op)) + return OPERATOR_CANCELLED; + + bkr= MEM_callocN(sizeof(MultiresBakeJob), "MultiresBakeJob data"); + init_multiresbake_job(C, bkr); + + /* setup job */ + steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS); + WM_jobs_customdata(steve, bkr, multiresbake_freejob); + WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */ + WM_jobs_callbacks(steve, multiresbake_startjob, NULL, NULL, NULL); + + G.afbreek= 0; + + WM_jobs_start(CTX_wm_manager(C), steve); + WM_cursor_wait(0); + + /* add modal handler for ESC */ + WM_event_add_modal_handler(C, op); + + return OPERATOR_RUNNING_MODAL; +} + /* ****************** render BAKING ********************** */ /* threaded break test */ @@ -147,9 +1284,6 @@ static void init_bake_internal(BakeRender *bkr, bContext *C) { Scene *scene= CTX_data_scene(C); - /* flush multires changes (for sculpt) */ - multires_force_render_update(CTX_data_active_object(C)); - /* get editmode results */ ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */ @@ -273,43 +1407,59 @@ static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEven return OPERATOR_PASS_THROUGH; } +static int is_multires_bake(Scene *scene) +{ + if ( ELEM(scene->r.bake_mode, RE_BAKE_NORMALS, RE_BAKE_DISPLACEMENT)) + return scene->r.bake_flag & R_BAKE_MULTIRES; + + return 0; +} + static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(_event)) { Scene *scene= CTX_data_scene(C); + int result= OPERATOR_CANCELLED; - /* only one render job at a time */ - if(WM_jobs_test(CTX_wm_manager(C), scene)) - return OPERATOR_CANCELLED; - - if(test_bake_internal(C, op->reports)==0) { - return OPERATOR_CANCELLED; - } - else { - BakeRender *bkr= MEM_callocN(sizeof(BakeRender), "render bake"); - wmJob *steve; + if(is_multires_bake(scene)) { + result= multiresbake_image_exec(C, op); + } else { + /* only one render job at a time */ + if(WM_jobs_test(CTX_wm_manager(C), scene)) + return OPERATOR_CANCELLED; - init_bake_internal(bkr, C); - bkr->reports= op->reports; + if(test_bake_internal(C, op->reports)==0) { + return OPERATOR_CANCELLED; + } + else { + BakeRender *bkr= MEM_callocN(sizeof(BakeRender), "render bake"); + wmJob *steve; - /* setup job */ - steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS); - WM_jobs_customdata(steve, bkr, bake_freejob); - WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */ - WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL); + init_bake_internal(bkr, C); + bkr->reports= op->reports; - G.afbreek= 0; - G.rendering = 1; + /* setup job */ + steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS); + WM_jobs_customdata(steve, bkr, bake_freejob); + WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */ + WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL); - WM_jobs_start(CTX_wm_manager(C), steve); + G.afbreek= 0; + G.rendering = 1; - WM_cursor_wait(0); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene); + WM_jobs_start(CTX_wm_manager(C), steve); - /* add modal handler for ESC */ - WM_event_add_modal_handler(C, op); + WM_cursor_wait(0); + + /* add modal handler for ESC */ + WM_event_add_modal_handler(C, op); + } + + result= OPERATOR_RUNNING_MODAL; } - return OPERATOR_RUNNING_MODAL; + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene); + + return result; } @@ -317,46 +1467,53 @@ static int bake_image_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + int result= OPERATOR_CANCELLED; - - if(test_bake_internal(C, op->reports)==0) { - return OPERATOR_CANCELLED; - } - else { - ListBase threads; - BakeRender bkr= {NULL}; - - init_bake_internal(&bkr, C); - bkr.reports= op->reports; - - RE_test_break_cb(bkr.re, NULL, thread_break); - G.afbreek= 0; /* blender_test_break uses this global */ - - RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); - - /* baking itself is threaded, cannot use test_break in threads */ - BLI_init_threads(&threads, do_bake_render, 1); - bkr.ready= 0; - BLI_insert_thread(&threads, &bkr); - - while(bkr.ready==0) { - PIL_sleep_ms(50); - if(bkr.ready) - break; - - /* used to redraw in 2.4x but this is just for exec in 2.5 */ - if (!G.background) - blender_test_break(); + if(is_multires_bake(scene)) { + result= multiresbake_image_exec_locked(C, op); + } else { + if(test_bake_internal(C, op->reports)==0) { + return OPERATOR_CANCELLED; } - BLI_end_threads(&threads); + else { + ListBase threads; + BakeRender bkr= {NULL}; - if(bkr.tot==0) BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to"); + init_bake_internal(&bkr, C); + bkr.reports= op->reports; - finish_bake_internal(&bkr); + RE_test_break_cb(bkr.re, NULL, thread_break); + G.afbreek= 0; /* blender_test_break uses this global */ + + RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); + + /* baking itself is threaded, cannot use test_break in threads */ + BLI_init_threads(&threads, do_bake_render, 1); + bkr.ready= 0; + BLI_insert_thread(&threads, &bkr); + + while(bkr.ready==0) { + PIL_sleep_ms(50); + if(bkr.ready) + break; + + /* used to redraw in 2.4x but this is just for exec in 2.5 */ + if (!G.background) + blender_test_break(); + } + BLI_end_threads(&threads); + + if(bkr.tot==0) BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to"); + + finish_bake_internal(&bkr); + + result= OPERATOR_FINISHED; + } } WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene); - return OPERATOR_FINISHED; + + return result; } void OBJECT_OT_bake_image(wmOperatorType *ot) diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 21249c9e8f7..1eefc58d4de 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -243,8 +243,15 @@ void IMB_free_anim(struct anim *anim); * * @attention Defined in filter.c */ + +#define FILTER_MASK_NULL 0 +#define FILTER_MASK_MARGIN 1 +#define FILTER_MASK_USED 2 + void IMB_filter(struct ImBuf *ibuf); void IMB_filterN(struct ImBuf *out, struct ImBuf *in); +void IMB_mask_filter_extend(char *mask, int width, int height); +void IMB_mask_clear(struct ImBuf *ibuf, char *mask, int val); void IMB_filter_extend(struct ImBuf *ibuf, char *mask); void IMB_makemipmap(struct ImBuf *ibuf, int use_filter); void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter); diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 16fb1fdf4aa..d12360e5a7e 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -262,6 +262,70 @@ void IMB_filter(struct ImBuf *ibuf) imb_filterx(ibuf); } +void IMB_mask_filter_extend(char *mask, int width, int height) +{ + char *row1, *row2, *row3; + int rowlen, x, y; + char *temprect; + + rowlen= width; + + /* make a copy, to prevent flooding */ + temprect= MEM_dupallocN(mask); + + for(y=1; y<=height; y++) { + /* setup rows */ + row1= (char *)(temprect + (y-2)*rowlen); + row2= row1 + rowlen; + row3= row2 + rowlen; + if(y==1) + row1= row2; + else if(y==height) + row3= row2; + + for(x=0; xrect_float) { + for(x=0; xx; x++) { + for(y=0; yy; y++) { + if (mask[ibuf->x*y + x] == val) { + float *col= ibuf->rect_float + 4*(ibuf->x*y + x); + col[0] = col[1] = col[2] = col[3] = 0.0f; + } + } + } + } else { + /* char buffer */ + for(x=0; xx; x++) { + for(y=0; yy; y++) { + if (mask[ibuf->x*y + x] == val) { + char *col= (char *)(ibuf->rect + ibuf->x*y + x); + col[0] = col[1] = col[2] = col[3] = 0; + } + } + } + } +} + #define EXTEND_PIXEL(color, w) if((color)[3]) {r+= w*(color)[0]; g+= w*(color)[1]; b+= w*(color)[2]; a+= w*(color)[3]; tot+=w;} /* if alpha is zero, it checks surrounding pixels and averages color. sets new alphas to 1.0 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 657bfb1c884..70e90cfc713 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1009,13 +1009,14 @@ typedef struct Scene { #define R_JPEG2K_CINE_PRESET 256 #define R_JPEG2K_CINE_48FPS 512 - /* bake_mode: same as RE_BAKE_xxx defines */ /* bake_flag: */ #define R_BAKE_CLEAR 1 #define R_BAKE_OSA 2 #define R_BAKE_TO_ACTIVE 4 #define R_BAKE_NORMALIZE 8 +#define R_BAKE_MULTIRES 16 +#define R_BAKE_LORES_MESH 32 /* bake_normal_space */ #define R_BAKE_SPACE_CAMERA 0 diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 72ec09a61fe..145a58ecf0f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2812,6 +2812,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_range(prop, 0.0, 1000.0); RNA_def_property_ui_text(prop, "Bias", "Bias towards faces further away from the object (in blender units)"); + prop= RNA_def_property(srna, "use_bake_multires", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_MULTIRES); + RNA_def_property_ui_text(prop, "Bake from Multires", "Bake directly from multires object"); + + prop= RNA_def_property(srna, "use_bake_lores_mesh", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_LORES_MESH); + RNA_def_property_ui_text(prop, "Low Resolution Mesh", "Calculate heights against unsubdivided low resolution mesh"); + /* stamp */ prop= RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index bc6c4795f5c..0087be8cca9 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2018,74 +2018,6 @@ typedef struct BakeShade { short *do_update; } BakeShade; -/* bake uses a char mask to know what has been baked */ -#define BAKE_MASK_NULL 0 -#define BAKE_MASK_MARGIN 1 -#define BAKE_MASK_BAKED 2 -static void bake_mask_filter_extend( char *mask, int width, int height ) -{ - char *row1, *row2, *row3; - int rowlen, x, y; - char *temprect; - - rowlen= width; - - /* make a copy, to prevent flooding */ - temprect= MEM_dupallocN(mask); - - for(y=1; y<=height; y++) { - /* setup rows */ - row1= (char *)(temprect + (y-2)*rowlen); - row2= row1 + rowlen; - row3= row2 + rowlen; - if(y==1) - row1= row2; - else if(y==height) - row3= row2; - - for(x=0; xrect_float) { - for(x=0; xx; x++) { - for(y=0; yy; y++) { - if (mask[ibuf->x*y + x] == val) { - float *col= ibuf->rect_float + 4*(ibuf->x*y + x); - col[0] = col[1] = col[2] = col[3] = 0.0f; - } - } - } - - } else { - /* char buffer */ - for(x=0; xx; x++) { - for(y=0; yy; y++) { - if (mask[ibuf->x*y + x] == val) { - char *col= (char *)(ibuf->rect + ibuf->x*y + x); - col[0] = col[1] = col[2] = col[3] = 0; - } - } - } - } -} - static void bake_set_shade_input(ObjectInstanceRen *obi, VlakRen *vlr, ShadeInput *shi, int quad, int isect, int x, int y, float u, float v) { if(quad) @@ -2281,7 +2213,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int } if (bs->rect_mask) { - bs->rect_mask[bs->rectx*y + x] = BAKE_MASK_BAKED; + bs->rect_mask[bs->rectx*y + x] = FILTER_MASK_USED; } } @@ -2308,7 +2240,7 @@ static void bake_displacement(void *handle, ShadeInput *shi, float dist, int x, col[3]= 255; } if (bs->rect_mask) { - bs->rect_mask[bs->rectx*y + x] = BAKE_MASK_BAKED; + bs->rect_mask[bs->rectx*y + x] = FILTER_MASK_USED; } } @@ -2750,16 +2682,16 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up char *temprect; for(a=0; ar.bake_filter; a++) - bake_mask_filter_extend((char *)ibuf->userdata, ibuf->x, ibuf->y); + IMB_mask_filter_extend((char *)ibuf->userdata, ibuf->x, ibuf->y); temprect = MEM_dupallocN(ibuf->userdata); /* expand twice to clear this many pixels, so they blend back in */ - bake_mask_filter_extend(temprect, ibuf->x, ibuf->y); - bake_mask_filter_extend(temprect, ibuf->x, ibuf->y); + IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y); + IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y); /* clear all pixels in the margin*/ - bake_mask_clear(ibuf, temprect, BAKE_MASK_MARGIN); + IMB_mask_clear(ibuf, temprect, FILTER_MASK_MARGIN); MEM_freeN(temprect); } From 5922b6950183f28de9143b326385507e46f264ff Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Sun, 5 Jun 2011 22:35:37 +0000 Subject: [PATCH 053/105] Fix [#27438] Volume Material Density Inaccuracy Lower density limit for shading optimisation was set too high --- source/blender/render/intern/source/volumetric.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 09422af7c79..c4e741b6c61 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -605,7 +605,7 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float for (; t0 < t1; pt0 = t0, t0 += stepsize) { const float density = vol_get_density(shi, p); - if (density > 0.01f) { + if (density > 0.00001f) { float scatter_col[3] = {0.f, 0.f, 0.f}, emit_col[3]; const float stepd = (t0 - pt0) * density; From 7da45bcbcbda60fe1affa811f629e3e4b82cce1f Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sun, 5 Jun 2011 23:38:11 +0000 Subject: [PATCH 054/105] replacing -> arrows by proper ASCII arrows on Transformation Constraint Note: Text Editor doesn't support this chr(187) properly. I hardcoded and commented the ui file. I hope it's fine. --- .../scripts/startup/bl_ui/properties_object_constraint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index 7c2fe76fe14..03823ad7345 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -655,17 +655,19 @@ class ConstraintButtonsPanel(): row = col.row() row.label(text="Source to Destination Mapping:") + # note: chr(187) is the ASCII arrow ( >> ). Blender Text Editor can't + # open it. Thus we are using the hardcoded value instead. row = col.row() row.prop(con, "map_to_x_from", expand=False, text="") - row.label(text=" -> X") + row.label(text=" %s X" % chr(187)) row = col.row() row.prop(con, "map_to_y_from", expand=False, text="") - row.label(text=" -> Y") + row.label(text=" %s Y" % chr(187)) row = col.row() row.prop(con, "map_to_z_from", expand=False, text="") - row.label(text=" -> Z") + row.label(text=" %s Z" % chr(187)) split = layout.split() From e4bb5403d39dc8227d3a186f513981f090af3017 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 00:42:36 +0000 Subject: [PATCH 055/105] fix for crash opening the file selector twice with multiple windows open (when the mouse was over the inactive window). --- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/include/ED_screen.h | 2 +- source/blender/editors/render/render_view.c | 3 +-- source/blender/editors/screen/screen_edit.c | 4 ++-- .../windowmanager/intern/wm_event_system.c | 21 ++++++++++++------- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index a01b8b58c82..6f0400d5764 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1738,7 +1738,7 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list) data->coefficients= newdataadr(fd, data->coefficients); if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) { - unsigned a; + unsigned int a; for(a = 0; a < data->arraysize; a++) SWITCH_INT(data->coefficients[a]); } diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 6e396a1021b..f2ef4e16852 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -107,7 +107,7 @@ void ED_screen_set_subwinactive(struct bContext *C, struct wmEvent *event); void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen); void ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable); void ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh); -int ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type); +ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type); void ED_screen_full_prevspace(struct bContext *C, ScrArea *sa); void ED_screen_full_restore(struct bContext *C, ScrArea *sa); struct ScrArea *ED_screen_full_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *sa); diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index 64a4d47cddc..9dfcde6ed0d 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -184,8 +184,7 @@ void render_view_open(bContext *C, int mx, int my) area_was_image = 1; /* this function returns with changed context */ - ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE); - sa= CTX_wm_area(C); + sa= ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE); } if(!sa) { diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index eb41dcd147b..721ce823351 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1513,7 +1513,7 @@ void ED_screen_delete_scene(bContext *C, Scene *scene) unlink_scene(bmain, scene, newscene); } -int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) +ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) { wmWindow *win= CTX_wm_window(C); bScreen *screen= CTX_wm_screen(C); @@ -1538,7 +1538,7 @@ int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) ED_area_newspace(C, newsa, type); - return 1; + return newsa; } void ED_screen_full_prevspace(bContext *C, ScrArea *sa) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 615259bda15..7bd5fd7e7df 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1289,16 +1289,23 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa if (handler->op_area == NULL) { bScreen *screen = CTX_wm_screen(C); sa = (ScrArea *)screen->areabase.first; - } else + } + else { sa = handler->op_area; + } - if(event->val==EVT_FILESELECT_OPEN) - ED_area_newspace(C, sa, SPACE_FILE); - else - ED_screen_full_newspace(C, sa, SPACE_FILE); /* sets context */ - + if(event->val==EVT_FILESELECT_OPEN) { + ED_area_newspace(C, sa, SPACE_FILE); /* 'sa' is modified in-place */ + } + else { + sa= ED_screen_full_newspace(C, sa, SPACE_FILE); /* sets context */ + } + + /* note, getting the 'sa' back from the context causes a nasty bug where the newly created + * 'sa' != CTX_wm_area(C). removed the line below and set 'sa' in the 'if' above */ + /* sa = CTX_wm_area(C); */ + /* settings for filebrowser, sfile is not operator owner but sends events */ - sa = CTX_wm_area(C); sfile= (SpaceFile*)sa->spacedata.first; sfile->op= handler->op; From 7c9d76199cb30298cc8d2b6d7f64e6811d931de9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 00:48:10 +0000 Subject: [PATCH 056/105] spelling corrections --- source/blender/editors/screen/area.c | 6 +++--- source/blender/windowmanager/intern/wm_event_system.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 828699e85ce..4d531e78ec0 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1138,7 +1138,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type) /* tell WM to refresh, cursor types etc */ WM_event_add_mousemove(C); - /*send space change notifyer*/ + /*send space change notifier*/ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa); ED_area_tag_refresh(sa); @@ -1165,7 +1165,7 @@ void ED_area_prevspace(bContext *C, ScrArea *sa) } ED_area_tag_redraw(sa); - /*send space change notifyer*/ + /*send space change notifier*/ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa); } @@ -1213,7 +1213,7 @@ static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2) ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype); ED_area_tag_redraw(CTX_wm_area(C)); - /*send space change notifyer*/ + /*send space change notifier*/ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, CTX_wm_area(C)); } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 7bd5fd7e7df..2613cb8f14f 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -340,7 +340,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve int is_wheel= ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE); int retval; - /* UI is quite agressive with swallowing events, like scrollwheel */ + /* UI is quite aggressive with swallowing events, like scrollwheel */ /* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */ if(do_wheel_ui==0) { if(is_wheel) @@ -1577,7 +1577,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) * so check for mouse moves too. * note2: the first click event will be handled but still used to create a * double click event if clicking again quickly. - * If no double click events are found itwill fallback to a single click. + * If no double click events are found it will fallback to a single click. * So a double click event can result in 2 successive single click calls * if its not handled by the keymap - campbell */ if ( (ABS(event->x - win->eventstate->prevclickx)) <= 2 && From dd4f0f0b9dcdc0b38d908ada34af6be6292a578c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 03:53:22 +0000 Subject: [PATCH 057/105] Resolve 2 theme issues [#27056] default active and selected colors need to be visually different [#27584] Please change sharpness/seam color --- source/blender/editors/datafiles/startup.blend.c | 4 ++-- source/blender/editors/interface/resources.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/datafiles/startup.blend.c b/source/blender/editors/datafiles/startup.blend.c index 6900f458a2b..1121eb5a299 100644 --- a/source/blender/editors/datafiles/startup.blend.c +++ b/source/blender/editors/datafiles/startup.blend.c @@ -8854,8 +8854,8 @@ char datatoc_startup_blend[]= { 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,114,114,114,255, 0, 0, 0,255, 0, 0, 0,255,255,255,255,255,114,114,114,255, 0, 0, 0,255, 0, 0, 0,255,255,255,255,255,165,165,165,255, 0, 0, 0,255, 0, 0, 0,255,255,255,255,255,165,165,165,127, 0, 0, 0,255, 0, 0, 0,255,255,255,255,255,160,160,160,100,127,112,112,100, 0, 0, 0, 0, 64, 64, 64,255, 0, 0, 0,255, -241, 88, 0,255, 0, 0, 0, 40,255,140, 25,255, 8, 48, 8,255, 85,187, 85,255,255,255,255,255, 0, 0, 0,255,255,133, 0,255, - 0, 0, 0,255,255,160, 0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,204, 0,153,255, 0, 0, 0, 18,255,133, 0, 60, +241, 88, 0,255, 0, 0, 0, 40,255,170, 64,255, 8, 48, 8,255, 85,187, 85,255,255,255,255,255, 0, 0, 0,255,255,133, 0,255, + 0, 0, 0,255,255,160, 0,255,219, 37, 18,255,32, 255,255,255, 75, 75, 75,255,204, 0,153,255, 0, 0, 0, 18,255,133, 0, 60, 255,133, 0,255, 32, 0, 0,255, 0, 32, 0,255, 0, 0,128,255, 0, 0, 0, 0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80, 0, 0, 0, 0, 0, 0, 0, 0, 96,192, 64,255,144,144, 0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255, 240,144,160,255,255,255,255,255, 0, 0, 0,255,144,144, 0,255, 64,144, 48,255,128, 48, 96,255, 0, 0, 0,255,240,255, 64,255, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 6d4d88da270..6527e0140b8 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -585,7 +585,7 @@ void ui_theme_init_default(void) SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255); SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40); SETCOL(btheme->tv3d.select, 241, 88, 0, 255); - SETCOL(btheme->tv3d.active, 255, 140, 25, 255); + SETCOL(btheme->tv3d.active, 255, 170, 64, 255); SETCOL(btheme->tv3d.group, 8, 48, 8, 255); SETCOL(btheme->tv3d.group_active, 85, 187, 85, 255); SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255); @@ -604,7 +604,7 @@ void ui_theme_init_default(void) SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255); SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128); SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0); - SETCOL(btheme->tv3d.edge_sharp, 255, 32, 32, 255); + SETCOL(btheme->tv3d.edge_sharp, 0, 255, 255, 255); SETCOL(btheme->tv3d.header_text, 0, 0, 0, 255); SETCOL(btheme->tv3d.header_text_hi, 255, 255, 255, 255); SETCOL(btheme->tv3d.button_text, 0, 0, 0, 255); From e55833a0944fdaa78c879228dc993a11b3ca0e9b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 06:40:09 +0000 Subject: [PATCH 058/105] fix [#27572] Mirror Shapekey and Mirror vertex Group not working for Lattice. --- source/blender/blenkernel/BKE_deform.h | 4 +- source/blender/blenkernel/intern/deform.c | 4 +- source/blender/editors/include/ED_mesh.h | 2 +- .../blender/editors/object/object_shapekey.c | 47 ++++++- source/blender/editors/object/object_vgroup.c | 124 ++++++++++++++---- source/blender/makesdna/DNA_lattice_types.h | 2 + 6 files changed, 146 insertions(+), 37 deletions(-) diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index a9ac201beda..64cea929573 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -59,9 +59,9 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index void defvert_copy(struct MDeformVert *dvert_r, const struct MDeformVert *dvert); void defvert_sync(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, int use_verify); -void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, int *flip_map, int use_verify); +void defvert_sync_mapped(struct MDeformVert *dvert_r, const struct MDeformVert *dvert, const int *flip_map, int use_verify); void defvert_remap (struct MDeformVert *dvert, int *map); -void defvert_flip(struct MDeformVert *dvert, int *flip_map); +void defvert_flip(struct MDeformVert *dvert, const int *flip_map); void defvert_normalize(struct MDeformVert *dvert); /* utility function, note that 32 chars is the maximum string length since its only diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 0696653d2e4..11a0a5884ee 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -121,7 +121,7 @@ void defvert_sync (MDeformVert *dvert_r, const MDeformVert *dvert, int use_verif } /* be sure all flip_map values are valid */ -void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, int *flip_map, int use_verify) +void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const int *flip_map, int use_verify) { if(dvert->totweight && dvert_r->totweight) { int i; @@ -170,7 +170,7 @@ void defvert_normalize (MDeformVert *dvert) } } -void defvert_flip (MDeformVert *dvert, int *flip_map) +void defvert_flip (MDeformVert *dvert, const int *flip_map) { MDeformWeight *dw; int i; diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 5c4dfc6ba3d..ade69a00ff8 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -209,7 +209,7 @@ void ED_vgroup_select_by_name(struct Object *ob, const char *name); void ED_vgroup_data_create(struct ID *id); int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from); -void ED_vgroup_mirror(struct Object *ob, int mirror_weights, int flip_vgroups); +void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups); int ED_vgroup_object_is_edit_mode(struct Object *ob); diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 7c59278dcf5..fd2e7fd7c99 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -203,9 +203,9 @@ static int object_shape_key_mirror(bContext *C, Object *ob) fp1= ((float *)kb->data) + i1*3; fp2= ((float *)kb->data) + i2*3; - VECCOPY(tvec, fp1); - VECCOPY(fp1, fp2); - VECCOPY(fp2, tvec); + copy_v3_v3(tvec, fp1); + copy_v3_v3(fp1, fp2); + copy_v3_v3(fp2, tvec); /* flip x axis */ fp1[0] = -fp1[0]; @@ -217,7 +217,46 @@ static int object_shape_key_mirror(bContext *C, Object *ob) mesh_octree_table(ob, NULL, NULL, 'e'); } - /* todo, other types? */ + else if (ob->type == OB_LATTICE) { + Lattice *lt= ob->data; + int i1, i2; + float *fp1, *fp2; + int u, v, w; + /* half but found up odd value */ + const int pntsu_half = (((lt->pntsu / 2) + (lt->pntsu % 2))) ; + + /* currently editmode isnt supported by mesh so + * ignore here for now too */ + + /* if(lt->editlatt) lt= lt->editlatt->latt; */ + + for(w=0; wpntsw; w++) { + for(v=0; vpntsv; v++) { + for(u=0; upntsu - 1) - u; + float tvec[3]; + if(u == u_inv) { + i1= LT_INDEX(lt, u, v, w); + fp1= ((float *)kb->data) + i1*3; + fp1[0]= -fp1[0]; + } + else { + i1= LT_INDEX(lt, u, v, w); + i2= LT_INDEX(lt, u_inv, v, w); + + fp1= ((float *)kb->data) + i1*3; + fp2= ((float *)kb->data) + i2*3; + + copy_v3_v3(tvec, fp1); + copy_v3_v3(fp1, fp2); + copy_v3_v3(fp2, tvec); + fp1[0]= -fp1[0]; + fp2[0]= -fp2[0]; + } + } + } + } + } MEM_freeN(tag_elem); } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 43448198ae1..072c08c7ec0 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1015,55 +1015,75 @@ static void vgroup_clean_all(Object *ob, float eul, int keep_single) if (dvert_array) MEM_freeN(dvert_array); } -void ED_vgroup_mirror(Object *ob, int mirror_weights, int flip_vgroups) + +static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr, + const char sel, const char sel_mirr, + const int *flip_map, + const short mirror_weights, const short flip_vgroups) { + BLI_assert(sel || sel_mirr); + + if(sel_mirr && sel) { + /* swap */ + if(mirror_weights) + SWAP(MDeformVert, *dvert, *dvert_mirr); + if(flip_vgroups) { + defvert_flip(dvert, flip_map); + defvert_flip(dvert_mirr, flip_map); + } + } + else { + /* dvert should always be the target */ + if(sel_mirr) { + SWAP(MDeformVert *, dvert, dvert_mirr); + } + + if(mirror_weights) + defvert_copy(dvert, dvert_mirr); + if(flip_vgroups) { + defvert_flip(dvert, flip_map); + } + } +} + +void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_vgroups) +{ +#define VGROUP_MIRR_OP dvert_mirror_op(dvert, dvert_mirr, sel, sel_mirr, flip_map, mirror_weights, flip_vgroups) + EditVert *eve, *eve_mirr; MDeformVert *dvert, *dvert_mirr; + short sel, sel_mirr; int *flip_map; if(mirror_weights==0 && flip_vgroups==0) return; + flip_map= defgroup_flip_map(ob, 0); + /* only the active group */ if(ob->type == OB_MESH) { Mesh *me= ob->data; EditMesh *em = BKE_mesh_get_editmesh(me); - EM_cache_x_mirror_vert(ob, em); - if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) + if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) { + MEM_freeN(flip_map); return; + } - flip_map= defgroup_flip_map(ob, 0); + EM_cache_x_mirror_vert(ob, em); /* Go through the list of editverts and assign them */ for(eve=em->verts.first; eve; eve=eve->next){ if((eve_mirr=eve->tmp.v)) { - if((eve_mirr->f & SELECT || eve->f & SELECT) && (eve != eve_mirr)) { + sel= eve->f & SELECT; + sel_mirr= eve_mirr->f & SELECT; + + if((sel || sel_mirr) && (eve != eve_mirr)) { dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT); dvert_mirr= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT); if(dvert && dvert_mirr) { - if(eve_mirr->f & SELECT && eve->f & SELECT) { - /* swap */ - if(mirror_weights) - SWAP(MDeformVert, *dvert, *dvert_mirr); - if(flip_vgroups) { - defvert_flip(dvert, flip_map); - defvert_flip(dvert_mirr, flip_map); - } - } - else { - /* dvert should always be the target */ - if(eve_mirr->f & SELECT) { - SWAP(MDeformVert *, dvert, dvert_mirr); - } - - if(mirror_weights) - defvert_copy(dvert, dvert_mirr); - if(flip_vgroups) { - defvert_flip(dvert, flip_map); - } - } + VGROUP_MIRR_OP; } } @@ -1071,10 +1091,58 @@ void ED_vgroup_mirror(Object *ob, int mirror_weights, int flip_vgroups) } } - MEM_freeN(flip_map); - BKE_mesh_end_editmesh(me, em); } + else if (ob->type == OB_LATTICE) { + Lattice *lt= ob->data; + int i1, i2; + int u, v, w; + int pntsu_half; + /* half but found up odd value */ + + if(lt->editlatt) lt= lt->editlatt->latt; + + if(lt->pntsu == 1 || lt->dvert == NULL) { + MEM_freeN(flip_map); + return; + } + + /* unlike editmesh we know that by only looping over the first hald of + * the 'u' indicies it will cover all points except the middle which is + * ok in this case */ + pntsu_half= lt->pntsu / 2; + + for(w=0; wpntsw; w++) { + for(v=0; vpntsv; v++) { + for(u=0; upntsu - 1) - u; + if(u != u_inv) { + BPoint *bp, *bp_mirr; + + i1= LT_INDEX(lt, u, v, w); + i2= LT_INDEX(lt, u_inv, v, w); + + bp= <->def[i1]; + bp_mirr= <->def[i2]; + + sel= bp->f1 & SELECT; + sel_mirr= bp_mirr->f1 & SELECT; + + if(sel || sel_mirr) { + dvert= <->dvert[i1]; + dvert_mirr= <->dvert[i2]; + + VGROUP_MIRR_OP; + } + } + } + } + } + } + + MEM_freeN(flip_map); + +#undef VGROUP_MIRR_OP } static void vgroup_remap_update_users(Object *ob, int *map) diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h index 662ef9e8a45..a9e745b8148 100644 --- a/source/blender/makesdna/DNA_lattice_types.h +++ b/source/blender/makesdna/DNA_lattice_types.h @@ -83,5 +83,7 @@ typedef struct Lattice { #define LT_DS_EXPAND 4 +#define LT_INDEX(lt, u, v, w) ((w) * ((lt)->pntsu * (lt)->pntsv) + ((v) * (lt)->pntsu) + (u)) + #endif From e8bc3fe0e363d53499c1d0e0a56c503069103d41 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 07:29:57 +0000 Subject: [PATCH 059/105] object-mode lattice bounds were not taken into account when calculating min/max. effected view-selected, center-origin & local view. --- source/blender/blenkernel/intern/object.c | 73 ++++++++++++++--------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index d0fbc6247b5..16fa1605467 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2387,24 +2387,42 @@ void object_set_dimensions(Object *ob, const float *value) void minmax_object(Object *ob, float *min, float *max) { BoundBox bb; - Mesh *me; - Curve *cu; float vec[3]; int a; + short change= FALSE; switch(ob->type) { - case OB_CURVE: case OB_FONT: case OB_SURF: - cu= ob->data; - - if(cu->bb==NULL) tex_space_curve(cu); - bb= *(cu->bb); - - for(a=0; a<8; a++) { - mul_m4_v3(ob->obmat, bb.vec[a]); - DO_MINMAX(bb.vec[a], min, max); + { + Curve *cu= ob->data; + + if(cu->bb==NULL) tex_space_curve(cu); + bb= *(cu->bb); + + for(a=0; a<8; a++) { + mul_m4_v3(ob->obmat, bb.vec[a]); + DO_MINMAX(bb.vec[a], min, max); + } + change= TRUE; + } + break; + case OB_LATTICE: + { + Lattice *lt= ob->data; + BPoint *bp= lt->def; + int u, v, w; + + for(w=0; wpntsw; w++) { + for(v=0; vpntsv; v++) { + for(u=0; upntsu; u++, bp++) { + mul_v3_m4v3(vec, ob->obmat, bp->vec); + DO_MINMAX(vec, min, max); + } + } + } + change= TRUE; } break; case OB_ARMATURE: @@ -2416,25 +2434,27 @@ void minmax_object(Object *ob, float *min, float *max) mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); DO_MINMAX(vec, min, max); } - break; + change= TRUE; } - /* no break, get_mesh will give NULL and it passes on to default */ + break; case OB_MESH: - me= get_mesh(ob); - - if(me) { - bb = *mesh_get_bb(ob); - - for(a=0; a<8; a++) { - mul_m4_v3(ob->obmat, bb.vec[a]); - DO_MINMAX(bb.vec[a], min, max); + { + Mesh *me= get_mesh(ob); + + if(me) { + bb = *mesh_get_bb(ob); + + for(a=0; a<8; a++) { + mul_m4_v3(ob->obmat, bb.vec[a]); + DO_MINMAX(bb.vec[a], min, max); + } + change= TRUE; } } - if(min[0] < max[0] ) break; - - /* else here no break!!!, mesh can be zero sized */ - - default: + break; + } + + if(change == FALSE) { DO_MINMAX(ob->obmat[3], min, max); copy_v3_v3(vec, ob->obmat[3]); @@ -2444,7 +2464,6 @@ void minmax_object(Object *ob, float *min, float *max) copy_v3_v3(vec, ob->obmat[3]); sub_v3_v3(vec, ob->size); DO_MINMAX(vec, min, max); - break; } } From 7b9eabb6f202e116e11341f1b6f1c703823a941e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 08:40:47 +0000 Subject: [PATCH 060/105] fix from nico_ga on IRC, building on MSVC with jack but not ffmpeg. --- build_files/scons/config/win32-vc-config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 65076be85ed..a0dade8bdf6 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -35,7 +35,7 @@ BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib' WITH_BF_JACK = False BF_JACK = LIBDIR + '/jack' -BF_JACK_INC = '${BF_JACK}/include' +BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc' BF_JACK_LIB = 'libjack' BF_JACK_LIBPATH = '${BF_JACK}/lib' From 2f5c7623b08027a7bb0d433333ad62c787c05cbf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 08:43:17 +0000 Subject: [PATCH 061/105] fix/workaround [#27559] Color picker fails with a very small brush fade out small brushes so the brush wont interfere with the color directly under the cursor. --- .../editors/sculpt_paint/paint_image.c | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index db0d2314ad0..e0877fafbaa 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5012,31 +5012,45 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { +#define PX_SIZE_FADE_MAX 12.0f +#define PX_SIZE_FADE_MIN 4.0f + Brush *brush= image_paint_brush(C); Paint *paint= paint_get_active(CTX_data_scene(C)); - if(paint && brush) { + if(paint && brush && paint->flags & PAINT_SHOW_BRUSH) { float zoomx, zoomy; + const float size= (float)brush_size(brush); + const short use_zoom= get_imapaint_zoom(C, &zoomx, &zoomy); + const float pixel_size= MAX2(size * zoomx, size * zoomy); + float alpha= 0.5f; - if(!(paint->flags & PAINT_SHOW_BRUSH)) + /* fade out the brush (cheap trick to work around brush interfearing with sampling [#])*/ + if(pixel_size < PX_SIZE_FADE_MIN) { return; + } + else if (pixel_size < PX_SIZE_FADE_MAX) { + alpha *= (pixel_size - PX_SIZE_FADE_MIN) / (PX_SIZE_FADE_MAX - PX_SIZE_FADE_MIN); + } glPushMatrix(); glTranslatef((float)x, (float)y, 0.0f); - if(get_imapaint_zoom(C, &zoomx, &zoomy)) + if(use_zoom) glScalef(zoomx, zoomy, 1.0f); - glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], 0.5f); + glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], alpha); glEnable( GL_LINE_SMOOTH ); glEnable(GL_BLEND); - glutil_draw_lined_arc(0, (float)(M_PI*2.0), (float)brush_size(brush), 40); + glutil_draw_lined_arc(0, (float)(M_PI*2.0), size, 40); glDisable(GL_BLEND); glDisable( GL_LINE_SMOOTH ); glPopMatrix(); } +#undef PX_SIZE_FADE_MAX +#undef PX_SIZE_FADE_MIN } static void toggle_paint_cursor(bContext *C, int enable) From 6a1e74418ce0cb19bea51354a46ec77f73f4eb8b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 09:12:03 +0000 Subject: [PATCH 062/105] use the same stippled drawing for colorband background as alpha color swatches, with low DPI would look squashed, also use the same colors for both. --- .../editors/interface/interface_draw.c | 23 ++++++++------- .../editors/interface/interface_intern.h | 5 ++++ .../editors/interface/interface_widgets.c | 28 +++++++++---------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 710d4d58825..c7f11116834 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1120,7 +1120,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) ColorBand *coba; CBData *cbd; float x1, y1, sizex, sizey; - float dx, v3[2], v1[2], v2[2], v1a[2], v2a[2]; + float v3[2], v1[2], v2[2], v1a[2], v2a[2]; int a; float pos, colf[4]= {0,0,0,0}; /* initialize incase the colorband isnt valid */ @@ -1131,18 +1131,17 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) y1= rect->ymin; sizex= rect->xmax-x1; sizey= rect->ymax-y1; - + /* first background, to show tranparency */ - dx= sizex/12.0f; - v1[0]= x1; - for(a=0; a<12; a++) { - if(a & 1) glColor3f(0.3, 0.3, 0.3); else glColor3f(0.8, 0.8, 0.8); - glRectf(v1[0], y1, v1[0]+dx, y1+0.5f*sizey); - if(a & 1) glColor3f(0.8, 0.8, 0.8); else glColor3f(0.3, 0.3, 0.3); - glRectf(v1[0], y1+0.5f*sizey, v1[0]+dx, y1+sizey); - v1[0]+= dx; - } - + + glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255); + glRectf(x1, y1, x1+sizex, y1+sizey); + glEnable(GL_POLYGON_STIPPLE); + glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255); + glPolygonStipple(checker_stipple_sml); + glRectf(x1, y1, x1+sizex, y1+sizey); + glDisable(GL_POLYGON_STIPPLE); + glShadeModel(GL_FLAT); glEnable(GL_BLEND); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 3f3665aae38..8475090b468 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -486,6 +486,11 @@ void ui_widget_color_init(struct ThemeUI *tui); void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state); void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state); +extern unsigned char checker_stipple_sml[]; +/* used for transp checkers */ +#define UI_TRANSP_DARK 100 +#define UI_TRANSP_LIGHT 160 + /* interface_style.c */ void uiStyleInit(void); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index f767a432cd0..41bb12e4433 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -159,6 +159,18 @@ static float check_tria_vert[6][2]= { static int check_tria_face[4][3]= { {3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}}; +GLubyte checker_stipple_sml[32*32/8] = +{ + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ +}; + /* ************************************************* */ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3) @@ -614,22 +626,10 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) if(wtb->inner) { if(wcol->shaded==0) { if (wcol->alpha_check) { - GLubyte checker_stipple_sml[32*32/8] = - { - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ - }; - float x_mid= 0.0f; /* used for dumb clamping of values */ /* dark checkers */ - glColor4ub(100, 100, 100, 255); + glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255); glBegin(GL_POLYGON); for(a=0; atotvert; a++) { glVertex2fv(wtb->inner_v[a]); @@ -638,7 +638,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) /* light checkers */ glEnable(GL_POLYGON_STIPPLE); - glColor4ub(160, 160, 160, 255); + glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255); glPolygonStipple(checker_stipple_sml); glBegin(GL_POLYGON); for(a=0; atotvert; a++) { From 4d0026f7b9995a9d51fc485f83b8d68a30362fbc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 10:08:27 +0000 Subject: [PATCH 063/105] fix for 2D paint being off by 1 pixel on x/y axis, most obvious when zoomed in. --- .../editors/sculpt_paint/paint_image.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index e0877fafbaa..d7e8d3be66f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4255,8 +4255,8 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) static void imapaint_convert_brushco(ImBuf *ibufb, float *pos, int *ipos) { - ipos[0]= (int)(pos[0] - ibufb->x/2); - ipos[1]= (int)(pos[1] - ibufb->y/2); + ipos[0]= (int)floorf((pos[0] - ibufb->x/2) + 1.0f); + ipos[1]= (int)floorf((pos[1] - ibufb->y/2) + 1.0f); } /* dosnt run for projection painting @@ -4863,12 +4863,7 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) PointerRNA itemptr; float pressure, mousef[2]; double time; - int tablet, mouse[2]; - - // XXX +1 matches brush location better but - // still not exact, find out why and fix .. - mouse[0]= event->mval[0] + 1; - mouse[1]= event->mval[1] + 1; + int tablet; time= PIL_check_seconds_timer(); @@ -4888,8 +4883,8 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) pressure= pop->prev_pressure ? pop->prev_pressure : 1.0f; if(pop->first) { - pop->prevmouse[0]= mouse[0]; - pop->prevmouse[1]= mouse[1]; + pop->prevmouse[0]= event->mval[0]; + pop->prevmouse[1]= event->mval[1]; pop->starttime= time; /* special exception here for too high pressure values on first touch in @@ -4908,8 +4903,8 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) /* fill in stroke */ RNA_collection_add(op->ptr, "stroke", &itemptr); - mousef[0] = (float)(mouse[0]); - mousef[1] = (float)(mouse[1]); + mousef[0] = (float)(event->mval[0]); + mousef[1] = (float)(event->mval[1]); RNA_float_set_array(&itemptr, "mouse", mousef); RNA_float_set(&itemptr, "time", (float)(time - pop->starttime)); RNA_float_set(&itemptr, "pressure", pressure); From a43309e8d4fc09d31acb4030b13f1c22c9ddf22a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 6 Jun 2011 11:04:54 +0000 Subject: [PATCH 064/105] Added cancel callbacks to modal operators which allocates memory in invoke callback. This prevents unfreed memory blocks when quiting Bledner with modal operator running. --- .../editors/animation/anim_channels_edit.c | 1 + .../blender/editors/animation/anim_markers.c | 7 +- source/blender/editors/animation/anim_ops.c | 1 + source/blender/editors/interface/view2d_ops.c | 20 ++++- source/blender/editors/mesh/editmesh_loop.c | 1 + source/blender/editors/screen/screen_ops.c | 20 +++++ .../editors/sculpt_paint/paint_intern.h | 1 + .../editors/sculpt_paint/paint_stroke.c | 13 ++++ .../editors/sculpt_paint/paint_vertex.c | 16 ++++ source/blender/editors/sculpt_paint/sculpt.c | 19 +++++ .../editors/space_action/action_select.c | 1 + source/blender/editors/space_file/file_ops.c | 1 + .../editors/space_graph/graph_select.c | 1 + .../blender/editors/space_image/image_ops.c | 1 + .../blender/editors/space_info/info_report.c | 1 + .../editors/space_logic/logic_buttons.c | 1 + source/blender/editors/space_nla/nla_select.c | 1 + source/blender/editors/space_node/node_edit.c | 31 ++++++++ .../blender/editors/space_node/node_select.c | 1 + .../editors/space_sequencer/sequencer_edit.c | 1 + .../space_sequencer/sequencer_select.c | 1 + .../editors/space_view3d/view3d_edit.c | 34 ++++++++ .../editors/space_view3d/view3d_select.c | 3 + source/blender/editors/uvedit/uvedit_ops.c | 2 + source/blender/windowmanager/WM_api.h | 5 ++ .../windowmanager/intern/wm_operators.c | 77 +++++++++++++++---- 26 files changed, 242 insertions(+), 19 deletions(-) diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index f755df79986..9145cc2b79d 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1881,6 +1881,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= animchannels_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= animedit_poll_channels_nla_tweakmode_off; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index c802ba621f1..c6e55427034 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -717,7 +717,7 @@ static void ed_marker_move_apply(wmOperator *op) } /* only for modal */ -static void ed_marker_move_cancel(bContext *C, wmOperator *op) +static int ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); ed_marker_move_apply(op); @@ -725,6 +725,8 @@ static void ed_marker_move_cancel(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL); + + return OPERATOR_CANCELLED; } @@ -886,6 +888,7 @@ static void MARKER_OT_move(wmOperatorType *ot) ot->invoke= ed_marker_move_invoke_wrapper; ot->modal= ed_marker_move_modal; ot->poll= ed_markers_poll_selected_markers; + ot->cancel= ed_marker_move_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -980,6 +983,7 @@ static void MARKER_OT_duplicate(wmOperatorType *ot) ot->invoke= ed_marker_duplicate_invoke_wrapper; ot->modal= ed_marker_move_modal; ot->poll= ed_markers_poll_selected_markers; + ot->cancel= ed_marker_move_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1185,6 +1189,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot) ot->exec= ed_marker_border_select_exec; ot->invoke= ed_marker_select_border_invoke_wrapper; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ed_markers_poll_markers_exist; diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 93d99c59a0e..0e0bf275d8f 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -224,6 +224,7 @@ static void ANIM_OT_previewrange_set(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= previewrange_define_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_animview_active; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index f7bff168a33..434334258af 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -876,6 +876,13 @@ static void view_zoomdrag_exit(bContext *C, wmOperator *op) } } +static int view_zoomdrag_cancel(bContext *C, wmOperator *op) +{ + view_zoomdrag_exit(C, op); + + return OPERATOR_CANCELLED; +} + /* for 'redo' only, with no user input */ static int view_zoomdrag_exec(bContext *C, wmOperator *op) { @@ -1065,6 +1072,7 @@ static void VIEW2D_OT_zoom(wmOperatorType *ot) ot->exec= view_zoomdrag_exec; ot->invoke= view_zoomdrag_invoke; ot->modal= view_zoomdrag_modal; + ot->cancel= view_zoomdrag_cancel; ot->poll= view_zoom_poll; @@ -1165,6 +1173,7 @@ static void VIEW2D_OT_zoom_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= view_borderzoom_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= view_zoom_poll; @@ -1352,7 +1361,14 @@ static void scroller_activate_exit(bContext *C, wmOperator *op) ED_region_tag_redraw(CTX_wm_region(C)); } -} +} + +static int scroller_activate_cancel(bContext *C, wmOperator *op) +{ + scroller_activate_exit(C, op); + + return OPERATOR_CANCELLED; +} /* apply transform to view (i.e. adjust 'cur' rect) */ static void scroller_activate_apply(bContext *C, wmOperator *op) @@ -1561,6 +1577,8 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot) /* api callbacks */ ot->invoke= scroller_activate_invoke; ot->modal= scroller_activate_modal; + ot->cancel= scroller_activate_cancel; + ot->poll= view2d_poll; } diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index d7e59e0a68f..32971ca77ed 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -716,6 +716,7 @@ void MESH_OT_knife_cut(wmOperatorType *ot) ot->invoke= WM_gesture_lines_invoke; ot->modal= WM_gesture_lines_modal; ot->exec= knife_cut_exec; + ot->cancel= WM_gesture_lines_cancel; ot->poll= EM_view3d_poll; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 9e840e75578..4e67069185e 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -627,6 +627,13 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +static int actionzone_cancel(bContext *UNUSED(C), wmOperator *op) +{ + actionzone_exit(op); + + return OPERATOR_CANCELLED; +} + static void SCREEN_OT_actionzone(wmOperatorType *ot) { /* identifiers */ @@ -637,6 +644,7 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot) ot->invoke= actionzone_invoke; ot->modal= actionzone_modal; ot->poll= actionzone_area_poll; + ot->cancel= actionzone_cancel; ot->flag= OPTYPE_BLOCKING; @@ -759,6 +767,7 @@ static void SCREEN_OT_area_swap(wmOperatorType *ot) ot->invoke= area_swap_invoke; ot->modal= area_swap_modal; ot->poll= ED_operator_areaactive; + ot->cancel= area_swap_cancel; ot->flag= OPTYPE_BLOCKING; } @@ -1494,6 +1503,7 @@ static void SCREEN_OT_area_split(wmOperatorType *ot) ot->exec= area_split_exec; ot->invoke= area_split_invoke; ot->modal= area_split_modal; + ot->cancel= area_split_cancel; ot->poll= screen_active_editable; ot->flag= OPTYPE_BLOCKING; @@ -1693,6 +1703,13 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +int region_scale_cancel(bContext *UNUSED(C), wmOperator *op) +{ + MEM_freeN(op->customdata); + op->customdata = NULL; + + return OPERATOR_CANCELLED; +} static void SCREEN_OT_region_scale(wmOperatorType *ot) { @@ -1703,6 +1720,7 @@ static void SCREEN_OT_region_scale(wmOperatorType *ot) ot->invoke= region_scale_invoke; ot->modal= region_scale_modal; + ot->cancel= region_scale_cancel; ot->poll= ED_operator_areaactive; @@ -2257,6 +2275,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) ot->invoke= area_join_invoke; ot->modal= area_join_modal; ot->poll= screen_active_editable; + ot->cancel= area_join_cancel; ot->flag= OPTYPE_BLOCKING; @@ -3053,6 +3072,7 @@ static void SCREEN_OT_border_select(wmOperatorType *ot) ot->exec= border_select_do; ot->invoke= WM_border_select_invoke; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_areaactive; diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index bb877e4b1ee..5a0ee19d6c9 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -65,6 +65,7 @@ int paint_space_stroke_enabled(struct Brush *br); int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); int paint_stroke_exec(struct bContext *C, struct wmOperator *op); +int paint_stroke_cancel(struct bContext *C, struct wmOperator *op); struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke); void *paint_stroke_mode_data(struct PaintStroke *stroke); void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 58c3446673c..7ddf5dff000 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -916,6 +916,19 @@ int paint_stroke_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +int paint_stroke_cancel(bContext *C, wmOperator *op) +{ + PaintStroke *stroke = op->customdata; + + if(stroke->done) + stroke->done(C, stroke); + + MEM_freeN(stroke); + op->customdata = NULL; + + return OPERATOR_CANCELLED; +} + ViewContext *paint_stroke_view_context(PaintStroke *stroke) { return &stroke->vc; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index c35b742eb9e..3da19ba7346 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1600,6 +1600,13 @@ static int wpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +static int wpaint_cancel(bContext *C, wmOperator *op) +{ + paint_stroke_cancel(C, op); + + return OPERATOR_CANCELLED; +} + void PAINT_OT_weight_paint(wmOperatorType *ot) { @@ -1612,6 +1619,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) ot->modal= paint_stroke_modal; /* ot->exec= vpaint_exec; <-- needs stroke property */ ot->poll= weight_paint_poll; + ot->cancel= wpaint_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; @@ -1892,6 +1900,13 @@ static int vpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +static int vpaint_cancel(bContext *C, wmOperator *op) +{ + paint_stroke_cancel(C, op); + + return OPERATOR_CANCELLED; +} + void PAINT_OT_vertex_paint(wmOperatorType *ot) { /* identifiers */ @@ -1903,6 +1918,7 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot) ot->modal= paint_stroke_modal; /* ot->exec= vpaint_exec; <-- needs stroke property */ ot->poll= vertex_paint_poll; + ot->cancel= vpaint_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 20e74702067..cab8c522a89 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3559,6 +3559,24 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } +static int sculpt_brush_stroke_cacel(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_active_object(C); + SculptSession *ss = ob->sculpt; + Sculpt *sd = CTX_data_tool_settings(C)->sculpt; + + paint_stroke_cancel(C, op); + + if(ss->cache) { + sculpt_cache_free(ss->cache); + ss->cache = NULL; + } + + sculpt_brush_exit_tex(sd); + + return OPERATOR_CANCELLED; +} + static void SCULPT_OT_brush_stroke(wmOperatorType *ot) { static EnumPropertyItem stroke_mode_items[] = { @@ -3577,6 +3595,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot) ot->modal= paint_stroke_modal; ot->exec= sculpt_brush_stroke_exec; ot->poll= sculpt_poll; + ot->cancel= sculpt_brush_stroke_cacel; /* flags (sculpt does own undo? (ton) */ ot->flag= OPTYPE_BLOCKING; diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index be8547afa23..4d0043913ab 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -332,6 +332,7 @@ void ACTION_OT_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= actkeys_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_action_active; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 9662b4b401f..a5d516a1417 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -301,6 +301,7 @@ void FILE_OT_select_border(wmOperatorType *ot) ot->exec= file_border_select_exec; ot->modal= file_border_select_modal; ot->poll= ED_operator_file_active; + ot->cancel= WM_border_select_cancel; /* rna */ WM_operator_properties_gesture_border(ot, 0); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 76883027df1..cb799b85d3a 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -344,6 +344,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= graphkeys_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= graphop_visible_keyframes_poll; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index f48daa39c59..10b8cb238aa 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1925,6 +1925,7 @@ void IMAGE_OT_sample_line(wmOperatorType *ot) ot->modal= WM_gesture_straightline_modal; ot->exec= sample_line_exec; ot->poll= space_image_main_area_poll; + ot->cancel= WM_gesture_straightline_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 937b683e880..c8bda434227 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -302,6 +302,7 @@ void INFO_OT_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_info_active; diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index e894fd9cff5..16e916928a9 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -206,6 +206,7 @@ void LOGIC_OT_links_cut(wmOperatorType *ot) ot->invoke= WM_gesture_lines_invoke; ot->modal= WM_gesture_lines_modal; ot->exec= cut_links_exec; + ot->cancel= WM_gesture_lines_cancel; ot->poll= ED_operator_logic_active; diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 0f0a4c0ad4c..8ef63b9a83d 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -333,6 +333,7 @@ void NLA_OT_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= nlaedit_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= nlaop_poll_tweakmode_off; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index d967e2240e6..99f2ea99efc 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1086,6 +1086,13 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +static int snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op) +{ + MEM_freeN(op->customdata); + op->customdata= NULL; + + return OPERATOR_CANCELLED; +} void NODE_OT_backimage_move(wmOperatorType *ot) { @@ -1098,6 +1105,7 @@ void NODE_OT_backimage_move(wmOperatorType *ot) ot->invoke= snode_bg_viewmove_invoke; ot->modal= snode_bg_viewmove_modal; ot->poll= composite_node_active; + ot->cancel= snode_bg_viewmove_cancel; /* flags */ ot->flag= OPTYPE_BLOCKING; @@ -1384,6 +1392,14 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH; } +static int node_resize_cancel(bContext *UNUSED(C), wmOperator *op) +{ + MEM_freeN(op->customdata); + op->customdata= NULL; + + return OPERATOR_CANCELLED; +} + void NODE_OT_resize(wmOperatorType *ot) { /* identifiers */ @@ -1394,6 +1410,7 @@ void NODE_OT_resize(wmOperatorType *ot) ot->invoke= node_resize_invoke; ot->modal= node_resize_modal; ot->poll= ED_operator_node_active; + ot->cancel= node_resize_cancel; /* flags */ ot->flag= OPTYPE_BLOCKING; @@ -2279,6 +2296,18 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event) } } +static int node_link_cancel(bContext *C, wmOperator *op) +{ + SpaceNode *snode= CTX_wm_space_node(C); + bNodeLinkDrag *nldrag= op->customdata; + + nodeRemLink(snode->edittree, nldrag->link); + BLI_remlink(&snode->linkdrag, nldrag); + MEM_freeN(nldrag); + + return OPERATOR_CANCELLED; +} + void NODE_OT_link(wmOperatorType *ot) { /* identifiers */ @@ -2290,6 +2319,7 @@ void NODE_OT_link(wmOperatorType *ot) ot->modal= node_link_modal; // ot->exec= node_link_exec; ot->poll= ED_operator_node_active; + ot->cancel= node_link_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; @@ -2402,6 +2432,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) ot->invoke= WM_gesture_lines_invoke; ot->modal= WM_gesture_lines_modal; ot->exec= cut_links_exec; + ot->cancel= WM_gesture_lines_cancel; ot->poll= ED_operator_node_active; diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index a1ef75f3976..1abcaccc939 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -215,6 +215,7 @@ void NODE_OT_select_border(wmOperatorType *ot) ot->invoke= node_border_select_invoke; ot->exec= node_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_node_active; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 71ed7928bc8..6900271deea 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2817,6 +2817,7 @@ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot) ot->exec= view_ghost_border_exec; ot->modal= WM_border_select_modal; ot->poll= sequencer_view_poll; + ot->cancel= WM_border_select_cancel; /* flags */ ot->flag= 0; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 8b4bfb2e042..8d5f372f55e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -871,6 +871,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= sequencer_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_sequencer_active; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 31aae28dd61..9ff73767b4c 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -904,6 +904,13 @@ static int view3d_camera_active_poll(bContext *C) return 0; } +static int viewrotate_cancel(bContext *C, wmOperator *op) +{ + viewops_data_free(C, op); + + return OPERATOR_CANCELLED; +} + void VIEW3D_OT_rotate(wmOperatorType *ot) { @@ -916,6 +923,7 @@ void VIEW3D_OT_rotate(wmOperatorType *ot) ot->invoke= viewrotate_invoke; ot->modal= viewrotate_modal; ot->poll= ED_operator_region_view3d_active; + ot->cancel= viewrotate_cancel; /* flags */ ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -1058,6 +1066,13 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) } } +static int viewmove_cancel(bContext *C, wmOperator *op) +{ + viewops_data_free(C, op); + + return OPERATOR_CANCELLED; +} + void VIEW3D_OT_move(wmOperatorType *ot) { @@ -1070,6 +1085,7 @@ void VIEW3D_OT_move(wmOperatorType *ot) ot->invoke= viewmove_invoke; ot->modal= viewmove_modal; ot->poll= ED_operator_view3d_active; + ot->cancel= viewmove_cancel; /* flags */ ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -1414,6 +1430,12 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } +static int viewzoom_cancel(bContext *C, wmOperator *op) +{ + viewops_data_free(C, op); + + return OPERATOR_CANCELLED; +} void VIEW3D_OT_zoom(wmOperatorType *ot) { @@ -1427,6 +1449,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) ot->exec= viewzoom_exec; ot->modal= viewzoom_modal; ot->poll= ED_operator_region_view3d_active; + ot->cancel= viewzoom_cancel; /* flags */ ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -1641,6 +1664,13 @@ static int viewdolly_poll(bContext *C) return 0; } +static int viewdolly_cancel(bContext *C, wmOperator *op) +{ + viewops_data_free(C, op); + + return OPERATOR_CANCELLED; +} + void VIEW3D_OT_dolly(wmOperatorType *ot) { /* identifiers */ @@ -1653,6 +1683,7 @@ void VIEW3D_OT_dolly(wmOperatorType *ot) ot->exec= viewdolly_exec; ot->modal= viewdolly_modal; ot->poll= viewdolly_poll; + ot->cancel= viewdolly_cancel; /* flags */ ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -2046,6 +2077,7 @@ void VIEW3D_OT_render_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= render_border_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= view3d_camera_active_poll; @@ -2201,6 +2233,7 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot) ot->invoke= view3d_zoom_border_invoke; ot->exec= view3d_zoom_border_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_region_view3d_active; @@ -2839,6 +2872,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) ot->invoke= view3d_clipping_invoke; ot->exec= view3d_clipping_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_region_view3d_active; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index fb3c0a63b7d..6391db7ae5e 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -875,6 +875,7 @@ void VIEW3D_OT_select_lasso(wmOperatorType *ot) ot->modal= WM_gesture_lasso_modal; ot->exec= view3d_lasso_select_exec; ot->poll= view3d_selectable_data; + ot->cancel= WM_gesture_lasso_cancel; /* flags */ ot->flag= OPTYPE_UNDO; @@ -1829,6 +1830,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) ot->exec= view3d_borderselect_exec; ot->modal= WM_border_select_modal; ot->poll= view3d_selectable_data; + ot->cancel= WM_border_select_cancel; /* flags */ ot->flag= OPTYPE_UNDO; @@ -2308,6 +2310,7 @@ void VIEW3D_OT_select_circle(wmOperatorType *ot) ot->modal= WM_gesture_circle_modal; ot->exec= view3d_circle_select_exec; ot->poll= view3d_selectable_data; + ot->cancel= WM_gesture_circle_cancel; /* flags */ ot->flag= OPTYPE_UNDO; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 66b1e7d412b..c09f8cff02d 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2221,6 +2221,7 @@ static void UV_OT_select_border(wmOperatorType *ot) ot->exec= border_select_exec; ot->modal= WM_border_select_modal; ot->poll= ED_operator_image_active; /* requires space image */; + ot->cancel= WM_border_select_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -2310,6 +2311,7 @@ static void UV_OT_circle_select(wmOperatorType *ot) ot->modal= WM_gesture_circle_modal; ot->exec= circle_select_exec; ot->poll= ED_operator_image_active; /* requires space image */; + ot->cancel= WM_gesture_circle_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 3f9a3f636d0..67294a8eb53 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -278,14 +278,19 @@ void WM_menutype_free(void); /* default operator callbacks for border/circle/lasso */ int WM_border_select_invoke (struct bContext *C, struct wmOperator *op, struct wmEvent *event); int WM_border_select_modal (struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int WM_border_select_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_circle_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event); int WM_gesture_circle_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int WM_gesture_circle_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_lines_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event); int WM_gesture_lines_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int WM_gesture_lines_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_lasso_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event); int WM_gesture_lasso_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int WM_gesture_lasso_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_straightline_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event); int WM_gesture_straightline_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); +int WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op); /* default operator for arearegions, generates event */ void WM_OT_tweak_gesture(struct wmOperatorType *ot); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 6959231a2fa..07739982763 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2244,6 +2244,13 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +int WM_border_select_cancel(bContext *C, wmOperator *op) +{ + wm_gesture_end(C, op); + + return OPERATOR_CANCELLED; +} + /* **************** circle gesture *************** */ /* works now only for selection or modal paint stuff, calls exec while hold mouse, exit on release */ @@ -2340,6 +2347,13 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +int WM_gesture_circle_cancel(bContext *C, wmOperator *op) +{ + wm_gesture_end(C, op); + + return OPERATOR_CANCELLED; +} + #if 0 /* template to copy from */ void WM_OT_circle_gesture(wmOperatorType *ot) @@ -2556,6 +2570,20 @@ int WM_gesture_lines_modal(bContext *C, wmOperator *op, wmEvent *event) return WM_gesture_lasso_modal(C, op, event); } +int WM_gesture_lasso_cancel(bContext *C, wmOperator *op) +{ + wm_gesture_end(C, op); + + return OPERATOR_CANCELLED; +} + +int WM_gesture_lines_cancel(bContext *C, wmOperator *op) +{ + wm_gesture_end(C, op); + + return OPERATOR_CANCELLED; +} + #if 0 /* template to copy from */ @@ -2677,6 +2705,13 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +int WM_gesture_straightline_cancel(bContext *C, wmOperator *op) +{ + wm_gesture_end(C, op); + + return OPERATOR_CANCELLED; +} + #if 0 /* template to copy from */ void WM_OT_straightline_gesture(wmOperatorType *ot) @@ -3060,6 +3095,28 @@ static void radial_control_set_value(RadialControl *rc, float val) } } +static int radial_control_cancel(bContext *C, wmOperator *op) +{ + RadialControl *rc = op->customdata; + wmWindowManager *wm = CTX_wm_manager(C); + + WM_paint_cursor_end(wm, rc->cursor); + + /* restore original paint cursors */ + wm->paintcursors = rc->orig_paintcursors; + + /* not sure if this is a good notifier to use; + intended purpose is to update the UI so that the + new value is displayed in sliders/numfields */ + WM_event_add_notifier(C, NC_WINDOW, NULL); + + glDeleteTextures(1, &rc->gltex); + + MEM_freeN(rc); + + return OPERATOR_CANCELLED; +} + static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) { RadialControl *rc = op->customdata; @@ -3125,23 +3182,8 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(CTX_wm_region(C)); - if(ret != OPERATOR_RUNNING_MODAL) { - wm = CTX_wm_manager(C); - - WM_paint_cursor_end(wm, rc->cursor); - - /* restore original paint cursors */ - wm->paintcursors = rc->orig_paintcursors; - - /* not sure if this is a good notifier to use; - intended purpose is to update the UI so that the - new value is displayed in sliders/numfields */ - WM_event_add_notifier(C, NC_WINDOW, NULL); - - glDeleteTextures(1, &rc->gltex); - - MEM_freeN(rc); - } + if(ret != OPERATOR_RUNNING_MODAL) + radial_control_cancel(C, op); return ret; } @@ -3153,6 +3195,7 @@ static void WM_OT_radial_control(wmOperatorType *ot) ot->invoke= radial_control_invoke; ot->modal= radial_control_modal; + ot->cancel= radial_control_cancel; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; From fc6dcdf17f6f3c313a9c15fbfd38754edbf8ab64 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 11:56:54 +0000 Subject: [PATCH 065/105] bug [#27582] Screen Editing > Split and Join area don't work. added 'INTERNAL' operator flag so operators which are only meant to be called by other operators or internal use are not displayed to the user. Currently only use this flag for the operator search toolbox, is ignored in debug mode. --- release/scripts/startup/bl_operators/wm.py | 29 ++++++++++--------- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/editors/util/undo.c | 2 ++ source/blender/makesrna/intern/rna_wm.c | 3 +- source/blender/windowmanager/WM_types.h | 4 +++ .../windowmanager/intern/wm_operators.c | 7 ++++- 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 3f4a061c4ac..fcc30ecbb4b 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -106,7 +106,7 @@ class WM_OT_context_set_boolean(bpy.types.Operator): '''Set a context value.''' bl_idname = "wm.context_set_boolean" bl_label = "Context Set Boolean" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = BoolProperty(name="Value", @@ -119,7 +119,7 @@ class WM_OT_context_set_int(bpy.types.Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_int" bl_label = "Context Set" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = IntProperty(name="Value", description="Assign value", default=0) @@ -132,7 +132,7 @@ class WM_OT_context_scale_int(bpy.types.Operator): '''Scale an int context value.''' bl_idname = "wm.context_scale_int" bl_label = "Context Set" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = FloatProperty(name="Value", description="Assign value", default=1.0) @@ -168,7 +168,7 @@ class WM_OT_context_set_float(bpy.types.Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_float" bl_label = "Context Set Float" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = FloatProperty(name="Value", @@ -182,7 +182,7 @@ class WM_OT_context_set_string(bpy.types.Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_string" bl_label = "Context Set String" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = StringProperty(name="Value", @@ -195,7 +195,7 @@ class WM_OT_context_set_enum(bpy.types.Operator): '''Set a context value.''' bl_idname = "wm.context_set_enum" bl_label = "Context Set Enum" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = StringProperty(name="Value", @@ -209,7 +209,7 @@ class WM_OT_context_set_value(bpy.types.Operator): '''Set a context value.''' bl_idname = "wm.context_set_value" bl_label = "Context Set Value" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = StringProperty(name="Value", @@ -227,7 +227,7 @@ class WM_OT_context_toggle(bpy.types.Operator): '''Toggle a context value.''' bl_idname = "wm.context_toggle" bl_label = "Context Toggle" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop @@ -246,7 +246,7 @@ class WM_OT_context_toggle_enum(bpy.types.Operator): '''Toggle a context value.''' bl_idname = "wm.context_toggle_enum" bl_label = "Context Toggle Values" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value_1 = StringProperty(name="Value", \ @@ -273,7 +273,7 @@ class WM_OT_context_cycle_int(bpy.types.Operator): '''vertex keys, groups' etc.''' bl_idname = "wm.context_cycle_int" bl_label = "Context Int Cycle" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop reverse = rna_reverse_prop @@ -307,7 +307,7 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): '''Toggle a context value.''' bl_idname = "wm.context_cycle_enum" bl_label = "Context Enum Cycle" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop reverse = rna_reverse_prop @@ -360,7 +360,7 @@ class WM_OT_context_cycle_array(bpy.types.Operator): Useful for cycling the active mesh edit mode.''' bl_idname = "wm.context_cycle_array" bl_label = "Context Array Cycle" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop reverse = rna_reverse_prop @@ -406,7 +406,7 @@ class WM_MT_context_menu_enum(bpy.types.Menu): class WM_OT_context_menu_enum(bpy.types.Operator): bl_idname = "wm.context_menu_enum" bl_label = "Context Enum Menu" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop def execute(self, context): @@ -420,7 +420,7 @@ class WM_OT_context_set_id(bpy.types.Operator): '''Toggle a context value.''' bl_idname = "wm.context_set_id" bl_label = "Set Library ID" - bl_options = {'UNDO'} + bl_options = {'UNDO', 'INTERNAL'} data_path = rna_path_prop value = StringProperty(name="Value", @@ -462,6 +462,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): '''Adjust arbitrary values with mouse input''' bl_idname = "wm.context_modal_mouse" bl_label = "Context Modal Mouse" + bl_options = {'INTERNAL'} data_path_iter = StringProperty(description="The data path relative to the context, must point to an iterable.") data_path_item = StringProperty(description="The data path from each iterable to the value (int or float)") diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 4e67069185e..f016fb6822a 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2277,7 +2277,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) ot->poll= screen_active_editable; ot->cancel= area_join_cancel; - ot->flag= OPTYPE_BLOCKING; + ot->flag= OPTYPE_BLOCKING|OPTYPE_INTERNAL; /* rna */ RNA_def_int(ot->srna, "min_x", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX); diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 692a19a7198..24a868891de 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -307,6 +307,8 @@ void ED_OT_undo_push(wmOperatorType *ot) /* api callbacks */ ot->exec= ed_undo_push_exec; + ot->flag= OPTYPE_INTERNAL; + RNA_def_string(ot->srna, "message", "Add an undo step *function may be moved*", MAXUNDONAME, "Undo Message", ""); } diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 406ee6b3f3e..fc3039c8752 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -272,10 +272,11 @@ EnumPropertyItem keymap_modifiers_items[] = { EnumPropertyItem operator_flag_items[] = { {OPTYPE_REGISTER, "REGISTER", 0, "Register", ""}, {OPTYPE_UNDO, "UNDO", 0, "Undo", ""}, - {OPTYPE_BLOCKING, "BLOCKING", 0, "Finished", ""}, + {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", ""}, {OPTYPE_MACRO, "MACRO", 0, "Macro", ""}, {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""}, {OPTYPE_PRESET, "PRESET", 0, "Preset", ""}, + {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem operator_return_items[] = { diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index ab68c6ef4d4..49bd3ede37d 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -61,6 +61,10 @@ struct ImBuf; #define OPTYPE_MACRO 8 #define OPTYPE_GRAB_POINTER 16 /* */ #define OPTYPE_PRESET 32 /* show preset menu */ +#define OPTYPE_INTERNAL 64 /* some operators are mainly for internal use + * and don't make sense to be accessed from the + * search menu, even if poll() returns TRUE. + * currently only used for the search toolbox */ /* context to call operator in for WM_operator_name_call */ /* rna_ui.c contains EnumPropertyItem's of these, keep in sync */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 07739982763..1b7333024e7 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1277,7 +1277,10 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons wmOperatorType *ot = WM_operatortype_first(); for(; ot; ot= ot->next) { - + + if((ot->flag & OPTYPE_INTERNAL) && (G.f & G_DEBUG) == 0) + continue; + if(BLI_strcasestr(ot->name, str)) { if(WM_operator_poll((bContext*)C, ot)) { char name[256]; @@ -1389,6 +1392,8 @@ static void WM_OT_call_menu(wmOperatorType *ot) ot->exec= wm_call_menu_exec; ot->poll= WM_operator_winactive; + ot->flag= OPTYPE_INTERNAL; + RNA_def_string(ot->srna, "name", "", BKE_ST_MAXNAME, "Name", "Name of the menu"); } From 111b0bf698fccb6c877aa139aed525e005caf8dd Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 6 Jun 2011 12:52:26 +0000 Subject: [PATCH 066/105] 2.5 Text Editor: * Added back Red Alert for "Resolve External conflicts" warning. --- release/scripts/startup/bl_ui/space_text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 5b07e8dc37f..0fc8d937f66 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -42,7 +42,7 @@ class TEXT_HT_header(bpy.types.Header): if text and text.is_modified: row = layout.row() - # row.color(redalert) + row.alert = True row.operator("text.resolve_conflict", text="", icon='HELP') layout.template_ID(st, "text", new="text.new", unlink="text.unlink") From 4d254f23ca5964147823307e3bff8d7c3f663e00 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 6 Jun 2011 13:35:43 +0000 Subject: [PATCH 067/105] Keymaps: fix keymap items created in python being added with the python operator names instead of the internal names. This wasn't really noticeable, expect that it broke automatically looking up shortcuts for display in menus. --- source/blender/makesrna/intern/rna_wm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index fc3039c8752..7ea4701dec3 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1048,6 +1048,7 @@ static StructRNA* rna_MacroOperator_refine(PointerRNA *opr) static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) { // wmWindowManager *wm = CTX_wm_manager(C); + char idname_bl[OP_MAX_TYPENAME]; int modifier= 0; /* only on non-modal maps */ @@ -1056,6 +1057,8 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, cons return NULL; } + WM_operator_bl_idname(idname_bl, idname); + if(shift) modifier |= KM_SHIFT; if(ctrl) modifier |= KM_CTRL; if(alt) modifier |= KM_ALT; @@ -1063,7 +1066,7 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, cons if(any) modifier = KM_ANY; - return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier); + return WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier); } static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, bContext *C, ReportList *reports, const char *propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) From 0c1298f9727a2de61dd0d28944f4af5873a65668 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 16:00:32 +0000 Subject: [PATCH 068/105] avoid cd'ing with the makefile stub --- GNUmakefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 008dfe77eae..47073bf5734 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -64,21 +64,19 @@ endif # Build Blender all: - @echo + @echo @echo Configuring Blender ... if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \ - mkdir -p $(BUILD_DIR) ; \ - cd $(BUILD_DIR) ; \ - cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE) ; \ + cmake -H$(BLENDER_DIR) -B$(BUILD_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE) ; \ fi - @echo + @echo @echo Building Blender ... - cd $(BUILD_DIR) ; make -s -j $(NPROCS) install - @echo + make -C $(BUILD_DIR) -s -j $(NPROCS) install + @echo @echo run blender from "$(BUILD_DIR)/bin/blender" - @echo + @echo debug: all # pass @@ -91,7 +89,7 @@ package_pacman: cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot package_archive: - cd $(BUILD_DIR) ; make -s package_archive + make -C $(BUILD_DIR) -s package_archive @echo archive in "$(BUILD_DIR)/release" # forward build targets @@ -109,6 +107,6 @@ test_cmake: @echo "written: test_cmake_consistency.log" clean: - cd $(BUILD_DIR) ; make clean + make -C $(BUILD_DIR) clean .PHONY: all From 8cee3285460b82a5f64901a8610b07b63bd95701 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 6 Jun 2011 17:50:20 +0000 Subject: [PATCH 069/105] Support for update callbacks in python defined RNA properties as discussed last meeting. This means script authors can perform actions using these callbacks rather then on drawing which puts blender in a readonly state. Simple example: import bpy def up_func(self, context): print("test") bpy.types.Scene.testprop = bpy.props.FloatProperty(update=up_func) bpy.context.scene.testprop = 11 # prints -> test --- source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/RNA_define.h | 3 + source/blender/makesrna/RNA_types.h | 1 + source/blender/makesrna/intern/rna_access.c | 14 +- source/blender/makesrna/intern/rna_define.c | 11 + .../makesrna/intern/rna_internal_types.h | 4 + source/blender/python/intern/bpy_props.c | 304 ++++++++++++++---- 7 files changed, 273 insertions(+), 65 deletions(-) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index e0feba3f2fd..ca19a86e42c 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -650,6 +650,7 @@ PropertyType RNA_property_type(PropertyRNA *prop); PropertySubType RNA_property_subtype(PropertyRNA *prop); PropertyUnit RNA_property_unit(PropertyRNA *prop); int RNA_property_flag(PropertyRNA *prop); +void *RNA_property_py_data_get(PropertyRNA *prop); int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop); int RNA_property_array_check(PointerRNA *ptr, PropertyRNA *prop); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index b076393ef3d..ac2a89161d9 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -163,6 +163,8 @@ void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *update void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable); void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable); +void RNA_def_property_update_runtime(PropertyRNA *prop, void *func); + void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength); void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set); void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range); @@ -172,6 +174,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll); void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring); void RNA_def_property_srna(PropertyRNA *prop, const char *type); +void RNA_def_py_data(PropertyRNA *prop, void *py_data); /* Function */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index b3f2ae01c99..090b87e9e39 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -190,6 +190,7 @@ typedef enum PropertyFlag { /* need context for update function */ PROP_CONTEXT_UPDATE = 1<<22, + PROP_CONTEXT_PROPERTY_UPDATE = (1<<22)|(1<<27), /* Use for arrays or for any data that should not have a referene kept * most common case is functions that return arrays where the array */ diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 9b8db639cbb..ab11f88e0f6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -755,6 +755,11 @@ int RNA_property_flag(PropertyRNA *prop) return rna_ensure_property(prop)->flag; } +void *RNA_property_py_data_get(PropertyRNA *prop) +{ + return prop->py_data; +} + int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop) { return rna_ensure_property_array_length(ptr, prop); @@ -1344,7 +1349,14 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR /* ideally no context would be needed for update, but there's some parts of the code that need it still, so we have this exception */ if(prop->flag & PROP_CONTEXT_UPDATE) { - if(C) ((ContextUpdateFunc)prop->update)(C, ptr); + if(C) { + if(prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) { + ((ContextPropUpdateFunc)prop->update)(C, ptr, prop); + } + else { + ((ContextUpdateFunc)prop->update)(C, ptr); + } + } } else prop->update(bmain, scene, ptr); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 66d1036ec44..8e9c7e287d6 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1839,6 +1839,11 @@ void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func) prop->update= (UpdateFunc)func; } +void RNA_def_property_update_runtime(PropertyRNA *prop, void *func) +{ + prop->update= func; +} + void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength) { if(!DefRNA.preprocess) { @@ -2057,6 +2062,11 @@ void RNA_def_property_srna(PropertyRNA *prop, const char *type) prop->srna= (StructRNA*)type; } +void RNA_def_py_data(PropertyRNA *prop, void *py_data) +{ + prop->py_data= py_data; +} + /* Compact definitions */ PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value, const char *ui_name, const char *ui_description) @@ -2822,6 +2832,7 @@ void RNA_def_property_free_pointers(PropertyRNA *prop) if(prop->identifier) MEM_freeN((void*)prop->identifier); if(prop->name) MEM_freeN((void*)prop->name); if(prop->description) MEM_freeN((void*)prop->description); + if(prop->py_data) MEM_freeN(prop->py_data); switch(prop->type) { case PROP_BOOLEAN: { diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 771d2afcd96..6ff7bc20b05 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -62,6 +62,7 @@ struct Scene; /* Function Callbacks */ typedef void (*UpdateFunc)(struct Main *main, struct Scene *scene, struct PointerRNA *ptr); +typedef void (*ContextPropUpdateFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr); typedef int (*EditableFunc)(struct PointerRNA *ptr); typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index); @@ -177,6 +178,9 @@ struct PropertyRNA { * any property can have this but should only be used for collections and arrays * since python will convert int/bool/pointer's */ struct StructRNA *srna; /* attributes attached directly to this collection */ + + /* python handle to hold all callbacks in a tuple */ + void *py_data; }; /* Property Types */ diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 4fef084f093..c6576fe2319 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -47,6 +47,11 @@ #include "../generic/py_capi_utils.h" +/* initial definition of callback slots we'll probably have more then 1 */ +#define BPY_DATA_CB_SLOT_SIZE 1 + +#define BPY_DATA_CB_SLOT_UPDATE 0 + extern BPy_StructRNA *bpy_context_module; static EnumPropertyItem property_flag_items[]= { @@ -110,6 +115,45 @@ static PyObject *pymeth_PointerProperty= NULL; static PyObject *pymeth_CollectionProperty= NULL; static PyObject *pymeth_RemoveProperty= NULL; +PyObject *pyrna_struct_as_instance(PointerRNA *ptr) +{ + PyObject *self= NULL; + /* first get self */ + /* operators can store their own instance for later use */ + if(ptr->data) { + void **instance= RNA_struct_instance(ptr); + + if(instance) { + if(*instance) { + self= *instance; + Py_INCREF(self); + } + } + } + + /* in most cases this will run */ + if(self == NULL) { + self= pyrna_struct_CreatePyObject(ptr); + } + + return self; +} + +/* could be moved into bpy_utils */ +static void printf_func_error(PyObject *py_func) +{ + /* since we return to C code we can't leave the error */ + PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func); + PyErr_Print(); + PyErr_Clear(); + + /* use py style error */ + fprintf(stderr, "File \"%s\", line %d, in %s\n", + _PyUnicode_AsString(f_code->co_filename), + f_code->co_firstlineno, + _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name) + ); +} /* operators and classes use this so it can store the args given but defer * running it until the operator runs where these values are used to setup @@ -130,6 +174,87 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw) return ret; } +/* callbacks */ +void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop) +{ + PyGILState_STATE gilstate; + PyObject **py_data= (PyObject **)RNA_property_py_data_get(prop); + PyObject *py_func; + PyObject *args; + PyObject *self; + PyObject *ret; + + BLI_assert(py_data != NULL); + + bpy_context_set(C, &gilstate); + + py_func= py_data[BPY_DATA_CB_SLOT_UPDATE]; + + args= PyTuple_New(2); + self= pyrna_struct_as_instance(ptr); + PyTuple_SET_ITEM(args, 0, self); + + PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module); + Py_INCREF(bpy_context_module); + + ret= PyObject_CallObject(py_func, args); + + Py_DECREF(args); + + if(ret == NULL) { + printf_func_error(py_func); + } + else { + if(ret != Py_None) { + PyErr_SetString(PyExc_ValueError, "the return value must be None"); + printf_func_error(py_func); + } + + Py_DECREF(ret); + } + + bpy_context_clear(C, &gilstate); +} + +static int bpy_prop_callback_check(PyObject *py_func, int argcount) +{ + if(py_func) { + if(!PyFunction_Check(py_func)) { + PyErr_Format(PyExc_TypeError, + "update keyword: expected a function type, not a %.200s", + Py_TYPE(py_func)->tp_name); + return -1; + } + else { + PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func); + if (f_code->co_argcount != argcount) { + PyErr_Format(PyExc_TypeError, + "update keyword: expected a function taking %d arguments, not %d", + argcount, f_code->co_argcount); + return -1; + } + } + } + + return 0; +} + + +static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_cb) +{ + /* assume this is already checked for type and arg length */ + if(update_cb) { + PyObject **py_data= MEM_callocN(sizeof(PyObject *) * BPY_DATA_CB_SLOT_SIZE, "bpy_prop_callback_assign"); + RNA_def_property_update_runtime(prop, (void *)bpy_prop_update_cb); + py_data[BPY_DATA_CB_SLOT_UPDATE]= update_cb; + RNA_def_py_data(prop, py_data); + + RNA_def_property_flag(prop, PROP_CONTEXT_PROPERTY_UPDATE); + } + + return 0; +} + /* this define runs at the start of each function and deals with * returning a deferred property (to be registered later) */ #define BPY_PROPDEF_HEAD(_func) \ @@ -184,6 +309,11 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw) " :type description: string\n" \ +#define BPY_PROPDEF_UPDATE_DOC \ +" :arg update: function to be called when this value is modified,\n" \ +" This function must take 2 values (self, context) and return None.\n" \ +" :type update: function\n" \ + #if 0 static int bpy_struct_id_used(StructRNA *srna, char *identifier) { @@ -197,7 +327,7 @@ static int bpy_struct_id_used(StructRNA *srna, char *identifier) /* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna allong * This isnt incorrect since its a python object - but be careful */ PyDoc_STRVAR(BPy_BoolProperty_doc, -".. function:: BoolProperty(name=\"\", description=\"\", default=False, options={'ANIMATABLE'}, subtype='NONE')\n" +".. function:: BoolProperty(name=\"\", description=\"\", default=False, options={'ANIMATABLE'}, subtype='NONE', update=None)\n" "\n" " Returns a new boolean property definition.\n" "\n" @@ -207,6 +337,7 @@ BPY_PROPDEF_DESC_DOC " :type options: set\n" " :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" " :type subtype: string\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -215,7 +346,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(BoolProperty) if(srna) { - static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", NULL}; + static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; int def=0; @@ -224,18 +355,24 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) int opts=0; char *pysubtype= NULL; int subtype= PROP_NONE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssiO!s:BoolProperty", + "s#|ssiO!sO:BoolProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, - &PySet_Type, &pyopts, &pysubtype)) + &PySet_Type, &pyopts, &pysubtype, + &update_cb)) { return NULL; } BPY_PROPDEF_SUBTYPE_CHECK(BoolProperty, property_flag_items, property_subtype_number_items) + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype); RNA_def_property_boolean_default(prop, def); RNA_def_property_ui_text(prop, name, description); @@ -244,6 +381,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } @@ -251,7 +389,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) } PyDoc_STRVAR(BPy_BoolVectorProperty_doc, -".. function:: BoolVectorProperty(name=\"\", description=\"\", default=(False, False, False), options={'ANIMATABLE'}, subtype='NONE', size=3)\n" +".. function:: BoolVectorProperty(name=\"\", description=\"\", default=(False, False, False), options={'ANIMATABLE'}, subtype='NONE', size=3, update=None)\n" "\n" " Returns a new vector boolean property definition.\n" "\n" @@ -265,6 +403,7 @@ BPY_PROPDEF_DESC_DOC " :type subtype: string\n" " :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n" " :type size: int\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -273,7 +412,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_HEAD(BoolVectorProperty) if(srna) { - static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "size", NULL}; + static const char *kwlist[]= {"attr", "name", "description", "default", "options", "subtype", "size", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; int def[PYRNA_STACK_ARRAY]={0}; @@ -284,12 +423,14 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject int opts=0; char *pysubtype= NULL; int subtype= PROP_NONE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssOO!si:BoolVectorProperty", + "s#|ssOO!siO:BoolVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, - &PySet_Type, &pyopts, &pysubtype,&size)) + &PySet_Type, &pyopts, &pysubtype, &size, + &update_cb)) { return NULL; } @@ -304,6 +445,10 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject if(pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, "BoolVectorProperty(default=sequence)") < 0) return NULL; + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + // prop= RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description); prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype); RNA_def_property_array(prop, size); @@ -314,6 +459,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } @@ -321,7 +467,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject } PyDoc_STRVAR(BPy_IntProperty_doc, -".. function:: IntProperty(name=\"\", description=\"\", default=0, min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, step=1, options={'ANIMATABLE'}, subtype='NONE')\n" +".. function:: IntProperty(name=\"\", description=\"\", default=0, min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, step=1, options={'ANIMATABLE'}, subtype='NONE', update=None)\n" "\n" " Returns a new int property definition.\n" "\n" @@ -331,6 +477,7 @@ BPY_PROPDEF_DESC_DOC " :type options: set\n" " :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" " :type subtype: string\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -339,7 +486,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(IntProperty) if(srna) { - static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", NULL}; + static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def=0; @@ -348,19 +495,25 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) int opts=0; char *pysubtype= NULL; int subtype= PROP_NONE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssiiiiiiO!s:IntProperty", + "s#|ssiiiiiiO!sO:IntProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &min, &max, &soft_min, &soft_max, - &step, &PySet_Type, &pyopts, &pysubtype)) + &step, &PySet_Type, &pyopts, &pysubtype, + &update_cb)) { return NULL; } BPY_PROPDEF_SUBTYPE_CHECK(IntProperty, property_flag_items, property_subtype_number_items) + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + prop= RNA_def_property(srna, id, PROP_INT, subtype); RNA_def_property_int_default(prop, def); RNA_def_property_range(prop, min, max); @@ -371,13 +524,14 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } Py_RETURN_NONE; } PyDoc_STRVAR(BPy_IntVectorProperty_doc, -".. function:: IntVectorProperty(name=\"\", description=\"\", default=(0, 0, 0), min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, options={'ANIMATABLE'}, subtype='NONE', size=3)\n" +".. function:: IntVectorProperty(name=\"\", description=\"\", default=(0, 0, 0), min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, options={'ANIMATABLE'}, subtype='NONE', size=3, update=None)\n" "\n" " Returns a new vector int property definition.\n" "\n" @@ -391,6 +545,7 @@ BPY_PROPDEF_DESC_DOC " :type subtype: string\n" " :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n" " :type size: int\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -399,7 +554,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject BPY_PROPDEF_HEAD(IntVectorProperty) if(srna) { - static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", NULL}; + static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def[PYRNA_STACK_ARRAY]={0}; @@ -410,14 +565,16 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject int opts=0; char *pysubtype= NULL; int subtype= PROP_NONE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssOiiiiiO!si:IntVectorProperty", + "s#|ssOiiiiiO!siO:IntVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, - &pysubtype, &size)) + &pysubtype, &size, + &update_cb)) { return NULL; } @@ -432,6 +589,10 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject if(pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, "IntVectorProperty(default=sequence)") < 0) return NULL; + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + prop= RNA_def_property(srna, id, PROP_INT, subtype); RNA_def_property_array(prop, size); if(pydef) RNA_def_property_int_array_default(prop, def); @@ -443,6 +604,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } Py_RETURN_NONE; @@ -450,7 +612,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject PyDoc_STRVAR(BPy_FloatProperty_doc, -".. function:: FloatProperty(name=\"\", description=\"\", default=0.0, min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', unit='NONE')\n" +".. function:: FloatProperty(name=\"\", description=\"\", default=0.0, min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', unit='NONE', update=None)\n" "\n" " Returns a new float property definition.\n" "\n" @@ -462,6 +624,7 @@ BPY_PROPDEF_DESC_DOC " :type subtype: string\n" " :arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION'].\n" " :type unit: string\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -470,7 +633,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(FloatProperty) if(srna) { - static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", NULL}; + static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def=0.0f; @@ -482,14 +645,16 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) int subtype= PROP_NONE; char *pyunit= NULL; int unit= PROP_UNIT_NONE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssffffffiO!ss:FloatProperty", + "s#|ssffffffiO!ssO:FloatProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, - &pyopts, &pysubtype, &pyunit)) + &pyopts, &pysubtype, &pyunit, + &update_cb)) { return NULL; } @@ -501,6 +666,10 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) return NULL; } + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + prop= RNA_def_property(srna, id, PROP_FLOAT, subtype | unit); RNA_def_property_float_default(prop, def); RNA_def_property_range(prop, min, max); @@ -511,13 +680,14 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } Py_RETURN_NONE; } PyDoc_STRVAR(BPy_FloatVectorProperty_doc, -".. function:: FloatVectorProperty(name=\"\", description=\"\", default=(0.0, 0.0, 0.0), min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', size=3)\n" +".. function:: FloatVectorProperty(name=\"\", description=\"\", default=(0.0, 0.0, 0.0), min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', size=3, update=None)\n" "\n" " Returns a new vector float property definition.\n" "\n" @@ -531,6 +701,7 @@ BPY_PROPDEF_DESC_DOC " :type subtype: string\n" " :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n" " :type size: int\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -539,7 +710,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec BPY_PROPDEF_HEAD(FloatVectorProperty) if(srna) { - static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", NULL}; + static const char *kwlist[]= {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def[PYRNA_STACK_ARRAY]={0.0f}; @@ -550,14 +721,16 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec int opts=0; char *pysubtype= NULL; int subtype= PROP_NONE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|ssOfffffiO!si:FloatVectorProperty", + "s#|ssOfffffiO!siO:FloatVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, - &pyopts, &pysubtype, &size)) + &pyopts, &pysubtype, &size, + &update_cb)) { return NULL; } @@ -572,6 +745,10 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec if(pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, "FloatVectorProperty(default=sequence)") < 0) return NULL; + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + prop= RNA_def_property(srna, id, PROP_FLOAT, subtype); RNA_def_property_array(prop, size); if(pydef) RNA_def_property_float_array_default(prop, def); @@ -583,13 +760,14 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } Py_RETURN_NONE; } PyDoc_STRVAR(BPy_StringProperty_doc, -".. function:: StringProperty(name=\"\", description=\"\", default=\"\", maxlen=0, options={'ANIMATABLE'}, subtype='NONE')\n" +".. function:: StringProperty(name=\"\", description=\"\", default=\"\", maxlen=0, options={'ANIMATABLE'}, subtype='NONE', update=None)\n" "\n" " Returns a new string property definition.\n" "\n" @@ -599,6 +777,7 @@ BPY_PROPDEF_DESC_DOC " :type options: set\n" " :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILENAME', 'NONE'].\n" " :type subtype: string\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -607,7 +786,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw BPY_PROPDEF_HEAD(StringProperty) if(srna) { - static const char *kwlist[]= {"attr", "name", "description", "default", "maxlen", "options", "subtype", NULL}; + static const char *kwlist[]= {"attr", "name", "description", "default", "maxlen", "options", "subtype", "update", NULL}; const char *id=NULL, *name="", *description="", *def=""; int id_len; int maxlen=0; @@ -616,18 +795,24 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw int opts=0; char *pysubtype= NULL; int subtype= PROP_NONE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#|sssiO!s:StringProperty", + "s#|sssiO!sO:StringProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, - &maxlen, &PySet_Type, &pyopts, &pysubtype)) + &maxlen, &PySet_Type, &pyopts, &pysubtype, + &update_cb)) { return NULL; } BPY_PROPDEF_SUBTYPE_CHECK(StringProperty, property_flag_items, property_subtype_string_items) + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + prop= RNA_def_property(srna, id, PROP_STRING, subtype); if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */ if(def) RNA_def_property_string_default(prop, def); @@ -637,6 +822,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } Py_RETURN_NONE; @@ -803,23 +989,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt bpy_context_set(C, &gilstate); args= PyTuple_New(2); - - /* first get self */ - /* operators can store their own instance for later use */ - if(ptr->data) { - void **instance = RNA_struct_instance(ptr); - - if(instance) { - if(*instance) { - self= *instance; - Py_INCREF(self); - } - } - } - if(self == NULL) { - self= pyrna_struct_CreatePyObject(ptr); - } - + self= pyrna_struct_as_instance(ptr); PyTuple_SET_ITEM(args, 0, self); /* now get the context */ @@ -857,17 +1027,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt *free= 1; } else { - /* since we return to C code we can't leave the error */ - PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func); - PyErr_Print(); - PyErr_Clear(); - - /* use py style error */ - fprintf(stderr, "File \"%s\", line %d, in %s\n", - _PyUnicode_AsString(f_code->co_filename), - f_code->co_firstlineno, - _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name) - ); + printf_func_error(py_func); eitems= DummyRNA_NULL_items; } @@ -878,7 +1038,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt } PyDoc_STRVAR(BPy_EnumProperty_doc, -".. function:: EnumProperty(items, name=\"\", description=\"\", default=\"\", options={'ANIMATABLE'})\n" +".. function:: EnumProperty(items, name=\"\", description=\"\", default=\"\", options={'ANIMATABLE'}, update=None)\n" "\n" " Returns a new enumerator property definition.\n" "\n" @@ -897,6 +1057,7 @@ BPY_PROPDEF_DESC_DOC " the same format as the static list.\n" " This function must take 2 arguments (self, context)\n" " :type items: sequence of string triplets or a function\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -905,7 +1066,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) BPY_PROPDEF_HEAD(EnumProperty) if(srna) { - static const char *kwlist[]= {"attr", "items", "name", "description", "default", "options", NULL}; + static const char *kwlist[]= {"attr", "items", "name", "description", "default", "options", "update", NULL}; const char *id=NULL, *name="", *description=""; PyObject *def= NULL; int id_len; @@ -916,18 +1077,24 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *pyopts= NULL; int opts=0; short is_itemf= FALSE; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#O|ssOO!:EnumProperty", + "s#O|ssOO!O:EnumProperty", (char **)kwlist, &id, &id_len, &items, &name, &description, - &def, &PySet_Type, &pyopts)) + &def, &PySet_Type, &pyopts, + &update_cb)) { return NULL; } BPY_PROPDEF_CHECK(EnumProperty, property_flag_enum_items) + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + /* items can be a list or a callable */ if(PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */ PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(items); @@ -975,6 +1142,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); if(is_itemf == FALSE) { @@ -1017,7 +1185,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix } PyDoc_STRVAR(BPy_PointerProperty_doc, -".. function:: PointerProperty(type=\"\", description=\"\", options={'ANIMATABLE'})\n" +".. function:: PointerProperty(type=\"\", description=\"\", options={'ANIMATABLE'}, update=None)\n" "\n" " Returns a new pointer property definition.\n" "\n" @@ -1027,6 +1195,7 @@ BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC " :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" " :type options: set\n" +BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) { @@ -1035,7 +1204,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k BPY_PROPDEF_HEAD(PointerProperty) if(srna) { - static const char *kwlist[]= {"attr", "type", "name", "description", "options", NULL}; + static const char *kwlist[]= {"attr", "type", "name", "description", "options", "update", NULL}; const char *id=NULL, *name="", *description=""; int id_len; PropertyRNA *prop; @@ -1043,12 +1212,14 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k PyObject *type= Py_None; PyObject *pyopts= NULL; int opts=0; + PyObject *update_cb= NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#O|ssO!:PointerProperty", + "s#O|ssO!O:PointerProperty", (char **)kwlist, &id, &id_len, &type, &name, &description, - &PySet_Type, &pyopts)) + &PySet_Type, &pyopts, + &update_cb)) { return NULL; } @@ -1059,11 +1230,16 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k if(!ptype) return NULL; + if (bpy_prop_callback_check(update_cb, 2) == -1) { + return NULL; + } + prop= RNA_def_pointer_runtime(srna, id, ptype, name, description); if(pyopts) { if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN); if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } + bpy_prop_callback_assign(prop, update_cb); RNA_def_property_duplicate_pointers(srna, prop); } Py_RETURN_NONE; From 5fca1aa323cd6e4c61e2c1901d62ff3f2b2d7b1e Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 6 Jun 2011 18:04:57 +0000 Subject: [PATCH 070/105] 2.5 todo: User setting "DPI" now works for outliner too. (todo: color picker, brush menu, nodes, fileselect path buttons, view2d sliders, ...) --- .../blender/editors/space_outliner/outliner.c | 216 +++++++++--------- 1 file changed, 109 insertions(+), 107 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 037b1db56d6..43e46d485ee 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -106,21 +106,17 @@ #include "outliner_intern.h" - -#define OL_H 19 -#define OL_X 18 - #define OL_Y_OFFSET 2 -#define OL_TOG_RESTRICT_VIEWX 54 -#define OL_TOG_RESTRICT_SELECTX 36 -#define OL_TOG_RESTRICT_RENDERX 18 +#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X*3) +#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X*2) +#define OL_TOG_RESTRICT_RENDERX UI_UNIT_X #define OL_TOGW OL_TOG_RESTRICT_VIEWX -#define OL_RNA_COLX 300 -#define OL_RNA_COL_SIZEX 150 -#define OL_RNA_COL_SPACEX 50 +#define OL_RNA_COLX (UI_UNIT_X*15) +#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5) +#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5) #define TS_CHUNK 128 @@ -260,7 +256,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h) TreeStoreElem *tselem= TREESTORE(te); if((tselem->flag & TSE_CLOSED)==0) outliner_height(soops, &te->subtree, h); - (*h) += OL_H; + (*h) += UI_UNIT_Y; te= te->next; } } @@ -297,7 +293,7 @@ static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int start *w = startx+100; if((tselem->flag & TSE_CLOSED)==0) - outliner_rna_width(soops, &te->subtree, w, startx+OL_X); + outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X); te= te->next; } } @@ -2485,13 +2481,13 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2]) { - if(mval[1]>te->ys && mval[1]ys+OL_H) { + if(mval[1]>te->ys && mval[1]ys+UI_UNIT_Y) { TreeStoreElem *tselem= TREESTORE(te); int openclose= 0; /* open close icon */ if((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close - if( mval[0]>te->xs && mval[0]xs+OL_X) + if( mval[0]>te->xs && mval[0]xs+UI_UNIT_X) openclose= 1; } @@ -2510,7 +2506,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa return 1; } /* name and first icon */ - else if(mval[0]>te->xs+OL_X && mval[0]xend) { + else if(mval[0]>te->xs+UI_UNIT_X && mval[0]xend) { /* always makes active object */ if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) @@ -2597,7 +2593,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) int row; /* get row number - 100 here is just a dummy value since we don't need the column */ - UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, OL_Y_OFFSET, + UI_view2d_listview_view_to_cell(&ar->v2d, 1000, UI_UNIT_Y, 0.0f, OL_Y_OFFSET, fmval[0], fmval[1], NULL, &row); /* select relevant row */ @@ -2631,7 +2627,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot) static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2]) { - if(mval[1]>te->ys && mval[1]ys+OL_H) { + if(mval[1]>te->ys && mval[1]ys+UI_UNIT_Y) { TreeStoreElem *tselem= TREESTORE(te); /* all below close/open? */ @@ -2696,11 +2692,11 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot) static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2]) { - if(mval[1]>te->ys && mval[1]ys+OL_H) { + if(mval[1]>te->ys && mval[1]ys+UI_UNIT_Y) { TreeStoreElem *tselem= TREESTORE(te); /* name and first icon */ - if(mval[0]>te->xs+OL_X && mval[0]xend) { + if(mval[0]>te->xs+UI_UNIT_X && mval[0]xend) { /* can't rename rna datablocks entries */ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) @@ -2861,12 +2857,12 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, /* store coord and continue, we need coordinates for elements outside view too */ te->xs= (float)startx; te->ys= (float)(*starty); - *starty-= OL_H; + *starty-= UI_UNIT_Y; if((tselem->flag & TSE_CLOSED)==0) { TreeElement *ten; for(ten= te->subtree.first; ten; ten= ten->next) { - outliner_set_coordinates_element(soops, ten, startx+OL_X, starty); + outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty); } } @@ -2876,7 +2872,7 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) { TreeElement *te; - int starty= (int)(ar->v2d.tot.ymax)-OL_H; + int starty= (int)(ar->v2d.tot.ymax)-UI_UNIT_Y; int startx= 0; for(te= soops->tree.first; te; te= te->next) { @@ -3731,7 +3727,7 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot) static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, wmEvent *event, const float mval[2]) { - if(mval[1]>te->ys && mval[1]ys+OL_H) { + if(mval[1]>te->ys && mval[1]ys+UI_UNIT_Y) { int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0; TreeStoreElem *tselem= TREESTORE(te); @@ -4309,7 +4305,10 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon) if(arg->x >= arg->xmax) UI_icon_draw(arg->x, arg->y, icon); else { - uiBut *but= uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-4, arg->y, ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : ""); + /* XXX investigate: button placement of icons is way different than UI_icon_draw? */ + float ufac= UI_UNIT_X/20.0f; + uiBut *but= uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-3.0f*ufac, arg->y, UI_UNIT_X-4.0f*ufac, UI_UNIT_Y-4.0f*ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : ""); + if(arg->id) uiButSetDragID(but, arg->id); } @@ -4572,7 +4571,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa for(te= lb->first; te; te= te->next) { /* exit drawing early */ - if((*offsx) - OL_X > xmax) + if((*offsx) - UI_UNIT_X > xmax) break; tselem= TREESTORE(te); @@ -4589,19 +4588,21 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa else active= tree_element_type_active(NULL, scene, soops, te, tselem, 0); if(active) { + float ufac= UI_UNIT_X/20.0f; + uiSetRoundBox(15); glColor4ub(255, 255, 255, 100); - uiRoundBox( (float)*offsx-0.5f, (float)ys-1.0f, (float)*offsx+OL_H-3.0f, (float)ys+OL_H-3.0f, OL_H/2.0f-2.0f); + uiRoundBox( (float)*offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables */ } tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f); te->xs= (float)*offsx; te->ys= (float)ys; - te->xend= (short)*offsx+OL_X; + te->xend= (short)*offsx+UI_UNIT_X; te->flag |= TE_ICONROW; // for click - (*offsx) += OL_X; + (*offsx) += UI_UNIT_X; } /* this tree element always has same amount of branches, so dont draw */ @@ -4621,7 +4622,7 @@ static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, i te->ys= (float)(*starty); for(ten= te->subtree.first; ten; ten= ten->next) { - outliner_set_coord_tree_element(soops, ten, startx+OL_X, starty); + outliner_set_coord_tree_element(soops, ten, startx+UI_UNIT_X, starty); } } @@ -4630,16 +4631,17 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene { TreeElement *ten; TreeStoreElem *tselem; + float ufac= UI_UNIT_X/20.0f; int offsx= 0, active=0; // active=1 active obj, else active data tselem= TREESTORE(te); - if(*starty+2*OL_H >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) { + if(*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) { int xmax= ar->v2d.cur.xmax; /* icons can be ui buts, we dont want it to overlap with restrict */ if((soops->flag & SO_HIDE_RESTRICTCOLS)==0) - xmax-= OL_TOGW+ICON_DEFAULT_WIDTH; + xmax-= OL_TOGW+UI_UNIT_X; glEnable(GL_BLEND); @@ -4708,7 +4710,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene /* active circle */ if(active) { uiSetRoundBox(15); - uiRoundBox( (float)startx+OL_H-1.5f, (float)*starty+2.0f, (float)startx+2.0f*OL_H-4.0f, (float)*starty+OL_H-1.0f, OL_H/2.0f-2.0f); + uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac); glEnable(GL_BLEND); /* roundbox disables it */ te->flag |= TE_ACTIVE; // for lookup in display hierarchies @@ -4720,35 +4722,35 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene if(tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE)) icon_x = startx; else - icon_x = startx+5; + icon_x = startx+5*ufac; // icons a bit higher if(tselem->flag & TSE_CLOSED) - UI_icon_draw((float)icon_x, (float)*starty+2, ICON_DISCLOSURE_TRI_RIGHT); + UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT); else - UI_icon_draw((float)icon_x, (float)*starty+2, ICON_DISCLOSURE_TRI_DOWN); + UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN); } - offsx+= OL_X; + offsx+= UI_UNIT_X; /* datatype icon */ if(!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) { // icons a bit higher - tselem_draw_icon(block, xmax, (float)startx+offsx, (float)*starty+2, tselem, te, 1.0f); + tselem_draw_icon(block, xmax, (float)startx+offsx, (float)*starty+2*ufac, tselem, te, 1.0f); - offsx+= OL_X; + offsx+= UI_UNIT_X; } else - offsx+= 2; + offsx+= 2*ufac; if(tselem->type==0 && tselem->id->lib) { glPixelTransferf(GL_ALPHA_SCALE, 0.5f); if(tselem->id->flag & LIB_INDIRECT) - UI_icon_draw((float)startx+offsx, (float)*starty+2, ICON_LIBRARY_DATA_INDIRECT); + UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_INDIRECT); else - UI_icon_draw((float)startx+offsx, (float)*starty+2, ICON_LIBRARY_DATA_DIRECT); + UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_DIRECT); glPixelTransferf(GL_ALPHA_SCALE, 1.0f); - offsx+= OL_X; + offsx+= UI_UNIT_X; } glDisable(GL_BLEND); @@ -4757,9 +4759,9 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene else if(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f); else UI_ThemeColor(TH_TEXT); - UI_DrawString(startx+offsx, *starty+5, te->name); + UI_DrawString(startx+offsx, *starty+5*ufac, te->name); - offsx+= (int)(OL_X + UI_GetStringWidth(te->name)); + offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name)); /* closed item, we draw the icons, not when it's a scene, or master-server list though */ if(tselem->flag & TSE_CLOSED) { @@ -4770,7 +4772,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene // divider UI_ThemeColorShade(TH_BACK, -40); - glRecti(tempx -10, *starty+4, tempx -8, *starty+OL_H-4); + glRecti(tempx -10, *starty+4, tempx -8, *starty+UI_UNIT_Y-4); glEnable(GL_BLEND); glPixelTransferf(GL_ALPHA_SCALE, 0.5); @@ -4789,16 +4791,16 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene te->xend= startx+offsx; if((tselem->flag & TSE_CLOSED)==0) { - *starty-= OL_H; + *starty-= UI_UNIT_Y; for(ten= te->subtree.first; ten; ten= ten->next) - outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx+OL_X, starty); + outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx+UI_UNIT_X, starty); } else { for(ten= te->subtree.first; ten; ten= ten->next) outliner_set_coord_tree_element(soops, te, startx, starty); - *starty-= OL_H; + *starty-= UI_UNIT_Y; } } @@ -4817,12 +4819,12 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx, /* horizontal line? */ if(tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE)) - glRecti(startx, *starty, startx+OL_X, *starty-1); + glRecti(startx, *starty, startx+UI_UNIT_X, *starty-1); - *starty-= OL_H; + *starty-= UI_UNIT_Y; if((tselem->flag & TSE_CLOSED)==0) - outliner_draw_hierarchy(soops, &te->subtree, startx+OL_X, starty); + outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty); } /* vertical line */ @@ -4831,7 +4833,7 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx, tselem= TREESTORE(te); if(tselem->type==0 && te->idcode==ID_OB) { - glRecti(startx, y1+OL_H, startx+1, y2); + glRecti(startx, y1+UI_UNIT_Y, startx+1, y2); } } } @@ -4847,13 +4849,13 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * /* selection status */ if((tselem->flag & TSE_CLOSED)==0) if(tselem->type == TSE_RNA_STRUCT) - glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+OL_H-1); + glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1); - *starty-= OL_H; + *starty-= UI_UNIT_Y; if((tselem->flag & TSE_CLOSED)==0) { outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if(tselem->type == TSE_RNA_STRUCT) - fdrawline(0, (float)*starty+OL_H, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+OL_H); + fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y); } } } @@ -4868,9 +4870,9 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb, /* selection status */ if(tselem->flag & TSE_SELECTED) { - glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+OL_H-1); + glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1); } - *starty-= OL_H; + *starty-= UI_UNIT_Y; if((tselem->flag & TSE_CLOSED)==0) outliner_draw_selection(ar, soops, &te->subtree, starty); } } @@ -4888,24 +4890,24 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio /* struct marks */ UI_ThemeColorShadeAlpha(TH_BACK, -15, -200); //UI_ThemeColorShade(TH_BACK, -20); - starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET; + starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET; outliner_draw_struct_marks(ar, soops, &soops->tree, &starty); } /* always draw selection fill before hierarchy */ UI_GetThemeColor3fv(TH_BACK, col); glColor3f(col[0]+0.06f, col[1]+0.08f, col[2]+0.10f); - starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET; + starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET; outliner_draw_selection(ar, soops, &soops->tree, &starty); // grey hierarchy lines UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2f); - starty= (int)ar->v2d.tot.ymax-OL_H/2-OL_Y_OFFSET; + starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y/2-OL_Y_OFFSET; startx= 6; outliner_draw_hierarchy(soops, &soops->tree, startx, &starty); // items themselves - starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET; + starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET; startx= 0; for(te= soops->tree.first; te; te= te->next) { outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty); @@ -4919,11 +4921,11 @@ static void outliner_back(ARegion *ar) UI_ThemeColorShade(TH_BACK, 6); ystart= (int)ar->v2d.tot.ymax; - ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET; + ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET; - while(ystart+2*OL_H > ar->v2d.cur.ymin) { - glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+OL_H); - ystart-= 2*OL_H; + while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) { + glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+UI_UNIT_Y); + ystart-= 2*UI_UNIT_Y; } } @@ -4937,11 +4939,11 @@ static void outliner_draw_restrictcols(ARegion *ar) UI_ThemeColorShade(TH_BACK, 6); ystart= (int)ar->v2d.tot.ymax; - ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET; + ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET; - while(ystart+2*OL_H > ar->v2d.cur.ymin) { - glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H); - ystart-= 2*OL_H; + while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) { + glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+UI_UNIT_Y); + ystart-= 2*UI_UNIT_Y; } UI_ThemeColorShadeAlpha(TH_BACK, -15, -200); @@ -5225,7 +5227,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { /* objects have toggle-able restriction flags */ if(tselem->type==0 && te->idcode==ID_OB) { PointerRNA ptr; @@ -5235,17 +5237,17 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &ptr, "hide", -1, 0, 0, -1, -1, NULL); uiButSetFunc(bt, restrictbutton_view_cb, scene, ob); bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &ptr, "hide_select", -1, 0, 0, -1, -1, NULL); uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob); bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, 17, OL_H-1, + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &ptr, "hide_render", -1, 0, 0, -1, -1, NULL); uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob); @@ -5259,15 +5261,15 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); restrict_bool= group_restrict_flag(gr, OB_RESTRICT_VIEW); - bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, NULL, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); + bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, NULL, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr); restrict_bool= group_restrict_flag(gr, OB_RESTRICT_SELECT); - bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, NULL, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); + bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, NULL, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr); restrict_bool= group_restrict_flag(gr, OB_RESTRICT_RENDER); - bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, 17, OL_H-1, NULL, 0, 0, 0, 0, "Restrict/Allow renderability"); + bt = uiDefIconBut(block, BUT, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, NULL, 0, 0, 0, 0, "Restrict/Allow renderability"); uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr); uiBlockSetEmboss(block, UI_EMBOSS); @@ -5277,7 +5279,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT-1, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer"); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiBlockSetEmboss(block, UI_EMBOSS); @@ -5290,13 +5292,13 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar bt= uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT-1, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, layflag, 0, 0, 0, 0, "Render this Pass"); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); layflag++; /* is lay_xor */ if(ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) bt= uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag)?ICON_DOT:ICON_BLANK1, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined"); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiBlockSetEmboss(block, UI_EMBOSS); @@ -5307,11 +5309,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); bt= uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, 17, OL_H-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability"); uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); } else if(tselem->type==TSE_POSE_CHANNEL) { @@ -5320,11 +5322,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); uiButSetFunc(bt, restrictbutton_bone_cb, NULL, bone); bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL); } else if(tselem->type==TSE_EBONE) { @@ -5332,11 +5334,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, ebone); bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, NULL); } } @@ -5377,19 +5379,19 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { if(tselem->type == TSE_RNA_PROPERTY) { ptr= &te->rnaptr; prop= te->directdata; if(!(RNA_property_type(prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0)) - uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); + uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1); } else if(tselem->type == TSE_RNA_ARRAY_ELEM) { ptr= &te->rnaptr; prop= te->directdata; - uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); + uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1); } } @@ -5444,7 +5446,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, 150, 19, 0, 0, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, 150, UI_UNIT_Y, 0, 0, ""); uiButSetSearchFunc(but, operator_search_cb, arg_kmi, operator_call_cb, ot); uiBoundsBlock(block, 6); @@ -5583,11 +5585,11 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { uiBut *but; const char *str; int xstart= 240; - int butw1= 20; /* operator */ + int butw1= UI_UNIT_X; /* operator */ int butw2= 90; /* event type, menus */ int butw3= 43; /* modifiers */ @@ -5597,7 +5599,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo /* modal map? */ if(kmi->propvalue); else { - uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys+1, butw1, OL_H-1, "Assign new Operator"); + uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys+1, butw1, UI_UNIT_Y-1, "Assign new Operator"); } xstart+= butw1+10; @@ -5605,43 +5607,43 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo kmi->maptype= keymap_menu_type(kmi->type); str= keymap_type_menu(); - but= uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, OL_H-1, &kmi->maptype, 0, 0, 0, 0, "Event type"); + but= uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->maptype, 0, 0, 0, 0, "Event type"); uiButSetFunc(but, keymap_type_cb, kmi, NULL); xstart+= butw2+5; /* edit actual event */ switch(kmi->maptype) { case OL_KM_KEYBOARD: - uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw2, OL_H-1, &kmi->type, "Key code"); + uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, "Key code"); xstart+= butw2+5; break; case OL_KM_MOUSE: str= keymap_mouse_menu(); - uiDefButS(block, MENU, 0, str, xstart,(int)te->ys+1, butw2, OL_H-1, &kmi->type, 0, 0, 0, 0, "Mouse button"); + uiDefButS(block, MENU, 0, str, xstart,(int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Mouse button"); xstart+= butw2+5; break; case OL_KM_TWEAK: str= keymap_tweak_menu(); - uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, OL_H-1, &kmi->type, 0, 0, 0, 0, "Tweak gesture"); + uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Tweak gesture"); xstart+= butw2+5; str= keymap_tweak_dir_menu(); - uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, OL_H-1, &kmi->val, 0, 0, 0, 0, "Tweak gesture direction"); + uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->val, 0, 0, 0, 0, "Tweak gesture direction"); xstart+= butw2+5; break; } /* modifiers */ - uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, OL_H-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5; - uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3; - uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3; - uiDefButS(block, OPTION, 0, "OS", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3; + uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, UI_UNIT_Y-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5; + uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3; + uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3; + uiDefButS(block, OPTION, 0, "OS", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3; xstart+= 5; - uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->keymodifier, "Key Modifier code"); + uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, UI_UNIT_Y-1, &kmi->keymodifier, "Key Modifier code"); xstart+= butw3+5; /* rna property */ if(kmi->ptr && kmi->ptr->data) { - uiDefBut(block, LABEL, 0, "(RNA property)", xstart, (int)te->ys+1, butw2, OL_H-1, &kmi->oskey, 0, 0, 0, 0, ""); xstart+= butw2; + uiDefBut(block, LABEL, 0, "(RNA property)", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->oskey, 0, 0, 0, 0, ""); xstart+= butw2; } (void)xstart; @@ -5662,7 +5664,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { if(tselem->flag & TSE_TEXTBUT) { @@ -5679,10 +5681,10 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa dx= (int)UI_GetStringWidth(te->name); if(dx<100) dx= 100; - spx=te->xs+2*OL_X-4; + spx=te->xs+2*UI_UNIT_X-4; if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10; - bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx+10, OL_H-1, (void *)te->name, 1.0, (float)len, 0, 0, ""); + bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx+10, UI_UNIT_Y-1, (void *)te->name, 1.0, (float)len, 0, 0, ""); uiButSetRenameFunc(bt, namebutton_cb, tselem); /* returns false if button got removed */ @@ -5716,7 +5718,7 @@ void draw_outliner(const bContext *C) * (OL_RNA_COL_X), whichever is wider... * - column 2 is fixed at OL_RNA_COL_SIZEX * - * (*) XXX max width for now is a fixed factor of OL_X*(max_indention+100) + * (*) XXX max width for now is a fixed factor of UI_UNIT_X*(max_indention+100) */ /* get actual width of column 1 */ From fff05927386a9ae4bdf3fc0c4a67d097e11a12a3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 6 Jun 2011 19:06:44 +0000 Subject: [PATCH 071/105] Fix for new baker and float images. Also removed code used for debugging. --- source/blender/editors/object/object_bake.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index af815988935..df3e58e5141 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -651,6 +651,8 @@ static void apply_heights_data(void *bake_data) } } } + + ibuf->userflags= IB_RECT_INVALID; } static void free_heights_data(void *bake_data) @@ -685,10 +687,6 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, lores_dm->getFace(lores_dm, face_index, &mface); - if(x==0 && y==0) { - zero_v3(p0); - } - st0= mtface[face_index].uv[0]; st1= mtface[face_index].uv[1]; st2= mtface[face_index].uv[2]; @@ -731,6 +729,8 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, if(ibuf->rect_float) { float *rrgbf= ibuf->rect_float + pixel*4; rrgbf[3]= 1.0f; + + ibuf->userflags= IB_RECT_INVALID; } else { char *rrgb= (char*)ibuf->rect + pixel*4; rrgb[3]= 255; @@ -782,6 +782,8 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, rrgbf[1]= vec[1]; rrgbf[2]= vec[2]; rrgbf[3]= 1.0f; + + ibuf->userflags= IB_RECT_INVALID; } else { char *rrgb= (char*)ibuf->rect + pixel*4; rrgb[0]= FTOCHAR(vec[0]); From 13dbae76e6880211dc1b0d169ca2288b652f829b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 6 Jun 2011 19:33:38 +0000 Subject: [PATCH 072/105] One more debug line was deleted from multires bakers. Now it would work really fast. --- source/blender/editors/object/object_bake.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index df3e58e5141..565c5810cff 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -507,12 +507,11 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int lvl, MFace mface; DMGridData **grid_data; float crn_x, crn_y; - int grid_size, num_grids, S, face_side; + int grid_size, S, face_side; int *grid_offset, g_index; lodm->getFace(lodm, face_index, &mface); - num_grids= hidm->getNumGrids(hidm); grid_size= hidm->getGridSize(hidm); grid_data= hidm->getGridData(hidm); grid_offset= hidm->getGridOffset(hidm); From 841c9881796ccf98434a17b223f3b487a5a189bb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 6 Jun 2011 19:44:28 +0000 Subject: [PATCH 073/105] UI: rename mesh Settings panel to Texture Space, since it only contains settings related to that. Also close by default. --- .../scripts/startup/bl_ui/properties_data_mesh.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 1f75b5059a5..e2c88413177 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -99,8 +99,9 @@ class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel): split.prop(mesh, "show_double_sided") -class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel): - bl_label = "Settings" +class DATA_PT_texture_space(MeshButtonsPanel, bpy.types.Panel): + bl_label = "Texture Space" + bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} def draw(self, context): @@ -109,11 +110,13 @@ class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel): mesh = context.mesh layout.prop(mesh, "texture_mesh") + + layout.separator() + layout.prop(mesh, "use_auto_texspace") - row = layout.row() - row.column().prop(mesh, "texspace_location") - row.column().prop(mesh, "texspace_size") + row.column().prop(mesh, "texspace_location", text="Location") + row.column().prop(mesh, "texspace_size", text="Size") class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel): bl_label = "Vertex Groups" From 9088b69f7a1707b6826cc6cb50e59fa3b6fbcdda Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 6 Jun 2011 20:04:58 +0000 Subject: [PATCH 074/105] UI: fix render properties panel order, it didn't match order in startup.blend, so was different when opening a new property editor. --- .../startup/bl_ui/properties_render.py | 334 +++++++++--------- 1 file changed, 168 insertions(+), 166 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index c313942bea0..4e1c1b34363 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -172,8 +172,130 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel): row.prop(rl, "exclude_refraction", text="") +class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel): + bl_label = "Dimensions" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + def draw(self, context): + layout = self.layout + + scene = context.scene + rd = scene.render + + row = layout.row(align=True) + row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label) + row.operator("render.preset_add", text="", icon="ZOOMIN") + row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True + + split = layout.split() + + col = split.column() + sub = col.column(align=True) + sub.label(text="Resolution:") + sub.prop(rd, "resolution_x", text="X") + sub.prop(rd, "resolution_y", text="Y") + sub.prop(rd, "resolution_percentage", text="") + + sub.label(text="Aspect Ratio:") + sub.prop(rd, "pixel_aspect_x", text="X") + sub.prop(rd, "pixel_aspect_y", text="Y") + + row = col.row() + row.prop(rd, "use_border", text="Border") + sub = row.row() + sub.active = rd.use_border + sub.prop(rd, "use_crop_to_border", text="Crop") + + col = split.column() + sub = col.column(align=True) + sub.label(text="Frame Range:") + sub.prop(scene, "frame_start", text="Start") + sub.prop(scene, "frame_end", text="End") + sub.prop(scene, "frame_step", text="Step") + + sub.label(text="Frame Rate:") + if rd.fps_base == 1: + fps_rate = round(rd.fps / rd.fps_base) + else: + fps_rate = round(rd.fps / rd.fps_base, 2) + + # TODO: Change the following to iterate over existing presets + custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60}) + + if custom_framerate == True: + fps_label_text = "Custom (" + str(fps_rate) + " fps)" + else: + fps_label_text = str(fps_rate) + " fps" + + sub.menu("RENDER_MT_framerate_presets", text=fps_label_text) + + if custom_framerate or (bpy.types.RENDER_MT_framerate_presets.bl_label == "Custom"): + sub.prop(rd, "fps") + sub.prop(rd, "fps_base", text="/") + subrow = sub.row(align=True) + subrow.label(text="Time Remapping:") + subrow = sub.row(align=True) + subrow.prop(rd, "frame_map_old", text="Old") + subrow.prop(rd, "frame_map_new", text="New") + + +class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel): + bl_label = "Anti-Aliasing" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + def draw_header(self, context): + rd = context.scene.render + + self.layout.prop(rd, "use_antialiasing", text="") + + def draw(self, context): + layout = self.layout + + rd = context.scene.render + layout.active = rd.use_antialiasing + + split = layout.split() + + col = split.column() + col.row().prop(rd, "antialiasing_samples", expand=True) + sub = col.row() + sub.enabled = not rd.use_border + sub.prop(rd, "use_full_sample") + + col = split.column() + col.prop(rd, "pixel_filter_type", text="") + col.prop(rd, "filter_size", text="Size") + + +class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel): + bl_label = "Sampled Motion Blur" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'BLENDER_RENDER'} + + @classmethod + def poll(cls, context): + rd = context.scene.render + return not rd.use_full_sample and (rd.engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + rd = context.scene.render + + self.layout.prop(rd, "use_motion_blur", text="") + + def draw(self, context): + layout = self.layout + + rd = context.scene.render + layout.active = rd.use_motion_blur + + row = layout.row() + row.prop(rd, "motion_blur_samples") + row.prop(rd, "motion_blur_shutter") + + class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel): bl_label = "Shading" + bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} def draw(self, context): @@ -276,6 +398,51 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel): sub.prop(rd, "edge_color", text="") +class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel): + bl_label = "Stamp" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'BLENDER_RENDER'} + + def draw_header(self, context): + rd = context.scene.render + + self.layout.prop(rd, "use_stamp", text="") + + def draw(self, context): + layout = self.layout + + rd = context.scene.render + + layout.active = rd.use_stamp + + split = layout.split() + + col = split.column() + col.prop(rd, "use_stamp_time", text="Time") + col.prop(rd, "use_stamp_date", text="Date") + col.prop(rd, "use_stamp_render_time", text="RenderTime") + col.prop(rd, "use_stamp_frame", text="Frame") + col.prop(rd, "use_stamp_scene", text="Scene") + col.prop(rd, "use_stamp_camera", text="Camera") + col.prop(rd, "use_stamp_lens", text="Lens") + col.prop(rd, "use_stamp_filename", text="Filename") + col.prop(rd, "use_stamp_marker", text="Marker") + col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip") + + col = split.column() + col.active = rd.use_stamp + col.prop(rd, "stamp_foreground", slider=True) + col.prop(rd, "stamp_background", slider=True) + col.separator() + col.prop(rd, "stamp_font_size", text="Font Size") + + row = layout.split(percentage=0.2) + row.prop(rd, "use_stamp_note", text="Note") + sub = row.row() + sub.active = rd.use_stamp_note + sub.prop(rd, "stamp_note_text", text="") + + class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel): bl_label = "Output" COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -433,172 +600,6 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel): split.prop(rd, "ffmpeg_audio_volume", slider=True) -class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel): - bl_label = "Anti-Aliasing" - COMPAT_ENGINES = {'BLENDER_RENDER'} - - def draw_header(self, context): - rd = context.scene.render - - self.layout.prop(rd, "use_antialiasing", text="") - - def draw(self, context): - layout = self.layout - - rd = context.scene.render - layout.active = rd.use_antialiasing - - split = layout.split() - - col = split.column() - col.row().prop(rd, "antialiasing_samples", expand=True) - sub = col.row() - sub.enabled = not rd.use_border - sub.prop(rd, "use_full_sample") - - col = split.column() - col.prop(rd, "pixel_filter_type", text="") - col.prop(rd, "filter_size", text="Size") - - -class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel): - bl_label = "Sampled Motion Blur" - bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} - - @classmethod - def poll(cls, context): - rd = context.scene.render - return not rd.use_full_sample and (rd.engine in cls.COMPAT_ENGINES) - - def draw_header(self, context): - rd = context.scene.render - - self.layout.prop(rd, "use_motion_blur", text="") - - def draw(self, context): - layout = self.layout - - rd = context.scene.render - layout.active = rd.use_motion_blur - - row = layout.row() - row.prop(rd, "motion_blur_samples") - row.prop(rd, "motion_blur_shutter") - - -class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel): - bl_label = "Dimensions" - COMPAT_ENGINES = {'BLENDER_RENDER'} - - def draw(self, context): - layout = self.layout - - scene = context.scene - rd = scene.render - - row = layout.row(align=True) - row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label) - row.operator("render.preset_add", text="", icon="ZOOMIN") - row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True - - split = layout.split() - - col = split.column() - sub = col.column(align=True) - sub.label(text="Resolution:") - sub.prop(rd, "resolution_x", text="X") - sub.prop(rd, "resolution_y", text="Y") - sub.prop(rd, "resolution_percentage", text="") - - sub.label(text="Aspect Ratio:") - sub.prop(rd, "pixel_aspect_x", text="X") - sub.prop(rd, "pixel_aspect_y", text="Y") - - row = col.row() - row.prop(rd, "use_border", text="Border") - sub = row.row() - sub.active = rd.use_border - sub.prop(rd, "use_crop_to_border", text="Crop") - - col = split.column() - sub = col.column(align=True) - sub.label(text="Frame Range:") - sub.prop(scene, "frame_start", text="Start") - sub.prop(scene, "frame_end", text="End") - sub.prop(scene, "frame_step", text="Step") - - sub.label(text="Frame Rate:") - if rd.fps_base == 1: - fps_rate = round(rd.fps / rd.fps_base) - else: - fps_rate = round(rd.fps / rd.fps_base, 2) - - # TODO: Change the following to iterate over existing presets - custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60}) - - if custom_framerate == True: - fps_label_text = "Custom (" + str(fps_rate) + " fps)" - else: - fps_label_text = str(fps_rate) + " fps" - - sub.menu("RENDER_MT_framerate_presets", text=fps_label_text) - - if custom_framerate or (bpy.types.RENDER_MT_framerate_presets.bl_label == "Custom"): - sub.prop(rd, "fps") - sub.prop(rd, "fps_base", text="/") - subrow = sub.row(align=True) - subrow.label(text="Time Remapping:") - subrow = sub.row(align=True) - subrow.prop(rd, "frame_map_old", text="Old") - subrow.prop(rd, "frame_map_new", text="New") - - -class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel): - bl_label = "Stamp" - bl_options = {'DEFAULT_CLOSED'} - COMPAT_ENGINES = {'BLENDER_RENDER'} - - def draw_header(self, context): - rd = context.scene.render - - self.layout.prop(rd, "use_stamp", text="") - - def draw(self, context): - layout = self.layout - - rd = context.scene.render - - layout.active = rd.use_stamp - - split = layout.split() - - col = split.column() - col.prop(rd, "use_stamp_time", text="Time") - col.prop(rd, "use_stamp_date", text="Date") - col.prop(rd, "use_stamp_render_time", text="RenderTime") - col.prop(rd, "use_stamp_frame", text="Frame") - col.prop(rd, "use_stamp_scene", text="Scene") - col.prop(rd, "use_stamp_camera", text="Camera") - col.prop(rd, "use_stamp_lens", text="Lens") - col.prop(rd, "use_stamp_filename", text="Filename") - col.prop(rd, "use_stamp_marker", text="Marker") - col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip") - - col = split.column() - col.active = rd.use_stamp - col.prop(rd, "stamp_foreground", slider=True) - col.prop(rd, "stamp_background", slider=True) - col.separator() - col.prop(rd, "stamp_font_size", text="Font Size") - - row = layout.split(percentage=0.2) - row.prop(rd, "use_stamp_note", text="Note") - sub = row.row() - sub.active = rd.use_stamp_note - sub.prop(rd, "stamp_note_text", text="") - - class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel): bl_label = "Bake" bl_options = {'DEFAULT_CLOSED'} @@ -649,5 +650,6 @@ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel): layout.prop(rd, "use_bake_clear") layout.prop(rd, "bake_margin") + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) From b481524fde453884f8854a95bba1c1fdeb46959f Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 6 Jun 2011 22:10:05 +0000 Subject: [PATCH 075/105] fix for float projection painting, now updating correctly. This fix also allows for partial update of the image, speeding up painting. The different code path implemented will be used to upload high resolution images to OpenGL when onion branch is merged. Due to conversion of float textures to/from sRGB, corrections made to brush color sampling to take account of the image profile. This is not 100% correct yet as texture images used for projection painting strokes are not converted to/from sRGB yet(This has been decided due to loss of precision for 8-bit formats). It will have to do for now, though. last-minute update, exr image loading is broken, will fix asap --- source/blender/blenkernel/BKE_brush.h | 4 +- source/blender/blenkernel/intern/brush.c | 33 +++-- source/blender/blenlib/BLI_math_vector.h | 2 + source/blender/blenlib/BLI_utildefines.h | 6 + .../blenlib/intern/math_vector_inline.c | 15 ++ .../editors/sculpt_paint/paint_image.c | 31 +++-- source/blender/gpu/intern/gpu_draw.c | 22 ++- source/blender/imbuf/IMB_imbuf.h | 5 + source/blender/imbuf/intern/divers.c | 129 ++++++++++++++++++ 9 files changed, 218 insertions(+), 29 deletions(-) diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index ad736cd07bf..ebb9714cd1b 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -71,7 +71,7 @@ float brush_curve_strength(struct Brush *br, float p, const float len); /* used /* sampling */ void brush_sample_tex(struct Brush *brush, float *xy, float *rgba, const int thread); void brush_imbuf_new(struct Brush *brush, short flt, short texfalloff, int size, - struct ImBuf **imbuf); + struct ImBuf **imbuf, int use_color_correction); /* painting */ struct BrushPainter; @@ -82,7 +82,7 @@ BrushPainter *brush_painter_new(struct Brush *brush); void brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly, int size); int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, - double time, float pressure, void *user); + double time, float pressure, void *user, int use_color_correction); void brush_painter_break_stroke(BrushPainter *painter); void brush_painter_free(BrushPainter *painter); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 25b60fef6dd..a4ceb62ab55 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -521,7 +521,7 @@ void brush_sample_tex(Brush *brush, float *xy, float *rgba, const int thread) } -void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf) +void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, int use_color_correction) { ImBuf *ibuf; float xy[2], dist, rgba[4], *dstf; @@ -529,7 +529,8 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf const int radius= brush_size(brush); char *dst, crgb[3]; const float alpha= brush_alpha(brush); - + float brush_rgb[3]; + imbflag= (flt)? IB_rectfloat: IB_rect; xoff = -bufsize/2.0f + 0.5f; yoff = -bufsize/2.0f + 0.5f; @@ -541,6 +542,11 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag); if (flt) { + copy_v3_v3(brush_rgb, brush->rgb); + if(use_color_correction){ + srgb_to_linearrgb_v3_v3(brush_rgb, brush_rgb); + } + for (y=0; y < ibuf->y; y++) { dstf = ibuf->rect_float + y*rowbytes; @@ -551,7 +557,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf if (texfall == 0) { dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]); - VECCOPY(dstf, brush->rgb); + VECCOPY(dstf, brush_rgb); dstf[3]= alpha*brush_curve_strength_clamp(brush, dist, radius); } else if (texfall == 1) { @@ -561,10 +567,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]); brush_sample_tex(brush, xy, rgba, 0); - - dstf[0] = rgba[0]*brush->rgb[0]; - dstf[1] = rgba[1]*brush->rgb[1]; - dstf[2] = rgba[2]*brush->rgb[2]; + mul_v3_v3v3(dstf, rgba, brush_rgb); dstf[3] = rgba[3]*alpha*brush_curve_strength_clamp(brush, dist, radius); } } @@ -862,7 +865,7 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float brush_painter_do_partial(painter, NULL, x1, y2, x2, ibuf->y, 0, 0, pos); } -static void brush_painter_refresh_cache(BrushPainter *painter, float *pos) +static void brush_painter_refresh_cache(BrushPainter *painter, float *pos, int use_color_correction) { Brush *brush= painter->brush; BrushPainterCache *cache= &painter->cache; @@ -889,11 +892,11 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos) size= (cache->size)? cache->size: diameter; if (brush->flag & BRUSH_FIXED_TEX) { - brush_imbuf_new(brush, flt, 3, size, &cache->maskibuf); + brush_imbuf_new(brush, flt, 3, size, &cache->maskibuf, use_color_correction); brush_painter_fixed_tex_partial_update(painter, pos); } else - brush_imbuf_new(brush, flt, 2, size, &cache->ibuf); + brush_imbuf_new(brush, flt, 2, size, &cache->ibuf, use_color_correction); cache->lastsize= diameter; cache->lastalpha= alpha; @@ -952,7 +955,7 @@ void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos) } } -int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user) +int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user, int use_color_correction) { Brush *brush= painter->brush; int totpaintops= 0; @@ -970,7 +973,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl brush_apply_pressure(painter, brush, pressure); if (painter->cache.enabled) - brush_painter_refresh_cache(painter, pos); + brush_painter_refresh_cache(painter, pos, use_color_correction); totpaintops += func(user, painter->cache.ibuf, pos, pos); painter->lasttime= time; @@ -1043,7 +1046,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl brush_jitter_pos(brush, paintpos, finalpos); if (painter->cache.enabled) - brush_painter_refresh_cache(painter, finalpos); + brush_painter_refresh_cache(painter, finalpos, use_color_correction); totpaintops += func(user, painter->cache.ibuf, painter->lastpaintpos, finalpos); @@ -1057,7 +1060,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl brush_jitter_pos(brush, pos, finalpos); if (painter->cache.enabled) - brush_painter_refresh_cache(painter, finalpos); + brush_painter_refresh_cache(painter, finalpos, use_color_correction); totpaintops += func(user, painter->cache.ibuf, pos, finalpos); @@ -1085,7 +1088,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl brush_jitter_pos(brush, pos, finalpos); if (painter->cache.enabled) - brush_painter_refresh_cache(painter, finalpos); + brush_painter_refresh_cache(painter, finalpos, use_color_correction); totpaintops += func(user, painter->cache.ibuf, painter->lastmousepos, finalpos); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 5f26bff0ad9..decfa22c3e6 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -58,6 +58,8 @@ MINLINE void swap_v4_v4(float a[4], float b[4]); /********************************* Arithmetic ********************************/ +MINLINE void add_v3_fl(float r[3], float f); +MINLINE void add_v4_fl(float r[4], float f); MINLINE void add_v2_v2(float r[2], const float a[2]); MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2]); MINLINE void add_v3_v3(float r[3], const float a[3]); diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index a376d048412..9af55601ff7 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -103,6 +103,12 @@ #define FTOCHAR(val) ((val)<=0.0f)? 0 : (((val)>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*(val))+0.5f)) #define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f)) +#define F3TOCHAR3(v2,v1) (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])) +#define F3TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ + (v1)[3]=FTOCHAR((v2[3])); (v1)[3] = 255; } +#define F4TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ + (v1)[3]=FTOCHAR((v2[3])); (v1)[3]=FTOCHAR((v2[3])); } + #define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);} #define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);} diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 9f6a8afe2d5..e2b7c770356 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -102,6 +102,21 @@ MINLINE void swap_v4_v4(float a[4], float b[4]) /********************************* Arithmetic ********************************/ +MINLINE void add_v3_fl(float r[3], float f) +{ + r[0] += f; + r[1] += f; + r[2] += f; +} + +MINLINE void add_v4_fl(float r[4], float f) +{ + r[0] += f; + r[1] += f; + r[2] += f; + r[3] += f; +} + MINLINE void add_v2_v2(float *r, const float *a) { r[0] += a[0]; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index d7e8d3be66f..83ba35a2e5c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3692,14 +3692,26 @@ static void do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, float } } -static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask) { +static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, int use_color_correction) { if (ps->is_texbrush) { - rgba[0] *= ps->brush->rgb[0]; - rgba[1] *= ps->brush->rgb[1]; - rgba[2] *= ps->brush->rgb[2]; + /* rgba already holds a texture result here from higher level function */ + float rgba_br[3]; + if(use_color_correction){ + srgb_to_linearrgb_v3_v3(rgba_br, ps->brush->rgb); + mul_v3_v3(rgba, rgba_br); + } + else{ + mul_v3_v3(rgba, ps->brush->rgb); + } } else { - VECCOPY(rgba, ps->brush->rgb); + if(use_color_correction){ + srgb_to_linearrgb_v3_v3(rgba, rgba); + } + else { + VECCOPY(rgba, ps->brush->rgb); + } + rgba[3] = 1.0; } if (ps->is_airbrush==0 && mask < 1.0f) { @@ -3736,6 +3748,7 @@ static void *do_projectpaint_thread(void *ph_v) float falloff; int bucket_index; int is_floatbuf = 0; + int use_color_correction = 0; const short tool = ps->tool; rctf bucket_bounds; @@ -3841,6 +3854,7 @@ static void *do_projectpaint_thread(void *ph_v) last_projIma->touch = 1; is_floatbuf = last_projIma->ibuf->rect_float ? 1 : 0; + use_color_correction = (last_projIma->ibuf->profile == IB_PROFILE_LINEAR_RGB) ? 1 : 0; } last_partial_redraw_cell = last_projIma->partRedrawRect + projPixel->bb_cell_index; @@ -3871,7 +3885,7 @@ static void *do_projectpaint_thread(void *ph_v) else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co); break; default: - if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask); + if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask, use_color_correction); else do_projectpaint_draw(ps, projPixel, rgba, alpha, mask); break; } @@ -3987,7 +4001,7 @@ static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, c // we may want to use this later // brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0); - if (brush_painter_paint(painter, project_paint_op, pos, time, pressure, ps)) { + if (brush_painter_paint(painter, project_paint_op, pos, time, pressure, ps, 0)) { return 1; } else return 0; @@ -4058,7 +4072,6 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint) { if(ibuf->rect_float) - /* TODO - should just update a portion from imapaintpartial! */ ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */ if(ibuf->mipmap[0]) @@ -4409,7 +4422,7 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter, brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0); - if (brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s)) { + if (brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s, ibuf->profile == IB_PROFILE_LINEAR_RGB)) { if (update) imapaint_image_update(s->sima, image, ibuf, texpaint); return 1; diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 0e7df43bd34..7dfbc52819e 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -687,9 +687,25 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap) glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skip_pixels); glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skip_rows); - if ((ibuf->rect==NULL) && ibuf->rect_float) - IMB_rect_from_float(ibuf); - + if (ibuf->rect_float){ + /*This case needs a whole new buffer*/ + if(ibuf->rect==NULL) { + IMB_rect_from_float(ibuf); + } + else { + /* Do partial drawing. 'buffer' holds only the changed part. Needed for color corrected result */ + float *buffer = (float *)MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf"); + IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h); + glBindTexture(GL_TEXTURE_2D, ima->bindcode); + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA, + GL_FLOAT, buffer); + MEM_freeN(buffer); + if(ima->tpageflag & IMA_MIPMAP_COMPLETE) + ima->tpageflag &= ~IMA_MIPMAP_COMPLETE; + return; + } + } + glBindTexture(GL_TEXTURE_2D, ima->bindcode); glPixelStorei(GL_UNPACK_ROW_LENGTH, ibuf->x); diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 1eefc58d4de..5d61452e149 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -327,7 +327,12 @@ int imb_get_anim_type(const char *name); */ void IMB_de_interlace(struct ImBuf *ibuf); void IMB_interlace(struct ImBuf *ibuf); + +/* create char buffer, color corrected if necessary, for ImBufs that lack one */ void IMB_rect_from_float(struct ImBuf *ibuf); +/* create char buffer for part of the image, color corrected if necessary, + Changed part will be stored in buffer. This is expected to be used for texture painting updates */ +void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h); void IMB_float_from_rect(struct ImBuf *ibuf); void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */ /* note, check that the conversion exists, only some are supported */ diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 6b35d7df397..90ee2692cf0 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -197,6 +197,135 @@ void IMB_rect_from_float(struct ImBuf *ibuf) ibuf->userflags &= ~IB_RECT_INVALID; } + + +/* converts from linear float to sRGB byte for part of the texture, buffer will hold the changed part */ +void IMB_partial_rect_from_float(struct ImBuf *ibuf,float *buffer, int x, int y, int w, int h) +{ + /* indices to source and destination image pixels */ + float *srcFloatPxl; + unsigned char *dstBytePxl; + /* buffer index will fill buffer */ + float *bufferIndex; + + /* convenience pointers to start of image buffers */ + float *init_srcFloatPxl = (float *)ibuf->rect_float; + unsigned char *init_dstBytePxl = (unsigned char *) ibuf->rect; + + /* Dithering factor */ + float dither= ibuf->dither / 255.0f; + /* respective attributes of image */ + short profile= ibuf->profile; + int channels= ibuf->channels; + + int i, j; + + /* + if called -only- from GPU_paint_update_image this test will never fail + but leaving it here for better or worse + */ + if(init_srcFloatPxl==NULL || (buffer == NULL)){ + return; + } + if(init_dstBytePxl==NULL) { + imb_addrectImBuf(ibuf); + init_dstBytePxl = (unsigned char *) ibuf->rect; + } + if(channels==1) { + for (j = 0; j < h; j++){ + bufferIndex = buffer + w*j*4; + dstBytePxl = init_dstBytePxl + (ibuf->x*(y + j) + x)*4; + srcFloatPxl = init_srcFloatPxl + (ibuf->x*(y + j) + x); + for(i = 0; i < w; i++, dstBytePxl+=4, srcFloatPxl++, bufferIndex+=4) { + dstBytePxl[1]= dstBytePxl[2]= dstBytePxl[3]= dstBytePxl[0] = FTOCHAR(srcFloatPxl[0]); + bufferIndex[0] = bufferIndex[1] = bufferIndex[2] = bufferIndex[3] = srcFloatPxl[0]; + } + } + } + else if (profile == IB_PROFILE_LINEAR_RGB) { + if(channels == 3) { + for (j = 0; j < h; j++){ + bufferIndex = buffer + w*j*4; + dstBytePxl = init_dstBytePxl + (ibuf->x*(y + j) + x)*4; + srcFloatPxl = init_srcFloatPxl + (ibuf->x*(y + j) + x)*3; + for(i = 0; i < w; i++, dstBytePxl+=4, srcFloatPxl+=3, bufferIndex += 4) { + linearrgb_to_srgb_v3_v3(bufferIndex, srcFloatPxl); + F3TOCHAR4(bufferIndex, dstBytePxl); + bufferIndex[3]= 1.0; + } + } + } + else if (channels == 4) { + if (dither != 0.f) { + for (j = 0; j < h; j++){ + bufferIndex = buffer + w*j*4; + dstBytePxl = init_dstBytePxl + (ibuf->x*(y + j) + x)*4; + srcFloatPxl = init_srcFloatPxl + (ibuf->x*(y + j) + x)*4; + for(i = 0; i < w; i++, dstBytePxl+=4, srcFloatPxl+=4, bufferIndex+=4) { + const float d = (BLI_frand()-0.5f)*dither; + linearrgb_to_srgb_v3_v3(bufferIndex, srcFloatPxl); + bufferIndex[3] = srcFloatPxl[3]; + add_v4_fl(bufferIndex, d); + F4TOCHAR4(bufferIndex, dstBytePxl); + } + } + } else { + for (j = 0; j < h; j++){ + bufferIndex = buffer + w*j*4; + dstBytePxl = init_dstBytePxl + (ibuf->x*(y + j) + x)*4; + srcFloatPxl = init_srcFloatPxl + (ibuf->x*(y + j) + x)*4; + for(i = 0; i < w; i++, dstBytePxl+=4, srcFloatPxl+=4, bufferIndex+=4) { + linearrgb_to_srgb_v3_v3(bufferIndex, srcFloatPxl); + bufferIndex[3]= srcFloatPxl[3]; + F4TOCHAR4(bufferIndex, dstBytePxl); + } + } + } + } + } + else if(ELEM(profile, IB_PROFILE_NONE, IB_PROFILE_SRGB)) { + if(channels==3) { + for (j = 0; j < h; j++){ + bufferIndex = buffer + w*j*4; + dstBytePxl = init_dstBytePxl + (ibuf->x*(y + j) + x)*4; + srcFloatPxl = init_srcFloatPxl + (ibuf->x*(y + j) + x)*3; + for(i = 0; i < w; i++, dstBytePxl+=4, srcFloatPxl+=3, bufferIndex+=4) { + copy_v3_v3(bufferIndex, srcFloatPxl); + F3TOCHAR4(bufferIndex, dstBytePxl); + bufferIndex[3] = 1.0; + } + } + } + else { + if (dither != 0.f) { + for (j = 0; j < h; j++){ + bufferIndex = buffer + w*j*4; + dstBytePxl = init_dstBytePxl + (ibuf->x*(y + j) + x)*4; + srcFloatPxl = init_srcFloatPxl + (ibuf->x*(y + j) + x)*4; + for(i = 0; i < w; i++, dstBytePxl+=4, srcFloatPxl+=4, bufferIndex+=4) { + const float d = (BLI_frand()-0.5f)*dither; + copy_v4_v4(bufferIndex, srcFloatPxl); + add_v4_fl(bufferIndex,d); + F4TOCHAR4(bufferIndex, dstBytePxl); + } + } + } else { + for (j = 0; j < h; j++){ + bufferIndex = buffer + w*j*4; + dstBytePxl = init_dstBytePxl + (ibuf->x*(y + j) + x)*4; + srcFloatPxl = init_srcFloatPxl + (ibuf->x*(y + j) + x)*4; + for(i = 0; i < w; i++, dstBytePxl+=4, srcFloatPxl+=4, bufferIndex+=4) { + copy_v4_v4(bufferIndex, srcFloatPxl); + F4TOCHAR4(bufferIndex, dstBytePxl); + } + } + } + } + } + /* ensure user flag is reset */ + ibuf->userflags &= ~IB_RECT_INVALID; +} + static void imb_float_from_rect_nonlinear(struct ImBuf *ibuf, float *fbuf) { float *tof = fbuf; From 474d9c0274fa617ca137febb6c84892acb2cae6e Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 6 Jun 2011 23:19:25 +0000 Subject: [PATCH 076/105] A line of code -can- wreck your day. Should work now, :) --- source/blender/editors/sculpt_paint/paint_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 83ba35a2e5c..cae5c14aa97 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3706,7 +3706,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo } else { if(use_color_correction){ - srgb_to_linearrgb_v3_v3(rgba, rgba); + srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb); } else { VECCOPY(rgba, ps->brush->rgb); From 34b0c217f8ded33146d5098f4b8a6426852f4476 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 02:39:40 +0000 Subject: [PATCH 077/105] Move UI float precission calculation into its own function. --- source/blender/editors/interface/interface.c | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index c431af9fd8e..e94b90d8a29 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -449,6 +449,14 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval) /* link line drawing is not part of buttons or theme.. so we stick with it here */ +static int ui_but_float_precision(uiBut *but, double UNUSED(value)) +{ + int prec= (int)but->a2; + if(prec==0) prec= (but->hardmax < 10.001f) ? 3 : 2; + else CLAMP(prec, 1, 7); + return prec; +} + static void ui_draw_linkline(uiLinkLine *line) { rcti rect; @@ -1530,10 +1538,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen) ui_get_but_string_unit(but, str, maxlen, value, 0); } else { - int prec= (int)but->a2; - if(prec==0) prec= 3; - else CLAMP(prec, 1, 7); - + const int prec= ui_but_float_precision(but, value); BLI_snprintf(str, maxlen, "%.*f", prec, value); } } @@ -2009,10 +2014,7 @@ void ui_check_but(uiBut *but) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str); } else { - int prec= (int)but->a2; - if(prec==0) prec= (but->hardmax < 10.001f) ? 3 : 2; - else CLAMP(prec, 1, 7); - + const int prec= ui_but_float_precision(but, value); BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); } } @@ -2030,11 +2032,9 @@ void ui_check_but(uiBut *but) case LABEL: if(ui_is_but_float(but)) { - int prec= (int)but->a2; + int prec; value= ui_get_but_val(but); - if(prec==0) prec= 3; - else CLAMP(prec, 1, 7); - + prec= ui_but_float_precision(but, value); BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); } else { From 06c3756db85b56da79afee9300f652a4b1e96c26 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 04:06:10 +0000 Subject: [PATCH 078/105] smarter precision calculation, so 0.000001 isn't displayed as 0.00. there is a minor problem with this commit: 0.00001 --> 0.00001 # good 0.000015 --> 0.000015 # good 0.0000199 --> 0.00002 # ok 0.00002 --> 0.000020 # wrong, has trailing 0 Tried to fix this but the case is hard to check for without more calculations which Id like to avoid. --- source/blender/editors/interface/interface.c | 33 +++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e94b90d8a29..5f7cb36cbba 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -449,11 +449,36 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval) /* link line drawing is not part of buttons or theme.. so we stick with it here */ -static int ui_but_float_precision(uiBut *but, double UNUSED(value)) +static int ui_but_float_precision(uiBut *but, double value) { - int prec= (int)but->a2; - if(prec==0) prec= (but->hardmax < 10.001f) ? 3 : 2; - else CLAMP(prec, 1, 7); + int prec; + + /* first check if prec is 0 and fallback to a simple default */ + if((prec= (int)but->a2) == 0) { + prec= (but->hardmax < 10.001f) ? 3 : 2; + } + + /* check on the number of decimal places neede to display + * the number, this is so 0.00001 is not displayed as 0.00, + * _but_, this is only for small values si 10.0001 will not get + * the same treatment */ + if(value != 0.0 && (value= ABS(value)) < 0.1) { + double prec_d= -(log10(value)); + double prec_d_floor = floor(prec_d + FLT_EPSILON); + int test_prec= (int)prec_d_floor; + + /* this check is so 0.00016 from isnt rounded to 0.0001 _but_ it is not working ideally because 0.0002 becomes 0.00020 */ + if(prec_d - prec_d_floor > FLT_EPSILON) { + test_prec += 2; + } + + if(test_prec > prec && test_prec <= 7) { + prec= test_prec; + } + } + + CLAMP(prec, 1, 7); + return prec; } From 82a0461361eb2556542f6e951388b3187b0397d2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 05:26:10 +0000 Subject: [PATCH 079/105] fix for glitch in previous commit with 0.00002 displaying as 0.000020, this uses 2 calls to double_round which I'd rather avoid but at least it now works right for users. --- source/blender/editors/interface/interface.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5f7cb36cbba..a21122698d9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -467,9 +467,15 @@ static int ui_but_float_precision(uiBut *but, double value) double prec_d_floor = floor(prec_d + FLT_EPSILON); int test_prec= (int)prec_d_floor; - /* this check is so 0.00016 from isnt rounded to 0.0001 _but_ it is not working ideally because 0.0002 becomes 0.00020 */ - if(prec_d - prec_d_floor > FLT_EPSILON) { - test_prec += 2; + /* this check is so 0.00016 from isnt rounded to 0.0001 */ + if(prec_d - prec_d_floor > FLT_EPSILON) { /* not ending with a .0~001 */ + /* check if a second decimal place is needed 0.00015 for eg. */ + if(double_round(value, test_prec + 1) - double_round(value, test_prec + 2) != 0.0) { + test_prec += 2; + } + else { + test_prec += 1; + } } if(test_prec > prec && test_prec <= 7) { From 044ae5e3c8d8e3ed30366c791a0596392a46689a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 07:57:26 +0000 Subject: [PATCH 080/105] error pointed out by Jeroen Bakker with the math nodes round function. was incorrectly using the output rather then the input. --- source/blender/nodes/intern/CMP_nodes/CMP_math.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index 4348fd18759..da17e5fe288 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -140,7 +140,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 14: /* Round */ { - out[0]= (out[0]<0)?(int)(in[0] - 0.5f):(int)(in[0] + 0.5f); + out[0]= floorf(in[0] + 0.5f); } break; case 15: /* Less Than */ From 8ae4476fc4049b991c09615ec7521666f295db93 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 08:16:42 +0000 Subject: [PATCH 081/105] getting useful results out of the round compo node was tricky, use the second value to determine how much to round by (can be used like a posterize filter) --- source/blender/nodes/intern/CMP_nodes/CMP_math.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index da17e5fe288..96fa13d99f0 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -140,7 +140,12 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 14: /* Round */ { - out[0]= floorf(in[0] + 0.5f); + /* round by the second value */ + if( in2[0] != 0.0f ) + out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0]; + else + floorf(in[0] + 0.5f); + } break; case 15: /* Less Than */ From 617a08162f174dad7a57d5370d081e76f4aff378 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 08:47:33 +0000 Subject: [PATCH 082/105] update ctest md5sums for import/export to match changes to the scripts, also some minor formatting change for bpy_props.c --- source/blender/python/intern/bpy_props.c | 12 ++++++-- source/tests/CMakeLists.txt | 36 ++++++++++++------------ 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index c6576fe2319..dc17d01fbae 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -281,11 +281,15 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c * calls because of static strins passed to pyrna_set_to_enum_bitfield */ #define BPY_PROPDEF_CHECK(_func, _property_flag_items) \ if(id_len >= MAX_IDPROP_NAME) { \ - PyErr_Format(PyExc_TypeError, #_func"(): '%.200s' too long, max length is %d", id, MAX_IDPROP_NAME-1); \ + PyErr_Format(PyExc_TypeError, \ + #_func"(): '%.200s' too long, max length is %d", \ + id, MAX_IDPROP_NAME-1); \ return NULL; \ } \ if(RNA_def_property_free_identifier(srna, id) == -1) { \ - PyErr_Format(PyExc_TypeError, #_func"(): '%s' is defined as a non-dynamic type", id); \ + PyErr_Format(PyExc_TypeError, \ + #_func"(): '%s' is defined as a non-dynamic type", \ + id); \ return NULL; \ } \ if(pyopts && pyrna_set_to_enum_bitfield(_property_flag_items, pyopts, &opts, #_func"(options={...}):")) \ @@ -294,7 +298,9 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c #define BPY_PROPDEF_SUBTYPE_CHECK(_func, _property_flag_items, _subtype) \ BPY_PROPDEF_CHECK(_func, _property_flag_items) \ if(pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \ - PyErr_Format(PyExc_TypeError, #_func"(subtype='%s'): invalid subtype", pysubtype); \ + PyErr_Format(PyExc_TypeError, \ + #_func"(subtype='%s'): invalid subtype", \ + pysubtype); \ return NULL; \ } \ diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index 97e46bd44f2..7abac7b9739 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -68,21 +68,21 @@ add_test(script_run_operators ${TEST_BLENDER_EXE} add_test(import_obj_cube ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/cube.obj'\) - --md5=4d090508b812b5e08168aa2614746bda --md5_method=SCENE + --md5=39cce4bacac2d1b18fc470380279bc15 --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_obj_cube.blend ) add_test(import_obj_nurbs_cyclic ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/nurbs_cyclic.obj'\) - --md5=9e0da7b65b4c4f818a203d56af2d3a4b --md5_method=SCENE + --md5=ad3c307e5883224a0492378cd32691ab --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_obj_nurbs_cyclic.blend ) add_test(import_obj_makehuman ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/makehuman.obj'\) - --md5=e0829dc078b0789e1d81f1071235bc4f --md5_method=SCENE + --md5=c9f78b185e58358daa4ecaecfa75464e --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_obj_makehuman.blend ) @@ -93,7 +93,7 @@ add_test(export_obj_cube ${TEST_BLENDER_EXE} --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_cube.obj',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_obj_cube.obj --md5_source=${TEST_OUT_DIR}/export_obj_cube.mtl - --md5=f0580f0e5d7b379e0460f11d8fde244d --md5_method=FILE + --md5=70bdc394c2726203ad26c085176e3484 --md5_method=FILE ) add_test(export_obj_nurbs ${TEST_BLENDER_EXE} @@ -102,7 +102,7 @@ add_test(export_obj_nurbs ${TEST_BLENDER_EXE} --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_nurbs.obj',use_selection=False,use_nurbs=True\) --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.obj --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.mtl - --md5=aa00875343e0feea449739146d26d7d0 --md5_method=FILE + --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE ) add_test(export_obj_all_objects ${TEST_BLENDER_EXE} @@ -111,7 +111,7 @@ add_test(export_obj_all_objects ${TEST_BLENDER_EXE} --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_all_objects.obj',use_selection=False,use_nurbs=True\) --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.obj --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.mtl - --md5=4c93980ecfb7d02ca68d3da8e2fced69 --md5_method=FILE + --md5=d06bd49e6c084e4e3348fa397a88790c --md5_method=FILE ) @@ -172,21 +172,21 @@ add_test(import_stl_knot_max_simplified ${TEST_BLENDER_EXE} add_test(import_x3d_cube ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/color_cube.x3d'\) - --md5=330c0cf6e8c44d5fe5b662d30b75be89 --md5_method=SCENE + --md5=2ed64325dd3d62be6ce43c64219376ec --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_x3d_cube.blend ) add_test(import_x3d_teapot ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/teapot.x3d'\) - --md5=b2f02157bc918b54b835d1e6ece70423 --md5_method=SCENE + --md5=8b8b386900b8e3d2c036a38c625f4079 --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_x3d_teapot.blend ) add_test(import_x3d_suzanne_material ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/suzanne_material.x3d'\) - --md5=11837901cbbfabef52b6ab4f26fe97b3 --md5_method=SCENE + --md5=999129ba835f0ccb98c4bb299f6c2fef --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_x3d_suzanne_material.blend ) @@ -196,7 +196,7 @@ add_test(export_x3d_cube ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_cube.x3d',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_x3d_cube.x3d - --md5=9198ca86f19b68a4f1eb75bb48cb3dea --md5_method=FILE + --md5=30d2b056c004144cd4a0d172484a66f3 --md5_method=FILE ) add_test(export_x3d_nurbs ${TEST_BLENDER_EXE} @@ -204,7 +204,7 @@ add_test(export_x3d_nurbs ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_nurbs.x3d',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_x3d_nurbs.x3d - --md5=078c0ca5a08f123cd2cdac48afb54853 --md5_method=FILE + --md5=7c15afe7b0cf007b842a925508b7d966 --md5_method=FILE ) add_test(export_x3d_all_objects ${TEST_BLENDER_EXE} @@ -212,7 +212,7 @@ add_test(export_x3d_all_objects ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_all_objects.x3d',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_x3d_all_objects.x3d - --md5=090f4f36c450826a043f9cd074d9cbb4 --md5_method=FILE + --md5=cef017805f684f27c311fdf4ba87462a --md5_method=FILE ) @@ -228,14 +228,14 @@ add_test(import_3ds_cube ${TEST_BLENDER_EXE} add_test(import_3ds_hierarchy_lara ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_lara.3ds'\) - --md5=2e9812099b26ad607fdcf4c7be918c71 --md5_method=SCENE + --md5=766c873d9fdb5f190e43796cfbae63b6 --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_3ds_hierarchy_lara.blend ) add_test(import_3ds_hierarchy_greek_trireme ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_greek_trireme.3ds'\) - --md5=d05b922d7be20356d8409d1f768a3a9a --md5_method=SCENE + --md5=b62ee30101e8999cb91ef4f8a8760056 --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_3ds_hierarchy_greek_trireme.blend ) @@ -261,7 +261,7 @@ add_test(export_3ds_all_objects ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_all_objects.3ds',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_3ds_all_objects.3ds - --md5=87349a4699f1006e8194fb0ac05ac9c8 --md5_method=FILE + --md5=cdf8fa8475fda0b9ef565ac09339254b --md5_method=FILE ) @@ -273,7 +273,7 @@ add_test(export_fbx_cube ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_cube.fbx',use_selection=False,use_metadata=False\) --md5_source=${TEST_OUT_DIR}/export_fbx_cube.fbx - --md5=b2428e11b9ae650819f8d8b38cd869f7 --md5_method=FILE + --md5=642a5a1fa199d5b9bbf1643519ae974d --md5_method=FILE ) add_test(export_fbx_nurbs ${TEST_BLENDER_EXE} @@ -281,7 +281,7 @@ add_test(export_fbx_nurbs ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_nurbs.fbx',use_selection=False,use_metadata=False\) --md5_source=${TEST_OUT_DIR}/export_fbx_nurbs.fbx - --md5=741b536e98d6b105952766d0f290f270 --md5_method=FILE + --md5=ec1e8965bdbc3bf70707d77f82c2cb9c --md5_method=FILE ) add_test(export_fbx_all_objects ${TEST_BLENDER_EXE} @@ -289,5 +289,5 @@ add_test(export_fbx_all_objects ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\) --md5_source=${TEST_OUT_DIR}/export_fbx_all_objects.fbx - --md5=d6b8b027cd2a0e99d88e5c3d77932748 --md5_method=FILE + --md5=af3b65665687ac92e4aba07b017d87fe --md5_method=FILE ) From 3cd3cc892faa864cde4171b1752679bfb062066b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 09:35:20 +0000 Subject: [PATCH 083/105] fix for edge slide snapping values being incorrect (reported by Nether Hound). Also dont call the value a 'Percent' and clamp the range displayed in the header. snap range being --- source/blender/editors/transform/transform.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 27ca345e132..181fb0f0aac 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4858,8 +4858,8 @@ void initEdgeSlide(TransInfo *t) t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; - t->snap[1] = (float)((5.0/180)*M_PI); - t->snap[2] = t->snap[1] * 0.2f; + t->snap[1] = 0.1f; + t->snap[2] = t->snap[1] * 0.1f; t->num.increment = t->snap[1]; @@ -4985,6 +4985,9 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2])) snapGrid(t, &final); + /* only do this so out of range values are not displayed */ + CLAMP(final, -1.0f, 1.0f); + if (hasNumInput(&t->num)) { char c[20]; @@ -4992,10 +4995,10 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - sprintf(str, "Edge Slide Percent: %s", &c[0]); + sprintf(str, "Edge Slide: %s", &c[0]); } else { - sprintf(str, "Edge Slide Percent: %.2f", final); + sprintf(str, "Edge Slide: %.2f", final); } CLAMP(final, -1.0f, 1.0f); From 9c8cc9fe60e783f698e291ed5ef338a477214f22 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 10:54:57 +0000 Subject: [PATCH 084/105] rna option not to save certain properties for redoing later, currently only used by operator presets. --- .../scripts/startup/bl_operators/presets.py | 2 +- source/blender/makesrna/RNA_types.h | 2 ++ source/blender/makesrna/intern/rna_rna.c | 12 ++++++++++ source/blender/python/intern/bpy_props.c | 22 ++++++++++--------- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 493c51ad237..2175d7528a4 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -326,7 +326,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator): ret = [] for prop_id, prop in operator_rna.properties.items(): - if (not prop.is_hidden) and prop_id not in properties_blacklist: + if (not (prop.is_hidden or prop.is_skip_save)) and prop_id not in properties_blacklist: ret.append("op.%s" % prop_id) return ret diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 090b87e9e39..ec213d6a496 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -159,6 +159,8 @@ typedef enum PropertyFlag { /* hidden in the user interface */ PROP_HIDDEN = 1<<19, + /* do not write in presets */ + PROP_SKIP_SAVE = 1<<28, /* function paramater flags */ PROP_REQUIRED = 1<<2, diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 84bb624b546..b4da3a02442 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -493,6 +493,13 @@ static int rna_Property_is_hidden_get(PointerRNA *ptr) return prop->flag & PROP_HIDDEN ? 1:0; } +static int rna_Property_is_skip_save_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + return prop->flag & PROP_SKIP_SAVE ? 1:0; +} + + static int rna_Property_is_enum_flag_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -1037,6 +1044,11 @@ static void rna_def_property(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", NULL); RNA_def_property_ui_text(prop, "Hidden", "True when the property is hidden"); + prop= RNA_def_property(srna, "is_skip_save", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Property_is_skip_save_get", NULL); + RNA_def_property_ui_text(prop, "Skip Save", "True when the property is not saved in presets"); + prop= RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", NULL); diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index dc17d01fbae..b8912a1d4a7 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -56,11 +56,13 @@ extern BPy_StructRNA *bpy_context_module; static EnumPropertyItem property_flag_items[]= { {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""}, + {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""}, {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem property_flag_enum_items[]= { {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""}, + {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""}, {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""}, {PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""}, {0, NULL, 0, NULL, NULL}}; @@ -339,7 +341,7 @@ PyDoc_STRVAR(BPy_BoolProperty_doc, "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" " :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" " :type subtype: string\n" @@ -403,7 +405,7 @@ BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC " :arg default: sequence of booleans the length of *size*.\n" " :type default: sequence\n" -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" " :arg subtype: Enumerator in ['COLOR', 'TRANSLATION', 'DIRECTION', 'VELOCITY', 'ACCELERATION', 'MATRIX', 'EULER', 'QUATERNION', 'AXISANGLE', 'XYZ', 'COLOR_GAMMA', 'LAYER', 'NONE'].\n" " :type subtype: string\n" @@ -479,7 +481,7 @@ PyDoc_STRVAR(BPy_IntProperty_doc, "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" " :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" " :type subtype: string\n" @@ -545,7 +547,7 @@ BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC " :arg default: sequence of ints the length of *size*.\n" " :type default: sequence\n" -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" " :arg subtype: Enumerator in ['COLOR', 'TRANSLATION', 'DIRECTION', 'VELOCITY', 'ACCELERATION', 'MATRIX', 'EULER', 'QUATERNION', 'AXISANGLE', 'XYZ', 'COLOR_GAMMA', 'LAYER', 'NONE'].\n" " :type subtype: string\n" @@ -624,7 +626,7 @@ PyDoc_STRVAR(BPy_FloatProperty_doc, "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" " :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" " :type subtype: string\n" @@ -701,7 +703,7 @@ BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC " :arg default: sequence of floats the length of *size*.\n" " :type default: sequence\n" -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" " :arg subtype: Enumerator in ['COLOR', 'TRANSLATION', 'DIRECTION', 'VELOCITY', 'ACCELERATION', 'MATRIX', 'EULER', 'QUATERNION', 'AXISANGLE', 'XYZ', 'COLOR_GAMMA', 'LAYER', 'NONE'].\n" " :type subtype: string\n" @@ -779,7 +781,7 @@ PyDoc_STRVAR(BPy_StringProperty_doc, "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" " :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILENAME', 'NONE'].\n" " :type subtype: string\n" @@ -1054,7 +1056,7 @@ BPY_PROPDEF_DESC_DOC " is disabled otherwise a set which may only contain string identifiers\n" " used in *items*.\n" " :type default: string or set\n" -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE', 'ENUM_FLAG'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'ENUM_FLAG'].\n" " :type options: set\n" " :arg items: sequence of enum items formatted:\n" " [(identifier, name, description), ...] where the identifier is used\n" @@ -1199,7 +1201,7 @@ PyDoc_STRVAR(BPy_PointerProperty_doc, " :type type: class\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" BPY_PROPDEF_UPDATE_DOC ); @@ -1260,7 +1262,7 @@ PyDoc_STRVAR(BPy_CollectionProperty_doc, " :type type: class\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC -" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n" +" :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE'].\n" " :type options: set\n" ); static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) From 53939ee4e9af92c533f6b86833f3003869c89769 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 7 Jun 2011 15:33:01 +0000 Subject: [PATCH 085/105] Fix: correct spacing for file select items, using font size + dpi. --- source/blender/editors/space_file/filesel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 793267bfa8c..45193a38ef5 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -403,12 +403,10 @@ float file_font_pointsize(void) uiStyleFontSet(&style->widget); s = BLF_height(style->widget.uifont_id, tmp); return style->widget.points; -#elif 0 +#else uiStyle *style= U.uistyles.first; uiStyleFontSet(&style->widget); - return style->widget.points; -#else - return UI_UNIT_Y * 0.6666f; + return style->widget.points * UI_DPI_FAC; #endif } From e44ae2c2a982cd3c98e5544bfe0a241f0b063485 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 16:08:49 +0000 Subject: [PATCH 086/105] disable the readonly state while rna property callbacks run. --- source/blender/python/intern/bpy_props.c | 9 +++++++++ source/blender/python/intern/bpy_rna.c | 9 +++++++++ source/blender/python/intern/bpy_rna.h | 1 + 3 files changed, 19 insertions(+) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index b8912a1d4a7..8ed4e41de3e 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -185,9 +185,14 @@ void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struct Prope PyObject *args; PyObject *self; PyObject *ret; + const int is_write_ok= pyrna_write_check(); BLI_assert(py_data != NULL); + if(!is_write_ok) { + pyrna_write_set(TRUE); + } + bpy_context_set(C, &gilstate); py_func= py_data[BPY_DATA_CB_SLOT_UPDATE]; @@ -216,6 +221,10 @@ void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struct Prope } bpy_context_clear(C, &gilstate); + + if(!is_write_ok) { + pyrna_write_set(FALSE); + } } static int bpy_prop_callback_check(PyObject *py_func, int argcount) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4fe13bc6818..38cc3edd8f6 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -323,11 +323,20 @@ int pyrna_write_check(void) { return !rna_disallow_writes; } + +void pyrna_write_set(int val) +{ + rna_disallow_writes= !val; +} #else // USE_PEDANTIC_WRITE int pyrna_write_check(void) { return TRUE; } +void pyrna_write_set(int UNUSED(val)) +{ + /* nothing */ +} #endif // USE_PEDANTIC_WRITE static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self); diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index dbb5fc2feb7..5db352af53d 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -183,6 +183,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop); int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value); int pyrna_write_check(void); +void pyrna_write_set(int val); int pyrna_struct_validity_check(BPy_StructRNA *pysrna); int pyrna_prop_validity_check(BPy_PropertyRNA *self); From d16c1f36653196d32f9915b4ba633a9c4c6569d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 16:47:25 +0000 Subject: [PATCH 087/105] fix for sequencer transform with effects strips where the effects could be moved to invalid times to avoid overlap but would immediately refresh back to overlapping locations after. --- .../editors/transform/transform_conversions.c | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index c7699f7249c..593ab7b61e9 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4016,6 +4016,7 @@ static void freeSeqData(TransInfo *t) } if(overlap) { + int has_effect= 0; for(seq= seqbasep->first; seq; seq= seq->next) seq->tmp= NULL; @@ -4024,12 +4025,48 @@ static void freeSeqData(TransInfo *t) for(a=0; atotal; a++, td++) { seq= ((TransDataSeq *)td->extra)->seq; if ((seq != seq_prev)) { - /* Tag seq with a non zero value, used by shuffle_seq_time to identify the ones to shuffle */ - seq->tmp= (void*)1; + /* check effects strips, we cant change their time */ + if((seq->type & SEQ_EFFECT) && seq->seq1) { + // shuffle_seq(seqbasep, seq, t->scene); + has_effect= TRUE; + } + else { + /* Tag seq with a non zero value, used by shuffle_seq_time to identify the ones to shuffle */ + seq->tmp= (void*)1; + } } } shuffle_seq_time(seqbasep, t->scene); + + if(has_effect) { + /* update effects strips based on strips just moved in time */ + td= t->data; + seq_prev= NULL; + for(a=0; atotal; a++, td++) { + seq= ((TransDataSeq *)td->extra)->seq; + if ((seq != seq_prev)) { + if((seq->type & SEQ_EFFECT) && seq->seq1) { + calc_sequence(t->scene, seq); + } + } + } + + /* now if any effects _still_ overlap, we need to move them up */ + td= t->data; + seq_prev= NULL; + for(a=0; atotal; a++, td++) { + seq= ((TransDataSeq *)td->extra)->seq; + if ((seq != seq_prev)) { + if((seq->type & SEQ_EFFECT) && seq->seq1) { + if(seq_test_overlap(seqbasep, seq)) { + shuffle_seq(seqbasep, seq, t->scene); + } + } + } + } + /* done with effects */ + } } } #endif From 299602b360291377e190a7d96c449e03693f05a2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 18:04:03 +0000 Subject: [PATCH 088/105] fix for vertex group copy to selected - was using un-initialized stack memory if the source / target object had no vertex group. - if the target object had no vertex groups it would fails silently (not a bug but not very good functionality) - added an error message if any copying fails. --- source/blender/editors/include/ED_mesh.h | 2 +- source/blender/editors/object/object_vgroup.c | 43 +++++++++++++++---- .../editors/transform/transform_conversions.c | 1 - 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index ade69a00ff8..8bb77ad43a0 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -206,7 +206,7 @@ struct bDeformGroup *ED_vgroup_add(struct Object *ob); struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name); void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup); void ED_vgroup_select_by_name(struct Object *ob, const char *name); -void ED_vgroup_data_create(struct ID *id); +int ED_vgroup_data_create(struct ID *id); int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from); void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 072c08c7ec0..fca21cdcf64 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -77,6 +77,7 @@ static void vgroup_remap_update_users(Object *ob, int *map); static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *defgroup); static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg); +static void vgroup_delete_all(Object *ob); static Lattice *vgroup_edit_lattice(Object *ob) { @@ -138,22 +139,30 @@ void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup) vgroup_delete_object_mode(ob, dg); } -void ED_vgroup_data_create(ID *id) +int ED_vgroup_data_create(ID *id) { /* create deform verts */ if(GS(id->name)==ID_ME) { Mesh *me= (Mesh *)id; me->dvert= CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert); + return TRUE; } else if(GS(id->name)==ID_LT) { Lattice *lt= (Lattice *)id; lt->dvert= MEM_callocN(sizeof(MDeformVert)*lt->pntsu*lt->pntsv*lt->pntsw, "lattice deformVert"); + return TRUE; + } + else { + return FALSE; } } static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_tot) { + *dvert_tot = 0; + *dvert_arr = NULL; + if(id) { switch(GS(id->name)) { case ID_ME: @@ -166,8 +175,6 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to int i; if (!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) { - *dvert_tot = 0; - *dvert_arr = NULL; return 0; } @@ -195,8 +202,9 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to return 1; } - else + else { return 0; + } } case ID_LT: { @@ -222,8 +230,6 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to } } - *dvert_arr= NULL; - *dvert_tot= 0; return 0; } @@ -265,13 +271,24 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from) int i; int totdef_from= BLI_countlist(&ob_from->defbase); int totdef= BLI_countlist(&ob->defbase); + short new_vgroup= FALSE; ED_vgroup_give_parray(ob_from->data, &dvert_array_from, &dvert_tot_from); ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot); + if((dvert_array == NULL) && (dvert_array_from != NULL) && ED_vgroup_data_create(ob->data)) { + ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot); + new_vgroup= TRUE; + } + if(ob==ob_from || dvert_tot==0 || (dvert_tot != dvert_tot_from) || dvert_array_from==NULL || dvert_array==NULL) { if (dvert_array) MEM_freeN(dvert_array); if (dvert_array_from) MEM_freeN(dvert_array_from); + + if(new_vgroup == TRUE) { + /* free the newly added vgroup since it wasn't compatible */ + vgroup_delete_all(ob->data); + } return 0; } @@ -1988,17 +2005,25 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *UNUSED(op)) +static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) { Object *obact= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + int change= 0; + int fail= 0; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if(obact != ob) - ED_vgroup_copy_array(ob, obact); + if(obact != ob) { + if(ED_vgroup_copy_array(ob, obact)) change++; + else fail++; + } } CTX_DATA_END; + if((change == 0 && fail == 0) || fail) { + BKE_reportf(op->reports, RPT_ERROR, "Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indicies", change, fail); + } + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 593ab7b61e9..68aa27a7b62 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4027,7 +4027,6 @@ static void freeSeqData(TransInfo *t) if ((seq != seq_prev)) { /* check effects strips, we cant change their time */ if((seq->type & SEQ_EFFECT) && seq->seq1) { - // shuffle_seq(seqbasep, seq, t->scene); has_effect= TRUE; } else { From 7fd1fe9fc8e3154c36a57ed2c69409d526ee1171 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jun 2011 18:34:33 +0000 Subject: [PATCH 089/105] draw sequences with invalid effect frame ranges pink to highlight they are invalid and wont render. --- source/blender/blenkernel/intern/sequencer.c | 5 +++ source/blender/editors/object/object_vgroup.c | 2 +- .../editors/space_sequencer/sequencer_draw.c | 8 ++-- source/blender/makesdna/DNA_sequence_types.h | 45 ++++++++++--------- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b94782f9a25..b82ac69fc9e 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -594,7 +594,12 @@ void calc_sequence(Scene *scene, Sequence *seq) seq->start= seq->enddisp; seq->enddisp = seq->startdisp; seq->startdisp= seq->start; + seq->flag |= SEQ_INVALID_EFFECT; } + else { + seq->flag &= ~SEQ_INVALID_EFFECT; + } + seq->len= seq->enddisp - seq->startdisp; } else { diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index fca21cdcf64..52ba9460818 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -287,7 +287,7 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from) if(new_vgroup == TRUE) { /* free the newly added vgroup since it wasn't compatible */ - vgroup_delete_all(ob->data); + vgroup_delete_all(ob); } return 0; } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index f351d52db07..119c5da309e 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -550,15 +550,17 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa glShadeModel(GL_SMOOTH); glBegin(GL_QUADS); - if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50); + if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } + else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50); else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0); glColor3ubv(col); glVertex2f(x1,y1); glVertex2f(x2,y1); - - if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5); + + if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; } + else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5); else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -5); glColor3ubv((GLubyte *)col); diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index f89cc9d518a..3e7654bcf47 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -253,27 +253,30 @@ typedef struct SpeedControlVars { #define SEQ_NAME_MAXSTR 24 /* seq->flag */ -#define SEQ_LEFTSEL 2 -#define SEQ_RIGHTSEL 4 -#define SEQ_OVERLAP 8 -#define SEQ_FILTERY 16 -#define SEQ_MUTE 32 -#define SEQ_MAKE_PREMUL 64 -#define SEQ_REVERSE_FRAMES 128 -#define SEQ_IPO_FRAME_LOCKED 256 -#define SEQ_EFFECT_NOT_LOADED 512 -#define SEQ_FLAG_DELETE 1024 -#define SEQ_FLIPX 2048 -#define SEQ_FLIPY 4096 -#define SEQ_MAKE_FLOAT 8192 -#define SEQ_LOCK 16384 -#define SEQ_USE_PROXY 32768 -#define SEQ_USE_TRANSFORM 65536 -#define SEQ_USE_CROP 131072 -#define SEQ_USE_COLOR_BALANCE 262144 -#define SEQ_USE_PROXY_CUSTOM_DIR 524288 -#define SEQ_USE_PROXY_CUSTOM_FILE 2097152 -#define SEQ_USE_EFFECT_DEFAULT_FADE 4194304 +#define SEQ_LEFTSEL (1<<1) +#define SEQ_RIGHTSEL (1<<2) +#define SEQ_OVERLAP (1<<3) +#define SEQ_FILTERY (1<<4) +#define SEQ_MUTE (1<<5) +#define SEQ_MAKE_PREMUL (1<<6) +#define SEQ_REVERSE_FRAMES (1<<7) +#define SEQ_IPO_FRAME_LOCKED (1<<8) +#define SEQ_EFFECT_NOT_LOADED (1<<9) +#define SEQ_FLAG_DELETE (1<<10) +#define SEQ_FLIPX (1<<11) +#define SEQ_FLIPY (1<<12) +#define SEQ_MAKE_FLOAT (1<<13) +#define SEQ_LOCK (1<<14) +#define SEQ_USE_PROXY (1<<15) +#define SEQ_USE_TRANSFORM (1<<16) +#define SEQ_USE_CROP (1<<17) +#define SEQ_USE_COLOR_BALANCE (1<<18) +#define SEQ_USE_PROXY_CUSTOM_DIR (1<<19) + +#define SEQ_USE_PROXY_CUSTOM_FILE (1<<21) +#define SEQ_USE_EFFECT_DEFAULT_FADE (1<<22) + +#define SEQ_INVALID_EFFECT (1<<31) /* convenience define for all selection flags */ #define SEQ_ALLSEL (SELECT+SEQ_LEFTSEL+SEQ_RIGHTSEL) From 42ece56e91db997425f010e2cf18c9021113f5e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Jun 2011 01:53:12 +0000 Subject: [PATCH 090/105] don't write file history in backgound mode (running ctest would overwrite all my recent-files.txt), and add an error about mingw/quicktime being unsupported. --- CMakeLists.txt | 9 +++++++++ source/blender/windowmanager/intern/wm_files.c | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f99136097c..c5e5258e062 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,6 +188,9 @@ if(APPLE) option(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF) endif() +#----------------------------------------------------------------------------- +# Check for conflicting/unsupported configurations + if(NOT WITH_GAMEENGINE AND WITH_PLAYER) message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE") endif() @@ -209,6 +212,12 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL) message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF") endif() +if(WITH_CODEC_QUICKTIME AND MINGW) + message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF " + "because it is currently unsupported, remove this " + "line if youre a developer who wants to add support.") +endif() + # may as well build python module without a UI if(WITH_PYTHON_MODULE) set(WITH_HEADLESS ON) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 5d005e23029..c088d0d2d43 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -747,7 +747,10 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re if(fileflags & G_FILE_AUTOPLAY) G.fileflags |= G_FILE_AUTOPLAY; else G.fileflags &= ~G_FILE_AUTOPLAY; - write_history(); + /* prevent background mode scripts from clobbering history */ + if(!G.background) { + write_history(); + } /* run this function after because the file cant be written before the blend is */ if (ibuf_thumb) { From 9dd066eb652c478b6eeba2630aea999490739849 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Jun 2011 05:39:58 +0000 Subject: [PATCH 091/105] cmake: remove python include in the wm module, set opengl as a system include. --- CMakeLists.txt | 2 +- source/blender/windowmanager/CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5e5258e062..e9a72cf6e51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1041,7 +1041,7 @@ endif() #----------------------------------------------------------------------------- # Configure OpenGL. find_package(OpenGL) -blender_include_dirs("${OPENGL_INCLUDE_DIR}") +blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}") # unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake # unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 6d125c01af4..0cf59a9b598 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -101,7 +101,6 @@ endif() if(WITH_PYTHON) list(APPEND INC ../python) - list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS}) add_definitions(-DWITH_PYTHON) if(WITH_PYTHON_SECURITY) From 40c171a69f3ae47368c277748537f1a1a9b451d6 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Wed, 8 Jun 2011 09:01:41 +0000 Subject: [PATCH 092/105] fix of fix :| [real fix for #36787 -- it was wrongly fixed on #36964] I guess I tested the fix outside the camera view (which always worked). duhhh Working now. --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index cac801c80ef..1eeb7c0f94b 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -258,7 +258,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c draw_letterbox = 1; } else { - camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom)*4.0f; + camzoom = 1.0 / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); } } else { From cec102e7813a6eeb45223be9c14d4850146f5d8e Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 8 Jun 2011 10:57:24 +0000 Subject: [PATCH 093/105] Bugfix [#27586] P for setting playback range is clamped to > 0 Thanks for the patch Bastien Montagne. Was just legacy code from 2.4x --- source/blender/editors/animation/anim_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 0e0bf275d8f..7a94a21d41e 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -199,8 +199,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op) * - must clamp within allowable limits * - end must not be before start (though this won't occur most of the time) */ - if (sfra < 1) sfra = 1.0f; - if (efra < 1) efra = 1.0f; + FRAMENUMBER_MIN_CLAMP(sfra); + FRAMENUMBER_MIN_CLAMP(efra); if (efra < sfra) efra= sfra; scene->r.flag |= SCER_PRV_RANGE; From 899f2776db6f41f5bb05342826280f31b66ec79c Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 8 Jun 2011 11:53:07 +0000 Subject: [PATCH 094/105] Shuffle some build code around to ensure debug builds on Windows actually run too. * creator/SConscript is now empty, code is moved to an emitter function in Blender.py * make sure COLLADA debug libs are used when BF_DEBUG=True --- SConstruct | 9 ++-- build_files/scons/config/win64-vc-config.py | 2 +- build_files/scons/tools/Blender.py | 59 ++++++++++++++++++--- source/creator/SConscript | 47 +--------------- 4 files changed, 56 insertions(+), 61 deletions(-) diff --git a/SConstruct b/SConstruct index e928970f6b8..2f63ddf0501 100644 --- a/SConstruct +++ b/SConstruct @@ -306,10 +306,6 @@ if env['BF_NO_ELBEEM'] == 1: env['CXXFLAGS'].append('-DDISABLE_ELBEEM') env['CCFLAGS'].append('-DDISABLE_ELBEEM') -if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-ming', 'win64-vc'): - env['PLATFORM_LINKFLAGS'].remove('/ENTRY:mainCRTStartup') - env['PLATFORM_LINKFLAGS'].append('/ENTRY:main') - # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir B.root_build_dir = env['BF_BUILDDIR'] B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc') @@ -409,17 +405,18 @@ if B.arguments.get('BF_PRIORITYLIST', '0')=='1': B.propose_priorities() dobj = B.buildinfo(env, "dynamic") + B.resources +creob = B.creator(env) thestatlibs, thelibincs = B.setup_staticlibs(env) thesyslibs = B.setup_syslibs(env) if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']: - env.BlenderProg(B.root_build_dir, "blender", mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender') + env.BlenderProg(B.root_build_dir, "blender", creob + mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender') if env['WITH_BF_PLAYER']: playerlist = B.create_blender_liblist(env, 'player') playerlist += B.create_blender_liblist(env, 'player2') playerlist += B.create_blender_liblist(env, 'intern') playerlist += B.create_blender_liblist(env, 'extern') - env.BlenderProg(B.root_build_dir, "blenderplayer", playerlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer') + env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer') ##### Now define some targets diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 2c990941764..3332a560ed2 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -170,7 +170,7 @@ CCFLAGS = ['/nologo', '/Ob1', '/J', '/W0', '/Gd', '/we4013', '/wd4018', '/wd4244 CXXFLAGS = ['/EHsc'] BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast'] -BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr'] +BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od'] CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE'] REL_CFLAGS = ['-O2', '-DNDEBUG'] diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 8dbed82ed84..50f43a03b8b 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -258,7 +258,10 @@ def setup_syslibs(lenv): syslibs += Split(lenv['BF_PTHREADS_LIB']) if lenv['WITH_BF_COLLADA']: syslibs.append(lenv['BF_PCRE_LIB']) - syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) + if lenv['BF_DEBUG']: + syslibs += [colladalib+'_d' for colladalib in Split(lenv['BF_OPENCOLLADA_LIB'])] + else: + syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) syslibs.append(lenv['BF_EXPAT_LIB']) if not lenv['WITH_BF_STATICLIBSAMPLERATE']: @@ -287,6 +290,50 @@ def propose_priorities(): print "\t\t",new_priority, v new_priority += 5 +# emits the necessary file objects for creator.c, to be used in creating +# the final blender executable +def creator(env): + sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources + + incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']] + + defs = [] + if env['WITH_BF_QUICKTIME']: + incs.append(env['BF_QUICKTIME_INC']) + defs.append('WITH_QUICKTIME') + + if env['WITH_BF_BINRELOC']: + incs.append('#/extern/binreloc/include') + defs.append('WITH_BINRELOC') + + if env['WITH_BF_OPENEXR']: + defs.append('WITH_OPENEXR') + + if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') + + if not env['WITH_BF_SDL']: + defs.append('DISABLE_SDL') + + if env['WITH_BF_PYTHON']: + incs.append('#/source/blender/python') + defs.append('WITH_PYTHON') + if env['BF_DEBUG']: + defs.append('_DEBUG') + + if env['BF_BUILDINFO']: + defs.append('BUILD_DATE') + defs.append('NAN_BUILDINFO') + + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): + incs.append(env['BF_PTHREADS_INC']) + + env.Append(CPPDEFINES=defs) + env.Append(CPPPATH=incs) + obj = [env.Object(root_build_dir+'source/creator/creator/creator', ['#source/creator/creator.c'])] + + return obj + ## TODO: see if this can be made in an emitter def buildinfo(lenv, build_type): """ @@ -324,7 +371,7 @@ def buildinfo(lenv, build_type): lenv.Append (CPPPATH = [root_build_dir+'source/blender/blenkernel']) - obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type, [root_build_dir+'source/creator/buildinfo.c'])] + obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type, ['#source/creator/buildinfo.c'])] return obj @@ -714,23 +761,19 @@ class BlenderEnvironment(SConsEnvironment): global vcp print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC lenv = self.Clone() + lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'): - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) - lenv.Append(LINKFLAGS = ['/FORCE:MULTIPLE']) if lenv['BF_DEBUG']: - lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb']) + lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb','/NODEFAULTLIB:libcmt']) if lenv['OURPLATFORM']=='linux2': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) if lenv['OURPLATFORM']=='sunos5': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) if lenv['CXX'].endswith('CC'): lenv.Replace(LINK = '$CXX') if lenv['OURPLATFORM']=='darwin': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS']) diff --git a/source/creator/SConscript b/source/creator/SConscript index 79e03c8dddc..80428ba7bb6 100644 --- a/source/creator/SConscript +++ b/source/creator/SConscript @@ -1,48 +1,3 @@ #!/usr/bin/python -Import ('env') -import os -sources = 'creator.c' - -incs = '#/intern/guardedalloc ../blender/blenlib ../blender/blenkernel' -incs += ' ../blender/editors/include ../blender/blenloader ../blender/imbuf' -incs += ' ../blender/renderconverter ../blender/render/extern/include ../blender/windowmanager' -incs += ' ../blender/makesdna ../blender/makesrna' -incs += ' ../gameengine/BlenderRoutines #/extern/glew/include ../blender/gpu' -incs += ' ' + env['BF_OPENGL_INC'] - -defs = [] -if env['WITH_BF_QUICKTIME']: - incs += ' ' + env['BF_QUICKTIME_INC'] - defs.append('WITH_QUICKTIME') - -if env['WITH_BF_BINRELOC']: - incs += ' ../../extern/binreloc/include' - defs.append('WITH_BINRELOC') - -if env['WITH_BF_OPENEXR']: - defs.append('WITH_OPENEXR') - -if env['WITH_BF_TIFF']: - defs.append('WITH_TIFF') - -if not env['WITH_BF_SDL']: - defs.append('DISABLE_SDL') - -if env['WITH_BF_PYTHON']: - incs += ' ../blender/python' - defs.append('WITH_PYTHON') - if env['BF_DEBUG']: - defs.append('_DEBUG') - -if env['BF_BUILDINFO']: - defs.append('BUILD_DATE') - defs.append('NAN_BUILDINFO') - -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): - incs += ' ' + env['BF_PTHREADS_INC'] - -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): - incs += ' ' + env['BF_PTHREADS_INC'] - -env.BlenderLib ( libname = 'bf_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 0 ) +# dummy, code has been moved to Blender.creator() From 05b54bec3baec12320e7893543bb685a13f8bce5 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 8 Jun 2011 13:00:25 +0000 Subject: [PATCH 095/105] Apply [#27477] COLLADA export support for textures mapped to COLSPEC Patch provided by Pelle Johnsen --- source/blender/collada/EffectExporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index ff714533199..0bbf714137e 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -273,7 +273,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) std::string uvname = strlen(t->uvname) ? t->uvname : active_uv; // color - if (t->mapto & MAP_COL) { + if (t->mapto & MAP_COL | MAP_COLSPEC) { ep.setDiffuse(createTexture(ima, uvname, sampler)); } // ambient From 17becc751dbb8b6ca48dbc58f906388be2614126 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 8 Jun 2011 15:17:38 +0000 Subject: [PATCH 096/105] Bugfix #27601 Scaling in compostior down to 1 pixel size crashed gaussian blur. --- source/blender/nodes/intern/CMP_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c index 78025f4d964..982aaf9991d 100644 --- a/source/blender/nodes/intern/CMP_util.c +++ b/source/blender/nodes/intern/CMP_util.c @@ -1320,6 +1320,8 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) if ((xy < 1) || (xy > 3)) xy = 3; + if (src->x < 2 && src->y < 2) return; + // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 if (sigma >= 3.556) From 65ec26ab830b3ba44230de4b7b1dc782cccb88fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Jun 2011 16:00:52 +0000 Subject: [PATCH 097/105] fix for own error r35918, generalizing looping over modifier ID links broke loading smoke group references because they already had calls to newlibadr_us() elsewhere, removing those assignments fixes loading. --- source/blender/blenloader/intern/readfile.c | 6 ------ source/blender/modifiers/intern/MOD_smoke.c | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6f0400d5764..3987b082aeb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3843,12 +3843,6 @@ static void lib_link_object(FileData *fd, Main *main) if(smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) { - smd->domain->coll_group = newlibadr_us(fd, ob->id.lib, smd->domain->coll_group); - smd->domain->eff_group = newlibadr_us(fd, ob->id.lib, smd->domain->eff_group); - smd->domain->fluid_group = newlibadr_us(fd, ob->id.lib, smd->domain->fluid_group); - - smd->domain->effector_weights->group = newlibadr(fd, ob->id.lib, smd->domain->effector_weights->group); - smd->domain->flags |= MOD_SMOKE_FILE_LOAD; /* flag for refreshing the simulation after loading */ } } diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index d8e94e92bfa..b6203bb3c1d 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -43,6 +43,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_smoke_types.h" +#include "DNA_object_force.h" #include "BLI_utildefines.h" @@ -156,6 +157,10 @@ static void foreachIDLink(ModifierData *md, Object *ob, walk(userData, ob, (ID **)&smd->domain->coll_group); walk(userData, ob, (ID **)&smd->domain->fluid_group); walk(userData, ob, (ID **)&smd->domain->eff_group); + + if(smd->domain->effector_weights) { + walk(userData, ob, (ID **)&smd->domain->effector_weights->group); + } } } From 43ec34f05483a57fd9d2c1488501f8936e5f2b56 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 8 Jun 2011 16:08:57 +0000 Subject: [PATCH 098/105] Bugfix #27601 Revision for previous fix; fast gaussian now survives on images with a dimension smaller than 3 pixels! Thanks Bastien Montagne for patch. --- source/blender/nodes/intern/CMP_util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c index 982aaf9991d..b73a46c7d7d 100644 --- a/source/blender/nodes/intern/CMP_util.c +++ b/source/blender/nodes/intern/CMP_util.c @@ -1320,7 +1320,11 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) if ((xy < 1) || (xy > 3)) xy = 3; - if (src->x < 2 && src->y < 2) return; + // XXX The YVV macro defined below explicitely expects sources of at least 3x3 pixels, + // so just skiping blur along faulty direction if src's def is below that limit! + if (src->x < 3) xy &= ~(int) 1; + if (src->y < 3) xy &= ~(int) 2; + if (xy < 1) return; // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 From e7e1bc4ca1bb1194f26d965270b76734d2cc91bd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Jun 2011 02:47:22 +0000 Subject: [PATCH 099/105] add foreachIDLink function for cloth, remove cloth specific newlibadr calls in readfile. --- source/blender/blenloader/intern/readfile.c | 10 ---------- source/blender/modifiers/intern/MOD_cloth.c | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3987b082aeb..49579432de2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3847,16 +3847,6 @@ static void lib_link_object(FileData *fd, Main *main) } } - { - ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); - - if(clmd) - { - clmd->sim_parms->effector_weights->group = newlibadr(fd, ob->id.lib, clmd->sim_parms->effector_weights->group); - clmd->coll_parms->group= newlibadr(fd, ob->id.lib, clmd->coll_parms->group); - } - } - /* texture field */ if(ob->pd) lib_link_partdeflect(fd, &ob->id, ob->pd); diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 30ddb3f7b9c..1d2a6b2f788 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -190,6 +190,19 @@ static void freeData(ModifierData *md) } } +static void foreachIDLink(ModifierData *md, Object *ob, + IDWalkFunc walk, void *userData) +{ + ClothModifierData *clmd = (ClothModifierData*) md; + + if(clmd->coll_parms) { + walk(userData, ob, (ID **)&clmd->coll_parms->group); + } + + if(clmd->sim_parms && clmd->sim_parms->effector_weights) { + walk(userData, ob, (ID **)&clmd->sim_parms->effector_weights->group); + } +} ModifierTypeInfo modifierType_Cloth = { /* name */ "Cloth", @@ -215,5 +228,5 @@ ModifierTypeInfo modifierType_Cloth = { /* dependsOnTime */ dependsOnTime, /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL, + /* foreachIDLink */ foreachIDLink, }; From 912db4cdb571d6421cb8c018a0db4fa93984549c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Jun 2011 03:56:32 +0000 Subject: [PATCH 100/105] [#27615] Box select of mesh object disabled or translated due to curve object ED_view3d_init_mats_rv3d was calling glMultMatrixf() which was mostly harmless but could also lead to confusing bugs (2 reported previously). Looked into this and every call to ED_view3d_init_mats_rv3d except for object drawing, doesn't need this so made a second version of ED_view3d_init_mats_rv3d - ED_view3d_init_mats_rv3d_gl which does the matrix multiplication, remove confusing checks in selection code. --- source/blender/editors/include/ED_view3d.h | 1 + .../blender/editors/space_view3d/drawobject.c | 2 +- .../editors/space_view3d/space_view3d.c | 11 +++++-- .../editors/space_view3d/view3d_select.c | 29 ++++++------------- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 0adf6633b05..dfe0a304748 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -265,6 +265,7 @@ struct ARegion *ED_view3d_context_region_unlock(struct bContext *C); int ED_operator_rv3d_unlock_poll(struct bContext *C); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); +void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d); int ED_view3d_scene_layer_set(int lay, const int *values, int *active); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 391eecbbbae..35edd961b1e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5812,7 +5812,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* multiply view with object matrix. * local viewmat and persmat, to calculate projections */ - ED_view3d_init_mats_rv3d(ob, rv3d); + ED_view3d_init_mats_rv3d_gl(ob, rv3d); /* which wire color */ if((flag & DRAW_CONSTCOLOR) == 0) { diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index fb67e38cbf7..6833dec2e43 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -208,13 +208,18 @@ void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d) mul_m4_m4m4(rv3d->viewmatob, ob->obmat, rv3d->viewmat); mul_m4_m4m4(rv3d->persmatob, ob->obmat, rv3d->persmat); + /* initializes object space clipping, speeds up clip tests */ + ED_view3d_local_clipping(rv3d, ob->obmat); +} + +void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d) +{ + ED_view3d_init_mats_rv3d(ob, rv3d); + /* we have to multiply instead of loading viewmatob to make it work with duplis using displists, otherwise it will override the dupli-matrix */ glMultMatrixf(ob->obmat); - - /* initializes object space clipping, speeds up clip tests */ - ED_view3d_local_clipping(rv3d, ob->obmat); } /* ******************** default callbacks for view3d space ***************** */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 6391db7ae5e..9290e1fc631 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -485,11 +485,8 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, if (extend == 0 && select) EM_deselect_all(vc->em); - /* workaround: init mats first, EM_mask_init_backbuf_border can change - view matrix to pixel space, breaking edge select with backbuf. fixes bug [#20936] */ - - /* [#21018] breaks zbuf select. run below. only if bbsel fails */ - /* ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d) */ + /* for non zbuf projections, dont change the GL state */ + ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); glLoadMatrixf(vc->rv3d->viewmat); bbsel= EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -497,15 +494,13 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, if(ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { EM_backbuf_checkAndSelectVerts(vc->em, select); - } else { - ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ + } + else { mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, 1); } } if(ts->selectmode & SCE_SELECT_EDGE) { - /* Does both bbsel and non-bbsel versions (need screen cos for both) */ - ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ - + /* Does both bbsel and non-bbsel versions (need screen cos for both) */ data.pass = 0; mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, 0); @@ -518,8 +513,8 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, if(ts->selectmode & SCE_SELECT_FACE) { if (bbsel) { EM_backbuf_checkAndSelectFaces(vc->em, select); - } else { - ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ + } + else { mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data); } } @@ -1491,12 +1486,8 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten if (extend == 0 && select) EM_deselect_all(vc->em); - /* workaround: init mats first, EM_mask_init_backbuf_border can change - view matrix to pixel space, breaking edge select with backbuf. fixes bug #20936 */ - /*ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);*/ /* for foreach's screen/vert projection */ - - /* [#21018] breaks zbuf select. run below. only if bbsel fails */ - /* ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d) */ + /* for non zbuf projections, dont change the GL state */ + ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); glLoadMatrixf(vc->rv3d->viewmat); bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax); @@ -1505,7 +1496,6 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten if (bbsel) { EM_backbuf_checkAndSelectVerts(vc->em, select); } else { - ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, 1); } } @@ -1525,7 +1515,6 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten if(bbsel) { EM_backbuf_checkAndSelectFaces(vc->em, select); } else { - ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data); } } From 252f7c9af845c22b5f0a39aa3e14e8823dd7ebd2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Jun 2011 04:28:53 +0000 Subject: [PATCH 101/105] fix [#27616] Appending an object from a file brings all existing group links to scene When appending from a blend file which had an object already linked, _but_ was not in any scenes. - the linked object would be instanced. --- source/blender/blenloader/intern/readfile.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 49579432de2..1dc02c4b866 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12742,8 +12742,14 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const /* when appending, make sure any indirectly loaded objects * get a base else they cant be accessed at all [#27437] */ if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) { - if(object_in_any_scene(mainvar, ob)==0) { - do_it= 1; + + /* we may be appending from a scene where we already + * have a linked object which is not in any scene [#27616] */ + if((ob->id.flag & LIB_PRE_EXISTING)==0) { + + if(object_in_any_scene(mainvar, ob)==0) { + do_it= 1; + } } } } From 152b06dc825c9b674b56e469af1028a3f8e58d7f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Jun 2011 07:40:30 +0000 Subject: [PATCH 102/105] use a better method for finding the precision to use for float buttons, about 4x faster to calculate and will show for eg, 0.0108 rather than 0.01, but 0.0100001 still displays as 0.01. --- source/blender/editors/interface/interface.c | 51 +++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a21122698d9..99b4b68b42d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -74,6 +74,9 @@ #define MENU_ITEM_HEIGHT 20 #define MENU_SEP_HEIGHT 6 +#define PRECISION_FLOAT_MAX 7 +#define PRECISION_FLOAT_MAX_POW 10000000 /* pow(10, PRECISION_FLOAT_MAX) */ + /* * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt * @@ -463,27 +466,39 @@ static int ui_but_float_precision(uiBut *but, double value) * _but_, this is only for small values si 10.0001 will not get * the same treatment */ if(value != 0.0 && (value= ABS(value)) < 0.1) { - double prec_d= -(log10(value)); - double prec_d_floor = floor(prec_d + FLT_EPSILON); - int test_prec= (int)prec_d_floor; - - /* this check is so 0.00016 from isnt rounded to 0.0001 */ - if(prec_d - prec_d_floor > FLT_EPSILON) { /* not ending with a .0~001 */ - /* check if a second decimal place is needed 0.00015 for eg. */ - if(double_round(value, test_prec + 1) - double_round(value, test_prec + 2) != 0.0) { - test_prec += 2; + int value_i= (int)((value * PRECISION_FLOAT_MAX_POW) + 0.5); + if(value_i != 0) { + const int prec_span= 3; /* show: 0.01001, 5 would allow 0.0100001 for eg. */ + int test_prec; + int prec_min= -1; + int dec_flag= 0; + int i= PRECISION_FLOAT_MAX; + while(i && value_i) { + if(value_i % 10) { + dec_flag |= 1< prec && test_prec <= 7) { - prec= test_prec; + /* even though its a small value, if the second last digit is not 0, use it */ + test_prec = prec_min; + + dec_flag= (dec_flag >> (prec_min + 1)) & ((1 << prec_span) - 1); + + while(dec_flag) { + test_prec++; + dec_flag = dec_flag >> 1; + } + + if(test_prec > prec) { + prec= test_prec; + } } } - CLAMP(prec, 1, 7); + CLAMP(prec, 1, PRECISION_FLOAT_MAX); return prec; } @@ -1484,8 +1499,8 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va if(scene->unit.scale_length<0.0001f) scene->unit.scale_length= 1.0f; // XXX do_versions /* Sanity checks */ - if(precision>7) precision= 7; - else if(precision==0) precision= 2; + if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX; + else if(precision==0) precision= 2; bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, scene->unit.system, unit_type>>16, do_split, pad); } From 09e96f6b56754f395e7d1383c8e1603fd2fc88a4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Jun 2011 08:58:27 +0000 Subject: [PATCH 103/105] RNA properties - expose values as radians rather then degrees - sequencer wipe angle - mesh autosmooth - bevel modifier angle - edge split angle --- source/blender/makesrna/intern/rna_mesh.c | 23 ++++++++++ source/blender/makesrna/intern/rna_modifier.c | 43 ++++++++++++++++++- .../blender/makesrna/intern/rna_sequencer.c | 25 ++++++++++- 3 files changed, 89 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 2d3c3fe7a3a..479e449958b 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -40,6 +40,9 @@ #include "WM_types.h" +#include "BLI_math_base.h" +#include "BLI_math_rotation.h" + #ifdef RNA_RUNTIME #include "DNA_scene_types.h" @@ -912,6 +915,20 @@ static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value) tf->tpage= (struct Image*)id; } +static void rna_Mesh_auto_smooth_angle_set(PointerRNA *ptr, float value) +{ + Mesh *me= (Mesh*)ptr->id.data; + value= RAD2DEGF(value); + CLAMP(value, 1.0f, 80.0f); + me->smoothresh= (int)value; +} + +static float rna_Mesh_auto_smooth_angle_get(PointerRNA *ptr) +{ + Mesh *me= (Mesh*)ptr->id.data; + return DEG2RADF((float)me->smoothresh); +} + static int rna_MeshFace_verts_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) { MFace *face= (MFace*)ptr->data; @@ -1913,9 +1930,15 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH); RNA_def_property_ui_text(prop, "Auto Smooth", "Treats all set-smoothed faces with angles less than the specified angle as 'smooth' during render"); +#if 1 /* expose as radians */ + prop= RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_funcs(prop, "rna_Mesh_auto_smooth_angle_get", "rna_Mesh_auto_smooth_angle_set", NULL); + RNA_def_property_ui_range(prop, DEG2RAD(1.0), DEG2RAD(80), 1.0, 1); +#else prop= RNA_def_property(srna, "auto_smooth_angle", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "smoothresh"); RNA_def_property_range(prop, 1, 80); +#endif RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); prop= RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 75f3f1ef238..ff277b6d9b0 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -578,6 +578,34 @@ static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value) md->projectors[a]= NULL; } +static float rna_EdgeSplitModifier_split_angle_get(PointerRNA *ptr) +{ + EdgeSplitModifierData *md= (EdgeSplitModifierData*)ptr->data; + return DEG2RADF(md->split_angle); +} + +static void rna_EdgeSplitModifier_split_angle_set(PointerRNA *ptr, float value) +{ + EdgeSplitModifierData *md= (EdgeSplitModifierData*)ptr->data; + value= RAD2DEGF(value); + CLAMP(value, 0.0f, 180.0f); + md->split_angle= (int)value; +} + +static float rna_BevelModifier_angle_limit_get(PointerRNA *ptr) +{ + BevelModifierData *md= (BevelModifierData*)ptr->data; + return DEG2RADF(md->bevel_angle); +} + +static void rna_BevelModifier_angle_limit_set(PointerRNA *ptr, float value) +{ + BevelModifierData *md= (BevelModifierData*)ptr->data; + value= RAD2DEGF(value); + CLAMP(value, 0.0f, 180.0f); + md->bevel_angle= (int)value; +} + #else static void rna_def_property_subdivision_common(StructRNA *srna, const char type[]) @@ -1365,10 +1393,16 @@ static void rna_def_modifier_edgesplit(BlenderRNA *brna) RNA_def_struct_sdna(srna, "EdgeSplitModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT); - // XXX, convert to radians. +#if 1 /* expose as radians */ + prop= RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_funcs(prop, "rna_EdgeSplitModifier_split_angle_get", "rna_EdgeSplitModifier_split_angle_set", NULL); + RNA_def_property_range(prop, 0, DEG2RAD(180)); + RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2); +#else prop= RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0, 180); RNA_def_property_ui_range(prop, 0, 180, 100, 2); +#endif RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -1965,10 +1999,17 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); +#if 1 /* expose as radians */ + prop= RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get", "rna_BevelModifier_angle_limit_set", NULL); + RNA_def_property_range(prop, 0, DEG2RAD(180)); + RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2); +#else prop= RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bevel_angle"); RNA_def_property_range(prop, 0, 180); RNA_def_property_ui_range(prop, 0, 180, 100, 2); +#endif RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 4171189d928..8c4e4d9e736 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -680,6 +680,23 @@ static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value) ed->over_ofs= value; } + +static void rna_WipeSequence_angle_set(PointerRNA *ptr, float value) +{ + Sequence *seq= (Sequence *)(ptr->data); + value= RAD2DEGF(value); + CLAMP(value, -90.0f, 90.0f); + ((WipeVars *)seq->effectdata)->angle= value; +} + +static float rna_WipeSequence_angle_get(PointerRNA *ptr) +{ + Sequence *seq= (Sequence *)(ptr->data); + + return DEG2RADF(((WipeVars *)seq->effectdata)->angle); +} + + #else static void rna_def_strip_element(BlenderRNA *brna) @@ -1460,10 +1477,16 @@ static void rna_def_wipe(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Blur Width", "Width of the blur edge, in percentage relative to the image size"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - + +#if 1 /* expose as radians */ + prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL); + RNA_def_property_range(prop, DEG2RAD(-90.0f), DEG2RAD(90.0f)); +#else prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "angle"); RNA_def_property_range(prop, -90.0f, 90.0f); +#endif RNA_def_property_ui_text(prop, "Angle", "Edge angle"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); From 75dcc2a7dd1b4108cc724d1fd39761c4685d5186 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 9 Jun 2011 11:09:46 +0000 Subject: [PATCH 104/105] Fix [#27378] ASC-CDL Color Balance Node does not allow for full range of values Report title is incorrect, it does allow for the full range, but actually allows too much, so clamping slope and power min at 0. --- source/blender/makesrna/intern/rna_nodetree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index d0b60c7f153..7fd6a9dacfe 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2221,6 +2221,7 @@ static void def_cmp_colorbalance(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "gamma"); RNA_def_property_array(prop, 3); RNA_def_property_float_array_default(prop, default_1); + RNA_def_property_range(prop, 0.f, FLT_MAX); RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); RNA_def_property_ui_text(prop, "Power", "Correction for Midtones"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); @@ -2229,6 +2230,7 @@ static void def_cmp_colorbalance(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "gain"); RNA_def_property_array(prop, 3); RNA_def_property_float_array_default(prop, default_1); + RNA_def_property_range(prop, 0.f, FLT_MAX); RNA_def_property_ui_range(prop, 0, 2, 0.1, 3); RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); From 21f5a87999bbc3f022a62812ae1ec1a30fa98135 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Jun 2011 11:19:34 +0000 Subject: [PATCH 105/105] fix for memory leak re-binding meshes. --- source/blender/editors/object/object_modifier.c | 10 ++++++++-- source/blender/modifiers/intern/MOD_meshdeform.c | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 5996037cd2d..32844e6af5d 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1259,16 +1259,22 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if(mmd->bindcagecos) { - if(mmd->bindweights) MEM_freeN(mmd->bindweights); if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos); if(mmd->dyngrid) MEM_freeN(mmd->dyngrid); if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences); + if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences); + if(mmd->bindoffsets) MEM_freeN(mmd->bindoffsets); if(mmd->dynverts) MEM_freeN(mmd->dynverts); - mmd->bindweights= NULL; + if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */ + if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */ + mmd->bindcagecos= NULL; mmd->dyngrid= NULL; mmd->dyninfluences= NULL; + mmd->bindoffsets= NULL; mmd->dynverts= NULL; + mmd->bindweights= NULL; /* deprecated */ + mmd->bindcos= NULL; /* deprecated */ mmd->totvert= 0; mmd->totcagevert= 0; mmd->totinfluence= 0; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index ba73f3fa0d1..5021f3a6d2e 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -72,6 +72,8 @@ static void freeData(ModifierData *md) if(mmd->dyngrid) MEM_freeN(mmd->dyngrid); if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences); if(mmd->dynverts) MEM_freeN(mmd->dynverts); + if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */ + if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */ } static void copyData(ModifierData *md, ModifierData *target)