diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-11 01:15:11 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-11 01:15:11 +0400 |
commit | d546002476a849524ba938c53a5d9e9a81c50ded (patch) | |
tree | 37a5b2b8eec0832779cfd9bc172e0ac29d3098e6 /source | |
parent | 28cc31ba11f805c4cac2a250b4181ec9c556b8da (diff) | |
parent | 9cabc57a62e8db17edd09839d7ae200239fb3618 (diff) |
Merged changes in the trunk up to revision 40911.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source')
401 files changed, 5802 insertions, 4124 deletions
diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c index 7050aec9bf6..c7d47b9da0d 100644 --- a/source/blender/avi/intern/avirgb.c +++ b/source/blender/avi/intern/avirgb.c @@ -44,7 +44,8 @@ /* implementation */ -void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ int x, y,i, rowstride; unsigned char *buf; AviBitmapInfoHeader *bi; @@ -116,7 +117,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu } } -void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ int y, x, i, rowstride; unsigned char *buf; diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index 96c62843436..8993c1ef96a 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -46,6 +46,7 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { int i; + int useconds; (void)stream; /* unused */ @@ -100,8 +101,9 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, break; case AVI_OPTION_FRAMERATE: - if (1000000/(*((double *) opt_data))) - movie->header->MicroSecPerFrame = 1000000/(*((double *) opt_data)); + useconds = (int)(1000000/(*((double *) opt_data))); + if (useconds) + movie->header->MicroSecPerFrame = useconds; for (i=0; i < movie->header->Streams; i++) { if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) { diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index 4377d391354..1c36f3e1504 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -37,7 +37,7 @@ /* blf_translation.c */ -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL unsigned char *BLF_get_unifont(int *unifont_size); void BLF_free_unifont(void); #endif diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index b87a3b88f07..49323ec658f 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -53,9 +53,9 @@ set(SRC if(WITH_INTERNATIONAL) list(APPEND INC_SYS - ${GETTEXT_INC} + ${GETTEXT_INCLUDE_DIRS} ) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 45a55793856..1a86d0ad671 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -15,6 +15,6 @@ if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': defs.append('_WIN32') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_blenfont', sources, Split(incs), Split(defs), libtype=['core','player'], priority=[210,210] ) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index b0b06bf059b..0a102884969 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -36,7 +36,7 @@ #include "BLF_api.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include <locale.h> @@ -158,7 +158,7 @@ void BLF_lang_set(const char *str) char *s; /* store defaul locale */ - strncpy(default_locale, env_language, sizeof(default_locale)); + BLI_strncpy(default_locale, env_language, sizeof(default_locale)); /* use first language as default */ s= strchr(default_locale, ':'); @@ -209,7 +209,7 @@ void BLF_lang_encoding(const char *str) /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */ } -#else /* ! INTERNATIONAL */ +#else /* ! WITH_INTERNATIONAL */ void BLF_lang_init(void) { @@ -228,4 +228,4 @@ void BLF_lang_set(const char *str) return; } -#endif /* INTERNATIONAL */ +#endif /* WITH_INTERNATIONAL */ diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index b53f4cf7609..8c0a26df4c2 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -32,7 +32,7 @@ #include <stdlib.h> -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include <libintl.h> #endif @@ -45,7 +45,7 @@ #include "BLF_translation.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL const char unifont_filename[]="droidsans.ttf.gz"; static unsigned char *unifont_ttf= NULL; static int unifont_size= 0; @@ -76,7 +76,7 @@ void BLF_free_unifont(void) const char* BLF_gettext(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if( msgid[0] ) return gettext( msgid ); return ""; diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 67efb7752ea..7d3de68c005 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 44aebdf6205..da389c6f1d0 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 98f9ee14c7e..bf619d76e68 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 8836999bc9b..a0660490baf 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index a09e475c9a3..f6910fede8e 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -44,7 +44,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 259 -#define BLENDER_SUBVERSION 3 +#define BLENDER_SUBVERSION 4 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 @@ -53,7 +53,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE beta +#define BLENDER_VERSION_CYCLE rc struct ListBase; struct MemFile; diff --git a/source/blender/blenkernel/BKE_bullet.h b/source/blender/blenkernel/BKE_bullet.h index 76358c4485b..2756ded3a08 100644 --- a/source/blender/blenkernel/BKE_bullet.h +++ b/source/blender/blenkernel/BKE_bullet.h @@ -1,5 +1,4 @@ /* - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index 1edec2b69d9..07158f5f3fa 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -1,31 +1,31 @@ /* -* $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. -* -* The Original Code is Copyright (C) 2006 Blender Foundation. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): Ben Batt <benbatt@gmail.com> -* -* ***** END GPL LICENSE BLOCK ***** -*/ + * $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. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Ben Batt <benbatt@gmail.com> + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file BKE_cdderivedmesh.h * \ingroup bke diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index c30100ea55a..4eb8e5a8d96 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -1,31 +1,31 @@ /* -* $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. -* -* The Original Code is Copyright (C) 2006 Blender Foundation. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): Ben Batt <benbatt@gmail.com> -* -* ***** END GPL LICENSE BLOCK ***** -*/ + * $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. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Ben Batt <benbatt@gmail.com> + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file BKE_customdata.h * \ingroup bke diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index b00db53a199..1eed0aaca00 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -1,5 +1,5 @@ /* - $Id$ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 244fda33a52..08798a6ddf0 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -231,7 +231,7 @@ short fcurve_is_keyframable(struct FCurve *fcu); /* -------- Curve Sanity -------- */ void calchandles_fcurve(struct FCurve *fcu); -void testhandles_fcurve(struct FCurve *fcu); +void testhandles_fcurve(struct FCurve *fcu, const short use_handle); void sort_time_fcurve(struct FCurve *fcu); short test_time_fcurve(struct FCurve *fcu); diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index 2195b370a5f..e4e8805164a 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -46,6 +46,7 @@ struct Curve; struct objfnt; struct TmpFont; struct CharInfo; +struct Main; struct chartrans { float xof, yof; @@ -77,10 +78,10 @@ void BKE_font_register_builtin(void *mem, int size); void free_vfont(struct VFont *sc); void free_ttfont(void); struct VFont *get_builtin_font(void); -struct VFont *load_vfont(const char *name); +struct VFont *load_vfont(struct Main *bmain, const char *name); struct TmpFont *vfont_find_tmpfont(struct VFont *vfont); -struct chartrans *BKE_text_to_curve(struct Scene *scene, struct Object *ob, int mode); +struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode); int BKE_font_getselection(struct Object *ob, int *start, int *end); diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index 3c12a5d615d..9f7d4aeb0d3 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -1,32 +1,31 @@ /* -* $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. -* -* The Original Code is Copyright (C) 2006-2007 Blender Foundation. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): none yet. -* -* ***** END GPL LICENSE BLOCK ***** -* -*/ + * $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. + * + * The Original Code is Copyright (C) 2006-2007 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ #ifndef BKE_ICONS_H #define BKE_ICONS_H diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index cb6a0b9ab37..0e0348e78e9 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -71,6 +71,7 @@ short *give_totcolp_id(struct ID *id); struct Material *give_current_material(struct Object *ob, short act); struct ID *material_from(struct Object *ob, short act); +void assign_material_id(struct ID *id, struct Material *ma, short act); void assign_material(struct Object *ob, struct Material *ma, short act); void assign_matarar(struct Object *ob, struct Material ***matar, short totcol); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 95490b1aff6..347263bb290 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -1,6 +1,4 @@ /* - * blenlib/BKE_mesh.h (mar-2001 nzc) - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -24,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): (mar-2001 nzc) * * ***** END GPL LICENSE BLOCK ***** */ @@ -161,6 +159,8 @@ int BKE_mesh_validate_dm(struct DerivedMesh *dm); void BKE_mesh_calc_edges(struct Mesh *mesh, int update); +void BKE_mesh_ensure_navmesh(struct Mesh *me); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_navmesh_conversion.h b/source/blender/blenkernel/BKE_navmesh_conversion.h index 01d32321c81..1880e1e6728 100644 --- a/source/blender/blenkernel/BKE_navmesh_conversion.h +++ b/source/blender/blenkernel/BKE_navmesh_conversion.h @@ -1,31 +1,31 @@ -/** -* $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. -* -* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): none yet. -* -* ***** END GPL LICENSE BLOCK ***** -*/ +/* + * $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. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ #ifndef BKE_NAVMESH_CONVERSION_H #define BKE_NAVMESH_CONVERSION_H diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 773c5ced1cb..49c1f8acd24 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 7e39461a032..b1943fdf97c 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -146,6 +146,11 @@ void object_camera_matrix( float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens, float *ycor, float *viewdx, float *viewdy); +void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3], + float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]); + +void camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]); + void object_relink(struct Object *ob); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index 541c581e762..556ff26e621 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -45,7 +45,7 @@ struct ReportList; struct VFont; /* pack */ -struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename); +struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename, const char *relabase); struct PackedFile *newPackedFileMemory(void *mem, int memlen); void packAll(struct Main *bmain, struct ReportList *reports); diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 2578a90808a..f8463bab55f 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 5b565223ece..c417b1efe4f 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -80,6 +80,10 @@ typedef struct ParticleSimulationData { struct ParticleSystem *psys; struct ParticleSystemModifierData *psmd; struct ListBase *colliders; + /* Courant number. This is used to implement an adaptive time step. Only the + maximum value per time step is important. Only sph_integrate makes use of + this at the moment. Other solvers could, too. */ + float courant_num; } ParticleSimulationData; typedef struct ParticleTexture{ diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 346368a5958..fcfa6ccf9f4 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -1,30 +1,31 @@ /* -* -* ***** 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. -* -* The Original Code is Copyright (C) 2006 Blender Foundation. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): Campbell Barton <ideasman42@gmail.com> -* -* ***** END GPL LICENSE BLOCK ***** -*/ + * $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. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Campbell Barton <ideasman42@gmail.com> + * + * ***** END GPL LICENSE BLOCK ***** + */ #ifndef BKE_POINTCACHE_H #define BKE_POINTCACHE_H diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h index d1fef8b0ce1..9deb71a3474 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.h +++ b/source/blender/blenkernel/BKE_shrinkwrap.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h index a400c1e27b9..30142c12601 100644 --- a/source/blender/blenkernel/BKE_subsurf.h +++ b/source/blender/blenkernel/BKE_subsurf.h @@ -1,4 +1,5 @@ -/* $Id$ +/* + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/BKE_suggestions.h b/source/blender/blenkernel/BKE_suggestions.h index e215cabd70f..c684271cbbf 100644 --- a/source/blender/blenkernel/BKE_suggestions.h +++ b/source/blender/blenkernel/BKE_suggestions.h @@ -1,4 +1,4 @@ -/* +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h index 0a3e56c8cba..269941597b0 100644 --- a/source/blender/blenkernel/BKE_unit.h +++ b/source/blender/blenkernel/BKE_unit.h @@ -1,4 +1,5 @@ /* + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h index 2b10f1b246c..8345f0f5d2e 100644 --- a/source/blender/blenkernel/BKE_writeffmpeg.h +++ b/source/blender/blenkernel/BKE_writeffmpeg.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_writeframeserver.h b/source/blender/blenkernel/BKE_writeframeserver.h index 2117a23b938..8b2022076bb 100644 --- a/source/blender/blenkernel/BKE_writeframeserver.h +++ b/source/blender/blenkernel/BKE_writeframeserver.h @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 68a47371354..a2747f49264 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -356,16 +356,19 @@ endif() if(WITH_GAMEENGINE) list(APPEND INC_SYS - ../../../extern/recastnavigation + ../../../extern/recastnavigation ) list(APPEND SRC intern/navmesh_conversion.c BKE_navmesh_conversion.h ) -endif() -if(MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") + add_definitions(-DWITH_GAMEENGINE) endif() +## Warnings as errors, this is too strict! +#if(MSVC) +# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") +#endif() + blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index 2aff2b78b72..4016cf00ae4 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -354,7 +354,7 @@ void BME_bmesh_to_editmesh(BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em) { BME_TransData *vtd; - EditVert *eve1, *eve2, *eve3, *eve4, **evlist; + EditVert *eve1, /* *eve2, *eve3, *eve4, */ /* UNUSED */ **evlist; EditEdge *eed; EditFace *efa; @@ -412,14 +412,14 @@ void BME_bmesh_to_editmesh(BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em) { len = BME_cycle_length(f->loopbase); if (len==3 || len==4) { eve1= evlist[f->loopbase->v->tflag1]; - eve2= evlist[f->loopbase->next->v->tflag1]; - eve3= evlist[f->loopbase->next->next->v->tflag1]; - if (len == 4) { + /* eve2= evlist[f->loopbase->next->v->tflag1]; */ /* UNUSED */ + /* eve3= evlist[f->loopbase->next->next->v->tflag1]; */ /* UNUSED */ + /* if (len == 4) { eve4= evlist[f->loopbase->prev->v->tflag1]; } else { eve4= NULL; - } + } */ /* UNUSED */ efa = NULL; //XXX addfacelist(eve1, eve2, eve3, eve4, NULL, NULL); efa->mat_nr = (unsigned char)f->mat_nr; @@ -541,7 +541,7 @@ DerivedMesh *BME_bmesh_to_derivedmesh(BME_Mesh *bm, DerivedMesh *dm) MEdge *medge, *me; MVert *mvert, *mv; int *origindex; - int totface,totedge,totvert,i,bmeshok,len, numTex, numCol; + int totface, totedge, totvert, i, /* bmeshok, */ /* UNUSED */ len, numTex, numCol; BME_Vert *v1=NULL; BME_Edge *e=NULL, *oe=NULL; @@ -569,7 +569,7 @@ DerivedMesh *BME_bmesh_to_derivedmesh(BME_Mesh *bm, DerivedMesh *dm) /*count quads and tris*/ totface = 0; - bmeshok = 1; + /* bmeshok = 1; */ /* UNUSED */ for(f=bm->polys.first;f;f=f->next){ len = BME_cycle_length(f->loopbase); if(len == 3 || len == 4) totface++; diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c index 1b6c499a9fa..bd5241adb6b 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -503,16 +503,16 @@ void BME_disk_remove_edge(BME_Edge *e, BME_Vert *v) BME_Edge *BME_disk_next_edgeflag(BME_Edge *e, BME_Vert *v, int eflag, int tflag){ - BME_CycleNode *diskbase; + /* BME_CycleNode *diskbase; */ /* UNUSED */ BME_Edge *curedge; - int len, ok; + int /* len, */ /* UNUSED */ ok; if(eflag && tflag) return NULL; ok = BME_vert_in_edge(e,v); if(ok){ - diskbase = BME_disk_getpointer(e, v); - len = BME_cycle_length(diskbase); + /* diskbase = BME_disk_getpointer(e, v); */ /* UNUSED */ + /* len = BME_cycle_length(diskbase); */ /* UNUSED */ curedge = BME_disk_nextedge(e,v); while(curedge != e){ if(tflag){ diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index 99b6e7f9095..a95d149f058 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -393,19 +393,19 @@ static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int * and transform properties, and set the max limits. * Finally, return the split vert. */ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, BME_Loop *l, float *up_vec, float value, BME_TransData_Head *td) { - BME_TransData *vtd, *vtd1, *vtd2; - BME_Vert *sv, *v2, *v3, *ov; + BME_TransData *vtd, *vtd1 /* , *vtd2 */ /* UNUSED */; + BME_Vert *sv, *v2, *v3 /* , *ov */ /* UNUSED */; BME_Loop *lv1, *lv2; BME_Edge *ne, *e1, *e2; float maxfactor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3]; - int is_edge, forward, is_split_vert; + int is_edge, forward /* , is_split_vert */ /* UNUSED */; if (l == NULL) { /* what you call operator overloading in C :) * I wanted to use the same function for both wire edges and poly loops * so... here we walk around edges to find the needed verts */ forward = 1; - is_split_vert = 0; + /* is_split_vert = 0; */ /* UNUSED */ if (v->edge == NULL) { //printf("We can't split a loose vert's edge!\n"); return NULL; @@ -428,7 +428,7 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B else { e1 = e2; } - ov = BME_edge_getothervert(e1,v); + /* ov = BME_edge_getothervert(e1,v); */ /* UNUSED */ sv = BME_split_edge(bm,v,e1,&ne,0); //BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/ //BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25); @@ -464,14 +464,14 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B } if (BME_bevel_is_split_vert(lv1)) { - is_split_vert = 1; + /* is_split_vert = 1; */ /* UNUSED */ sv = v1; if (forward) v1 = l->next->next->v; else v1 = l->prev->v; } else { - is_split_vert = 0; - ov = BME_edge_getothervert(l->e,v); + /* is_split_vert = 0; */ /* UNUSED */ + /* ov = BME_edge_getothervert(l->e,v); */ /* UNUSED */ sv = BME_split_edge(bm,v,l->e,&ne,0); //BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/ //BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25); @@ -494,7 +494,7 @@ static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, B vtd = BME_get_transdata(td, sv); vtd1 = BME_get_transdata(td, v); - vtd2 = BME_get_transdata(td,v1); + /* vtd2 = BME_get_transdata(td,v1); */ /* UNUSED */ if (vtd1->loc == NULL) { /* this is a vert with data only for calculating initial weights */ @@ -717,7 +717,7 @@ static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int UNUS static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) { BME_Vert *v1, *v2; - BME_Poly *f; + /* BME_Poly *f; */ /* UNUSED */ /* get/make the first vert to be used in SFME */ /* may need to split the previous edge */ @@ -730,7 +730,7 @@ static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUS l = l->next->next; /* "cut off" this corner */ - f = BME_split_face(bm,l->f,v2,v1,NULL,l->e); + /* f = */ /* UNUSED */ BME_split_face(bm,l->f,v2,v1,NULL,l->e); return l; } @@ -929,16 +929,16 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg BME_Vert *v; BME_Edge *e; BME_Poly *f; - BME_TransData *vtd; - MDeformVert *dvert; - MDeformWeight *dw; + /* BME_TransData *vtd; */ /* UNUSED */ + /* MDeformVert *dvert; */ /* UNUSED */ + /* MDeformWeight *dw; */ /* UNUSED */ int len; float weight, threshold; /* vert pass */ for (v=bm->verts.first; v; v=v->next) { - dvert = NULL; - dw = NULL; + /* dvert = NULL; */ /* UNUSED */ + /* dw = NULL; */ /* UNUSED */ v->tflag1 = BME_BEVEL_ORIG; /* originally coded, a vertex gets tagged with BME_BEVEL_BEVEL in this pass if * the vert is manifold (or is shared by only two edges - wire bevel) @@ -962,7 +962,7 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg else { len = BME_cycle_length(BME_disk_getpointer(v->edge,v)); /* we'll assign a default transform data to every vert (except the loose ones) */ - vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); + /* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); } /* check for non-manifold vert */ @@ -990,11 +990,11 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg //~ } //~ if (!dw || dw->weight == 0.0) continue; if (v->bweight == 0.0) continue; - vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, v->bweight, -1, NULL); + /* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, v->bweight, -1, NULL); v->tflag1 |= BME_BEVEL_BEVEL; } else { - vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, 1.0, -1, NULL); + /* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, 1.0, -1, NULL); v->tflag1 |= BME_BEVEL_BEVEL; } } diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index a311ca15e5e..bf9acb224d5 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -1,7 +1,8 @@ +/* $Id$ */ + /** \file blender/blenkernel/intern/CCGSubSurf.c * \ingroup bke */ -/* $Id$ */ #include <stdlib.h> #include <string.h> diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h index 363d1e01f98..1835e63727d 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.h +++ b/source/blender/blenkernel/intern/CCGSubSurf.h @@ -1,7 +1,8 @@ +/* $Id$ */ + /** \file blender/blenkernel/intern/CCGSubSurf.h * \ingroup bke */ -/* $Id$ */ typedef void* CCGMeshHDL; typedef void* CCGVertHDL; diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index e3440e183e3..c52bcbadf35 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -62,6 +62,10 @@ #include "BKE_multires.h" #include "BKE_armature.h" +#ifdef WITH_GAMEENGINE +#include "BKE_navmesh_conversion.h" +#endif + #include "BLO_sys_types.h" // for intptr_t support #include "GL/glew.h" @@ -73,6 +77,8 @@ extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */ +static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm); + /////////////////////////////////// /////////////////////////////////// @@ -691,9 +697,11 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us else { const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT; if (shade_type != shade_prev) { - glShadeModel((shade_prev= shade_type)); + if(poly_prev != GL_ZERO) glEnd(); + glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */ + glBegin((poly_prev= poly_type)); } - if(poly_type != poly_prev) { + else if(poly_type != poly_prev) { if(poly_prev != GL_ZERO) glEnd(); glBegin((poly_prev= poly_type)); } @@ -756,9 +764,11 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us else { const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT; if (shade_type != shade_prev) { - glShadeModel((shade_prev= shade_type)); + if(poly_prev != GL_ZERO) glEnd(); + glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */ + glBegin((poly_prev= poly_type)); } - if(poly_type != poly_prev) { + else if(poly_type != poly_prev) { if(poly_prev != GL_ZERO) glEnd(); glBegin((poly_prev= poly_type)); } @@ -2107,6 +2117,18 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos add_orco_dm(ob, NULL, *deform_r, NULL, CD_ORCO); } +#ifdef WITH_GAMEENGINE + /* NavMesh - this is a hack but saves having a NavMesh modifier */ + if ((ob->gameflag & OB_NAVMESH) && (finaldm->type == DM_TYPE_CDDM)) { + DerivedMesh *tdm; + tdm= navmesh_dm_createNavMeshForVisualization(finaldm); + if (finaldm != tdm) { + finaldm->release(finaldm); + finaldm= tdm; + } + } +#endif /* WITH_GAMEENGINE */ + *final_r = finaldm; if(orcodm) @@ -2941,3 +2963,170 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm) boundbox_set_from_min_max(ob->bb, min, max); } + +/* --- NAVMESH (begin) --- */ +#ifdef WITH_GAMEENGINE + +BM_INLINE int navmesh_bit(int a, int b) +{ + return (a & (1 << b)) >> b; +} + +BM_INLINE void navmesh_intToCol(int i, float col[3]) +{ + int r = navmesh_bit(i, 0) + navmesh_bit(i, 3) * 2 + 1; + int g = navmesh_bit(i, 1) + navmesh_bit(i, 4) * 2 + 1; + int b = navmesh_bit(i, 2) + navmesh_bit(i, 5) * 2 + 1; + col[0] = 1 - r*63.0f/255.0f; + col[1] = 1 - g*63.0f/255.0f; + col[2] = 1 - b*63.0f/255.0f; +} + +static void navmesh_drawColored(DerivedMesh *dm) +{ + int a, glmode; + MVert *mvert = (MVert *)CustomData_get_layer(&dm->vertData, CD_MVERT); + MFace *mface = (MFace *)CustomData_get_layer(&dm->faceData, CD_MFACE); + int *polygonIdx = (int *)CustomData_get_layer(&dm->faceData, CD_RECAST); + float col[3]; + + if (!polygonIdx) + return; + + /* + //UI_ThemeColor(TH_WIRE); + glDisable(GL_LIGHTING); + glLineWidth(2.0); + dm->drawEdges(dm, 0, 1); + glLineWidth(1.0); + glEnable(GL_LIGHTING);*/ + + glDisable(GL_LIGHTING); + /* if(GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */ + DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" ); + //glShadeModel(GL_SMOOTH); + glBegin(glmode = GL_QUADS); + for(a = 0; a < dm->numFaceData; a++, mface++) { + int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES; + int pi = polygonIdx[a]; + if (pi <= 0) { + zero_v3(col); + } + else { + navmesh_intToCol(pi, col); + } + + if(new_glmode != glmode) { + glEnd(); + glBegin(glmode = new_glmode); + } + glColor3fv(col); + glVertex3fv(mvert[mface->v1].co); + glVertex3fv(mvert[mface->v2].co); + glVertex3fv(mvert[mface->v3].co); + if(mface->v4) { + glVertex3fv(mvert[mface->v4].co); + } + } + glEnd(); + } + glEnable(GL_LIGHTING); +} + +static void navmesh_DM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) +{ + (void) setDrawOptions; + + navmesh_drawColored(dm); +} + +static void navmesh_DM_drawFacesSolid(DerivedMesh *dm, + float (*partial_redraw_planes)[4], + int UNUSED(fast), int (*setMaterial)(int, void *attribs)) +{ + (void) partial_redraw_planes; + (void) setMaterial; + + //drawFacesSolid_original(dm, partial_redraw_planes, fast, setMaterial); + navmesh_drawColored(dm); +} + +static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm) +{ + DerivedMesh *result; + int maxFaces = dm->getNumFaces(dm); + int *recastData; + int vertsPerPoly=0, nverts=0, ndtris=0, npolys=0; + float* verts=NULL; + unsigned short *dtris=NULL, *dmeshes=NULL, *polys=NULL; + int *dtrisToPolysMap=NULL, *dtrisToTrisMap=NULL, *trisToFacesMap=NULL; + int res; + + result = CDDM_copy(dm); + if (!CustomData_has_layer(&result->faceData, CD_RECAST)) { + int *sourceRecastData = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST); + if (sourceRecastData) { + CustomData_add_layer_named(&result->faceData, CD_RECAST, CD_DUPLICATE, + sourceRecastData, maxFaces, "recastData"); + } + } + recastData = (int*)CustomData_get_layer(&result->faceData, CD_RECAST); + + /* note: This is not good design! - really should not be doing this */ + result->drawFacesTex = navmesh_DM_drawFacesTex; + result->drawFacesSolid = navmesh_DM_drawFacesSolid; + + + /* process mesh */ + res = buildNavMeshDataByDerivedMesh(dm, &vertsPerPoly, &nverts, &verts, &ndtris, &dtris, + &npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap, + &trisToFacesMap); + if (res) { + size_t polyIdx; + + /* invalidate concave polygon */ + for (polyIdx=0; polyIdx<(size_t)npolys; polyIdx++) { + unsigned short* poly = &polys[polyIdx*2*vertsPerPoly]; + if (!polyIsConvex(poly, vertsPerPoly, verts)) { + /* set negative polygon idx to all faces */ + unsigned short *dmesh = &dmeshes[4*polyIdx]; + unsigned short tbase = dmesh[2]; + unsigned short tnum = dmesh[3]; + unsigned short ti; + + for (ti=0; ti<tnum; ti++) { + unsigned short triidx = dtrisToTrisMap[tbase+ti]; + unsigned short faceidx = trisToFacesMap[triidx]; + if (recastData[faceidx] > 0) { + recastData[faceidx] = -recastData[faceidx]; + } + } + } + } + } + else { + printf("Error during creation polygon infos\n"); + } + + /* clean up */ + if (verts!=NULL) + MEM_freeN(verts); + if (dtris!=NULL) + MEM_freeN(dtris); + if (dmeshes!=NULL) + MEM_freeN(dmeshes); + if (polys!=NULL) + MEM_freeN(polys); + if (dtrisToPolysMap!=NULL) + MEM_freeN(dtrisToPolysMap); + if (dtrisToTrisMap!=NULL) + MEM_freeN(dtrisToTrisMap); + if (trisToFacesMap!=NULL) + MEM_freeN(trisToFacesMap); + + return result; +} + +#endif /* WITH_GAMEENGINE */ + +/* --- NAVMESH (end) --- */ diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 73ddcbecf94..8b9f5ac98d3 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -270,7 +272,7 @@ bActionGroup *action_groups_add_new (bAction *act, const char name[]) /* make it selected, with default name */ agrp->flag = AGRP_SELECTED; - strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name)); + BLI_strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name)); /* add to action, and validate */ BLI_addtail(&act->groups, agrp); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 824bbb8f70d..cd2c272a1c2 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1,4 +1,6 @@ -/* +/* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -1514,7 +1516,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i /* in par the family name is stored, use this to find the other objects */ - chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI); + chartransdata= BKE_text_to_curve(G.main, scene, par, FO_DUPLI); if(chartransdata==NULL) return; cu= par->data; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 44c61fa6dcf..8ed255e688c 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -1167,6 +1169,8 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i return 0; } + /* RNA property update disabled for now - [#28525] [#28690] [#28774] [#28777] */ +#if 0 /* buffer property update for later flushing */ if (RNA_property_update_check(prop)) { short skip_updates_hack = 0; @@ -1183,6 +1187,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i if (skip_updates_hack == 0) RNA_property_update_cache_add(&new_ptr, prop); } +#endif } /* successful */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 1149d8eee25..fbbce58414e 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 27ea1585e4b..5358a26e660 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -1,7 +1,4 @@ -/* blender.c jan 94 MIXED MODEL - * - * common help functions and data - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -518,7 +515,7 @@ void BKE_write_undo(bContext *C, const char *name) /* make new */ curundo= uel= MEM_callocN(sizeof(UndoElem), "undo file"); - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); BLI_addtail(&undobase, uel); /* and limit amount to the maximum */ diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index 6b1f313d88d..d73d7509644 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -1,8 +1,4 @@ /* - * bmfont.c - * - * 04-10-2000 frank - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -26,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): 04-10-2000 frank. * * ***** END GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 3966caa1fa9..2a478d4ffe2 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -1,6 +1,4 @@ -/* boids.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -908,7 +906,8 @@ static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, else return 0; } -static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa) { +static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa) +{ BoidState *state = boids->states.first; BoidParticle *bpa = pa->boid; diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c index 72f5e907800..e4a02434cba 100644 --- a/source/blender/blenkernel/intern/bullet.c +++ b/source/blender/blenkernel/intern/bullet.c @@ -1,5 +1,4 @@ -/* - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index c3aeb440938..2ce6b92922d 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -1,5 +1,4 @@ /* - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index bf462868271..0022710e580 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1,41 +1,41 @@ /* -* $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. -* -* The Original Code is Copyright (C) 2006 Blender Foundation. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): Ben Batt <benbatt@gmail.com> -* -* ***** END GPL LICENSE BLOCK ***** -* -* Implementation of CDDerivedMesh. -* -* BKE_cdderivedmesh.h contains the function prototypes for this file. -* -*/ + * $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. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Ben Batt <benbatt@gmail.com> + * + * ***** END GPL LICENSE BLOCK ***** + * + * Implementation of CDDerivedMesh. + * + * BKE_cdderivedmesh.h contains the function prototypes for this file. + * + */ /** \file blender/blenkernel/intern/cdderivedmesh.c * \ingroup bke */ - + #include "GL/glew.h" #include "BLI_blenlib.h" @@ -756,9 +756,10 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, unsigned char *colors = MEM_mallocN(dm->getNumFaces(dm)*4*3*sizeof(unsigned char), "cdDM_drawFacesTex_common"); for( i=0; i < dm->getNumFaces(dm); i++ ) { for( j=0; j < 4; j++ ) { - colors[i*12+j*3] = col[i*4+j].r; + /* bgr -> rgb is intentional (and stupid), but how its stored internally */ + colors[i*12+j*3] = col[i*4+j].b; colors[i*12+j*3+1] = col[i*4+j].g; - colors[i*12+j*3+2] = col[i*4+j].b; + colors[i*12+j*3+2] = col[i*4+j].r; } } GPU_color3_upload(dm,colors); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 3a86389dba7..1ec573c853a 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -741,7 +741,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ) MDeformVert *dvert = NULL; Cloth *clothObj = NULL; int numverts; - float goalfac = 0; + /* float goalfac = 0; */ /* UNUSED */ ClothVertex *verts = NULL; if (!clmd || !dm) return; @@ -764,7 +764,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ) if (( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_mass-1)) && (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )) { verts->goal = dvert->dw [j].weight; - goalfac= 1.0f; + /* goalfac= 1.0f; */ /* UNUSED */ /* // Kicking goal factor to simplify things...who uses that anyway? diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index d8b51973948..26ee62e035b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1374,7 +1374,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree return collpair; } -static void machine_epsilon_offset(Cloth *cloth) { +static void machine_epsilon_offset(Cloth *cloth) +{ ClothVertex *cv; int i, j; @@ -2363,7 +2364,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl { Cloth *cloth= clmd->clothObject; BVHTree *cloth_bvh= cloth->bvhtree; - unsigned int i=0, numfaces = 0, numverts = 0, k, l, j; + unsigned int i=0, /* numfaces = 0, */ /* UNUSED */ numverts = 0, k, l, j; int rounds = 0; // result counts applied collisions; ic is for debug output; ClothVertex *verts = NULL; int ret = 0, ret2 = 0; @@ -2374,7 +2375,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl return 0; verts = cloth->verts; - numfaces = cloth->numfaces; + /* numfaces = cloth->numfaces; */ /* UNUSED */ numverts = cloth->numverts; //////////////////////////////////////////////////////////// @@ -2476,7 +2477,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl // collisions = 1; verts = cloth->verts; // needed for openMP - numfaces = cloth->numfaces; + /* numfaces = cloth->numfaces; */ /* UNUSED */ numverts = cloth->numverts; verts = cloth->verts; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 61e9daf4138..83003809a37 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1,4 +1,4 @@ -/* +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -361,72 +361,68 @@ void curvemap_sethandle(CurveMap *cuma, int type) static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode)) { float *p1,*p2,*p3,pt[3]; - float dx1,dy1, dx,dy, vx,vy, len,len1,len2; - - if(bezt->h1==0 && bezt->h2==0) return; + float len,len_a, len_b; + float dvec_a[2], dvec_b[2]; + + if(bezt->h1==0 && bezt->h2==0) { + return; + } p2= bezt->vec[1]; if(prev==NULL) { p3= next->vec[1]; - pt[0]= 2*p2[0]- p3[0]; - pt[1]= 2*p2[1]- p3[1]; + pt[0]= 2.0f*p2[0] - p3[0]; + pt[1]= 2.0f*p2[1] - p3[1]; p1= pt; } - else p1= prev->vec[1]; + else { + p1= prev->vec[1]; + } if(next==NULL) { p1= prev->vec[1]; - pt[0]= 2*p2[0]- p1[0]; - pt[1]= 2*p2[1]- p1[1]; + pt[0]= 2.0f*p2[0] - p1[0]; + pt[1]= 2.0f*p2[1] - p1[1]; p3= pt; } - else p3= next->vec[1]; - - dx= p2[0]- p1[0]; - dy= p2[1]- p1[1]; + else { + p3= next->vec[1]; + } - len1= (float)sqrt(dx*dx+dy*dy); - - dx1= p3[0]- p2[0]; - dy1= p3[1]- p2[1]; + sub_v2_v2v2(dvec_a, p2, p1); + sub_v2_v2v2(dvec_b, p3, p2); - len2= (float)sqrt(dx1*dx1+dy1*dy1); - - if(len1==0.0f) len1=1.0f; - if(len2==0.0f) len2=1.0f; - - if(bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) { /* auto */ - vx= dx1/len2 + dx/len1; - vy= dy1/len2 + dy/len1; - - len= 2.5614f*(float)sqrt(vx*vx + vy*vy); + len_a= len_v2(dvec_a); + len_b= len_v2(dvec_b); + + if(len_a==0.0f) len_a=1.0f; + if(len_b==0.0f) len_b=1.0f; + + if(bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) { /* auto */ + float tvec[2]; + tvec[0]= dvec_b[0]/len_b + dvec_a[0]/len_a; + tvec[1]= dvec_b[1]/len_b + dvec_a[1]/len_a; + + len= len_v2(tvec) * 2.5614f; if(len!=0.0f) { if(bezt->h1==HD_AUTO) { - len1/=len; - *(p2-3)= *p2-vx*len1; - *(p2-2)= *(p2+1)-vy*len1; + len_a/=len; + madd_v2_v2v2fl(p2-3, p2, tvec, -len_a); } if(bezt->h2==HD_AUTO) { - len2/=len; - *(p2+3)= *p2+vx*len2; - *(p2+4)= *(p2+1)+vy*len2; + len_b/=len; + madd_v2_v2v2fl(p2+3, p2, tvec, len_b); } } } if(bezt->h1==HD_VECT) { /* vector */ - dx/=3.0f; - dy/=3.0f; - *(p2-3)= *p2-dx; - *(p2-2)= *(p2+1)-dy; + madd_v2_v2v2fl(p2-3, p2, dvec_a, -1.0f/3.0f); } if(bezt->h2==HD_VECT) { - dx1/=3.0f; - dy1/=3.0f; - *(p2+3)= *p2+dx1; - *(p2+4)= *(p2+1)+dy1; + madd_v2_v2v2fl(p2+3, p2, dvec_b, 1.0f/3.0f); } } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a59092784dd..591e0b6a8d2 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -3937,7 +3939,8 @@ static bConstraintTypeInfo *constraintsTypeInfo[NUM_CONSTRAINT_TYPES]; static short CTI_INIT= 1; /* when non-zero, the list needs to be updated */ /* This function only gets called when CTI_INIT is non-zero */ -static void constraints_init_typeinfo (void) { +static void constraints_init_typeinfo (void) +{ constraintsTypeInfo[0]= NULL; /* 'Null' Constraint */ constraintsTypeInfo[1]= &CTI_CHILDOF; /* ChildOf Constraint */ constraintsTypeInfo[2]= &CTI_TRACKTO; /* TrackTo Constraint */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 794006e6f39..2e9ad11c6ca 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1,7 +1,4 @@ - -/* curve.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -2457,72 +2454,77 @@ void makeBevelList(Object *ob) void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) { float *p1,*p2,*p3, pt[3]; - float dx1,dy1,dz1,dx,dy,dz,vx,vy,vz,len,len1,len2; + float dvec_a[3], dvec_b[3]; + float len, len_a, len_b; const float eps= 1e-5; - if(bezt->h1==0 && bezt->h2==0) return; + if(bezt->h1==0 && bezt->h2==0) { + return; + } p2= bezt->vec[1]; if(prev==NULL) { p3= next->vec[1]; - pt[0]= 2*p2[0]- p3[0]; - pt[1]= 2*p2[1]- p3[1]; - pt[2]= 2*p2[2]- p3[2]; + pt[0]= 2.0f*p2[0] - p3[0]; + pt[1]= 2.0f*p2[1] - p3[1]; + pt[2]= 2.0f*p2[2] - p3[2]; p1= pt; } - else p1= prev->vec[1]; + else { + p1= prev->vec[1]; + } if(next==NULL) { - pt[0]= 2*p2[0]- p1[0]; - pt[1]= 2*p2[1]- p1[1]; - pt[2]= 2*p2[2]- p1[2]; + pt[0]= 2.0f*p2[0] - p1[0]; + pt[1]= 2.0f*p2[1] - p1[1]; + pt[2]= 2.0f*p2[2] - p1[2]; p3= pt; } - else p3= next->vec[1]; + else { + p3= next->vec[1]; + } - dx= p2[0]- p1[0]; - dy= p2[1]- p1[1]; - dz= p2[2]- p1[2]; - - if(mode) len1= dx; - else len1= (float)sqrt(dx*dx+dy*dy+dz*dz); - - dx1= p3[0]- p2[0]; - dy1= p3[1]- p2[1]; - dz1= p3[2]- p2[2]; - - if(mode) len2= dx1; - else len2= (float)sqrt(dx1*dx1+dy1*dy1+dz1*dz1); + sub_v3_v3v3(dvec_a, p2, p1); + sub_v3_v3v3(dvec_b, p3, p2); - if(len1==0.0f) len1=1.0f; - if(len2==0.0f) len2=1.0f; + if (mode != 0) { + len_a= dvec_a[0]; + len_b= dvec_b[0]; + } + else { + len_a= len_v3(dvec_a); + len_b= len_v3(dvec_b); + } + + if(len_a==0.0f) len_a=1.0f; + if(len_b==0.0f) len_b=1.0f; if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) || ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) { /* auto */ - vx= dx1/len2 + dx/len1; - vy= dy1/len2 + dy/len1; - vz= dz1/len2 + dz/len1; - len= 2.5614f*(float)sqrt(vx*vx + vy*vy + vz*vz); + float tvec[3]; + tvec[0]= dvec_b[0]/len_b + dvec_a[0]/len_a; + tvec[1]= dvec_b[1]/len_b + dvec_a[1]/len_a; + tvec[2]= dvec_b[2]/len_b + dvec_a[2]/len_a; + len= len_v3(tvec) * 2.5614f; + if(len!=0.0f) { int leftviolate=0, rightviolate=0; /* for mode==2 */ - if(len1>5.0f*len2) len1= 5.0f*len2; - if(len2>5.0f*len1) len2= 5.0f*len1; + if(len_a>5.0f*len_b) len_a= 5.0f*len_b; + if(len_b>5.0f*len_a) len_b= 5.0f*len_a; if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM)) { - len1/=len; - *(p2-3)= *p2-vx*len1; - *(p2-2)= *(p2+1)-vy*len1; - *(p2-1)= *(p2+2)-vz*len1; + len_a/=len; + madd_v3_v3v3fl(p2-3, p2, tvec, -len_a); - if((bezt->h1==HD_AUTO_ANIM) && next && prev) { // keep horizontal if extrema + if((bezt->h1==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */ float ydiff1= prev->vec[1][1] - bezt->vec[1][1]; float ydiff2= next->vec[1][1] - bezt->vec[1][1]; if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) { bezt->vec[0][1]= bezt->vec[1][1]; } - else { // handles should not be beyond y coord of two others + else { /* handles should not be beyond y coord of two others */ if(ydiff1 <= 0.0f) { if(prev->vec[1][1] > bezt->vec[0][1]) { bezt->vec[0][1]= prev->vec[1][1]; @@ -2539,18 +2541,16 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) } } if(ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) { - len2/=len; - *(p2+3)= *p2+vx*len2; - *(p2+4)= *(p2+1)+vy*len2; - *(p2+5)= *(p2+2)+vz*len2; + len_b/=len; + madd_v3_v3v3fl(p2+3, p2, tvec, len_b); - if((bezt->h2==HD_AUTO_ANIM) && next && prev) { // keep horizontal if extrema + if((bezt->h2==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */ float ydiff1= prev->vec[1][1] - bezt->vec[1][1]; float ydiff2= next->vec[1][1] - bezt->vec[1][1]; if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) { bezt->vec[2][1]= bezt->vec[1][1]; } - else { // handles should not be beyond y coord of two others + else { /* andles should not be beyond y coord of two others */ if(ydiff1 <= 0.0f) { if(next->vec[1][1] < bezt->vec[2][1]) { bezt->vec[2][1]= next->vec[1][1]; @@ -2566,25 +2566,25 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) } } } - if(leftviolate || rightviolate) { /* align left handle */ + if(leftviolate || rightviolate) { /* align left handle */ float h1[3], h2[3]; + float dot; sub_v3_v3v3(h1, p2-3, p2); sub_v3_v3v3(h2, p2, p2+3); - len1= normalize_v3(h1); - len2= normalize_v3(h2); - vz= dot_v3v3(h1, h2); + len_a= normalize_v3(h1); + len_b= normalize_v3(h2); + + dot= dot_v3v3(h1, h2); if(leftviolate) { - *(p2+3)= *(p2) - vz*len2*h1[0]; - *(p2+4)= *(p2+1) - vz*len2*h1[1]; - *(p2+5)= *(p2+2) - vz*len2*h1[2]; + mul_v3_fl(h1, dot * len_b); + sub_v3_v3v3(p2+3, p2, h1); } else { - *(p2-3)= *(p2) + vz*len1*h2[0]; - *(p2-2)= *(p2+1) + vz*len1*h2[1]; - *(p2-1)= *(p2+2) + vz*len1*h2[2]; + mul_v3_fl(h2, dot * len_a); + add_v3_v3v3(p2-3, p2, h2); } } @@ -2592,60 +2592,50 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) } if(bezt->h1==HD_VECT) { /* vector */ - dx/=3.0f; - dy/=3.0f; - dz/=3.0f; - *(p2-3)= *p2-dx; - *(p2-2)= *(p2+1)-dy; - *(p2-1)= *(p2+2)-dz; + madd_v3_v3v3fl(p2-3, p2, dvec_a, -1.0f/3.0f); } if(bezt->h2==HD_VECT) { - dx1/=3.0f; - dy1/=3.0f; - dz1/=3.0f; - *(p2+3)= *p2+dx1; - *(p2+4)= *(p2+1)+dy1; - *(p2+5)= *(p2+2)+dz1; + madd_v3_v3v3fl(p2+3, p2, dvec_b, 1.0f/3.0f); } - len2= len_v3v3(p2, p2+3); - len1= len_v3v3(p2, p2-3); - if(len1==0.0f) len1= 1.0f; - if(len2==0.0f) len2= 1.0f; + len_b= len_v3v3(p2, p2+3); + len_a= len_v3v3(p2, p2-3); + if(len_a==0.0f) len_a= 1.0f; + if(len_b==0.0f) len_b= 1.0f; if(bezt->f1 & SELECT) { /* order of calculation */ - if(bezt->h2==HD_ALIGN) { /* aligned */ - if(len1>eps) { - len= len2/len1; - p2[3]= p2[0]+len*(p2[0]-p2[-3]); - p2[4]= p2[1]+len*(p2[1]-p2[-2]); - p2[5]= p2[2]+len*(p2[2]-p2[-1]); + if(bezt->h2==HD_ALIGN) { /* aligned */ + if(len_a>eps) { + len= len_b/len_a; + p2[3]= p2[0]+len*(p2[0] - p2[-3]); + p2[4]= p2[1]+len*(p2[1] - p2[-2]); + p2[5]= p2[2]+len*(p2[2] - p2[-1]); } } if(bezt->h1==HD_ALIGN) { - if(len2>eps) { - len= len1/len2; - p2[-3]= p2[0]+len*(p2[0]-p2[3]); - p2[-2]= p2[1]+len*(p2[1]-p2[4]); - p2[-1]= p2[2]+len*(p2[2]-p2[5]); + if(len_b>eps) { + len= len_a/len_b; + p2[-3]= p2[0]+len*(p2[0] - p2[3]); + p2[-2]= p2[1]+len*(p2[1] - p2[4]); + p2[-1]= p2[2]+len*(p2[2] - p2[5]); } } } else { if(bezt->h1==HD_ALIGN) { - if(len2>eps) { - len= len1/len2; - p2[-3]= p2[0]+len*(p2[0]-p2[3]); - p2[-2]= p2[1]+len*(p2[1]-p2[4]); - p2[-1]= p2[2]+len*(p2[2]-p2[5]); + if(len_b>eps) { + len= len_a/len_b; + p2[-3]= p2[0]+len*(p2[0] - p2[3]); + p2[-2]= p2[1]+len*(p2[1] - p2[4]); + p2[-1]= p2[2]+len*(p2[2] - p2[5]); } } if(bezt->h2==HD_ALIGN) { /* aligned */ - if(len1>eps) { - len= len2/len1; - p2[3]= p2[0]+len*(p2[0]-p2[-3]); - p2[4]= p2[1]+len*(p2[1]-p2[-2]); - p2[5]= p2[2]+len*(p2[2]-p2[-1]); + if(len_a>eps) { + len= len_b/len_a; + p2[3]= p2[0]+len*(p2[0] - p2[-3]); + p2[4]= p2[1]+len*(p2[1] - p2[-2]); + p2[5]= p2[2]+len*(p2[2] - p2[-1]); } } } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 30da2e01011..7d98119610b 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1,36 +1,36 @@ /* -* $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. -* -* The Original Code is Copyright (C) 2006 Blender Foundation. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): Ben Batt <benbatt@gmail.com> -* -* ***** END GPL LICENSE BLOCK ***** -* -* Implementation of CustomData. -* -* BKE_customdata.h contains the function prototypes for this file. -* -*/ + * $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. + * + * The Original Code is Copyright (C) 2006 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Ben Batt <benbatt@gmail.com> + * + * ***** END GPL LICENSE BLOCK ***** + * + * Implementation of CustomData. + * + * BKE_customdata.h contains the function prototypes for this file. + * + */ /** \file blender/blenkernel/intern/customdata.c * \ingroup bke @@ -2383,10 +2383,8 @@ int CustomData_verify_versions(struct CustomData *data, int index) static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external) { - char *path = (id->lib)? id->lib->filepath: G.main->name; - BLI_strncpy(filename, external->filename, FILE_MAX); - BLI_path_abs(filename, path); + BLI_path_abs(filename, ID_BLEND_PATH(G.main, id)); } void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem) diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 11a0a5884ee..f18f533d460 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -1,9 +1,4 @@ -/* deform.c June 2001 - * - * support for deformation groups - * - * Reevan McKay - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -27,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Reevan McKay * * ***** END GPL LICENSE BLOCK ***** */ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 6f27a104144..80a40c0a3a3 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2028,17 +2028,27 @@ static int object_modifiers_use_time(Object *ob) /* check whether any modifiers are animated */ if (ob->adt) { AnimData *adt = ob->adt; + FCurve *fcu; /* action - check for F-Curves with paths containing 'modifiers[' */ if (adt->action) { - FCurve *fcu; - for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) { if (fcu->rna_path && strstr(fcu->rna_path, "modifiers[")) return 1; } } + /* This here allows modifier properties to get driven and still update properly + * + * Workaround to get [#26764] (e.g. subsurf levels not updating when animated/driven) + * working, without the updating problems ([#28525] [#28690] [#28774] [#28777]) caused + * by the RNA updates cache introduced in r.38649 + */ + for (fcu = adt->drivers.first; fcu; fcu = fcu->next) { + if (fcu->rna_path && strstr(fcu->rna_path, "modifiers[")) + return 1; + } + // XXX: also, should check NLA strips, though for now assume that nobody uses // that and we can omit that for performance reasons... } diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index b19ea93a1b8..fb67c07cfe9 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1,6 +1,4 @@ -/* displist.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -1207,7 +1205,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba if(cu->path) free_path(cu->path); cu->path= NULL; - if(ob->type==OB_FONT) BKE_text_to_curve(scene, ob, 0); + if(ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0); if(!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts); @@ -1406,7 +1404,8 @@ void makeDispListCurveTypes_forOrco(struct Scene *scene, struct Object *ob, stru } /* add Orco layer to the displist object which has got derived mesh and return orco */ -float *makeOrcoDispList(Scene *scene, Object *ob, DerivedMesh *derivedFinal, int forRender) { +float *makeOrcoDispList(Scene *scene, Object *ob, DerivedMesh *derivedFinal, int forRender) +{ float *orco; if (derivedFinal == NULL) diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 7fb9f96e0cf..5ce7b82a45f 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1,6 +1,4 @@ -/* effect.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 3916d0ca701..e2326b005c1 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -818,7 +820,7 @@ void calchandles_fcurve (FCurve *fcu) * -> Vector handles: become 'nothing' when (one half selected AND other not) * - PHASE 2: recalculate handles */ -void testhandles_fcurve (FCurve *fcu) +void testhandles_fcurve (FCurve *fcu, const short use_handle) { BezTriple *bezt; unsigned int a; @@ -834,9 +836,16 @@ void testhandles_fcurve (FCurve *fcu) /* flag is initialised as selection status * of beztriple control-points (labelled 0,1,2) */ - if (bezt->f1 & SELECT) flag |= (1<<0); // == 1 if (bezt->f2 & SELECT) flag |= (1<<1); // == 2 - if (bezt->f3 & SELECT) flag |= (1<<2); // == 4 + if(use_handle == FALSE) { + if(flag & 2) { + flag |= (1<<0) | (1<<2); + } + } + else { + if (bezt->f1 & SELECT) flag |= (1<<0); // == 1 + if (bezt->f3 & SELECT) flag |= (1<<2); // == 4 + } /* one or two handles selected only */ if (ELEM(flag, 0, 7)==0) { diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 95c0aa60991..d5c54893128 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 6898615c753..4c8d0cf998d 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1,6 +1,4 @@ -/* font.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -284,7 +282,7 @@ struct TmpFont *vfont_find_tmpfont(VFont *vfont) return tmpfnt; } -static VFontData *vfont_get_data(VFont *vfont) +static VFontData *vfont_get_data(Main *bmain, VFont *vfont) { struct TmpFont *tmpfnt = NULL; PackedFile *tpf; @@ -319,11 +317,11 @@ static VFontData *vfont_get_data(VFont *vfont) BLI_addtail(&ttfdata, tmpfnt); } } else { - pf= newPackedFile(NULL, vfont->name); + pf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); if(!tmpfnt) { - tpf= newPackedFile(NULL, vfont->name); + tpf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); // Add temporary packed file to globals tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font"); @@ -351,7 +349,7 @@ static VFontData *vfont_get_data(VFont *vfont) return vfont->data; } -VFont *load_vfont(const char *name) +VFont *load_vfont(Main *bmain, const char *name) { char filename[FILE_MAXFILE]; VFont *vfont= NULL; @@ -371,8 +369,8 @@ VFont *load_vfont(const char *name) BLI_strncpy(dir, name, sizeof(dir)); BLI_splitdirstring(dir, filename); - pf= newPackedFile(NULL, name); - tpf= newPackedFile(NULL, name); + pf= newPackedFile(NULL, name, bmain->name); + tpf= newPackedFile(NULL, name, bmain->name); is_builtin= 0; } @@ -382,7 +380,7 @@ VFont *load_vfont(const char *name) vfd= BLI_vfontdata_from_freetypefont(pf); if (vfd) { - vfont = alloc_libblock(&G.main->vfont, ID_VF, filename); + vfont = alloc_libblock(&bmain->vfont, ID_VF, filename); vfont->data = vfd; /* if there's a font name, use it for the ID name */ @@ -439,7 +437,7 @@ VFont *get_builtin_font(void) if (strcmp(vf->name, FO_BUILTIN_NAME)==0) return vf; - return load_vfont(FO_BUILTIN_NAME); + return load_vfont(G.main, FO_BUILTIN_NAME); } static VChar *find_vfont_char(VFontData *vfd, intptr_t character) @@ -500,7 +498,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i } -static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx) +static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx) { BezTriple *bezt1, *bezt2; Nurb *nu1 = NULL, *nu2 = NULL; @@ -509,7 +507,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float VChar *che = NULL; int i; - vfd= vfont_get_data(which_vfont(cu, info)); + vfd= vfont_get_data(bmain, which_vfont(cu, info)); if (!vfd) return; /* @@ -662,7 +660,7 @@ static float char_width(Curve *cu, VChar *che, CharInfo *info) } } -struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) +struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int mode) { VFont *vfont, *oldvfont; VFontData *vfd= NULL; @@ -714,7 +712,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if (cu->tb==NULL) cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "TextBox compat"); - vfd= vfont_get_data(vfont); + vfd= vfont_get_data(bmain, vfont); /* The VFont Data can not be found */ if(!vfd) { @@ -792,7 +790,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) } if (vfont != oldvfont) { - vfd= vfont_get_data(vfont); + vfd= vfont_get_data(bmain, vfont); oldvfont = vfont; } @@ -1157,7 +1155,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) } // We do not want to see any character for \n or \r if(cha != '\n' && cha != '\r') - buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i); + buildchar(bmain, cu, cha, info, ct->xof, ct->yof, ct->rot, i); if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) { float ulwidth, uloverlap= 0.0f; diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index c2e94cc97db..06ca7b7b509 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -182,7 +184,7 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd) gpl->thickness = 3; /* auto-name */ - sprintf(gpl->info, "GP_Layer"); + strcpy(gpl->info, "GP_Layer"); BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info[0]), sizeof(gpl->info)); /* make this one the active one */ diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 9effd25c142..07bb4666134 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -1,32 +1,32 @@ /* -* $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. -* -* The Original Code is Copyright (C) 2006-2007 Blender Foundation. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): none yet. -* -* ***** END GPL LICENSE BLOCK ***** -* -*/ + * $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. + * + * The Original Code is Copyright (C) 2006-2007 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + * + */ /** \file blender/blenkernel/intern/icons.c * \ingroup bke diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 21ea2c1d222..8d5668e241a 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -110,7 +110,8 @@ int BKE_idcode_is_valid(int code) return idtype_from_code(code)?1:0; } -int BKE_idcode_is_linkable(int code) { +int BKE_idcode_is_linkable(int code) +{ IDType *idt= idtype_from_code(code); return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0; } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d764826cd47..cf8f96c143a 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1,5 +1,4 @@ -/* image.c - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -1480,7 +1479,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) /* try to repack file */ if(ima->packedfile) { PackedFile *pf; - pf = newPackedFile(NULL, ima->name); + pf = newPackedFile(NULL, ima->name, ID_BLEND_PATH(G.main, &ima->id)); if (pf) { freePackedFile(ima->packedfile); ima->packedfile = pf; @@ -1653,10 +1652,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) BLI_stringdec(name, head, tail, &numlen); BLI_stringenc(name, head, tail, numlen, frame); - if(ima->id.lib) - BLI_path_abs(name, ima->id.lib->filepath); - else - BLI_path_abs(name, G.main->name); + BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id)); flag= IB_rect|IB_multilayer; if(ima->flag & IMA_DO_PREMUL) @@ -1768,11 +1764,8 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame) char str[FILE_MAX]; BLI_strncpy(str, ima->name, FILE_MAX); - if(ima->id.lib) - BLI_path_abs(str, ima->id.lib->filepath); - else - BLI_path_abs(str, G.main->name); - + BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id)); + /* FIXME: make several stream accessible in image editor, too*/ ima->anim = openanim(str, IB_rect, 0); @@ -1834,10 +1827,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) /* get the right string */ BLI_strncpy(str, ima->name, sizeof(str)); - if(ima->id.lib) - BLI_path_abs(str, ima->id.lib->filepath); - else - BLI_path_abs(str, G.main->name); + BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id)); /* read ibuf */ ibuf = IMB_loadiffname(str, flag); @@ -1860,7 +1850,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) /* make packed file for autopack */ if ((ima->packedfile == NULL) && (G.fileflags & G_AUTOPACK)) - ima->packedfile = newPackedFile(NULL, str); + ima->packedfile = newPackedFile(NULL, str, ID_BLEND_PATH(G.main, &ima->id)); } } else diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index 5b237665290..f4d1ff4241d 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -1,5 +1,4 @@ -/* image_gen.c - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 099661f7914..cef3eee8c5e 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -913,7 +913,7 @@ static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z { // Solves for unknown X in equation AX=B unsigned int conjgrad_loopcount=0, conjgrad_looplimit=100; - float conjgrad_epsilon=0.0001f, conjgrad_lasterror=0; + float conjgrad_epsilon=0.0001f /* , conjgrad_lasterror=0 */ /* UNUSED */; lfVector *q, *d, *tmp, *r; float s, starget, a, s_prev; unsigned int numverts = lA[0].vcount; @@ -964,7 +964,7 @@ static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z conjgrad_loopcount++; } - conjgrad_lasterror = s; + /* conjgrad_lasterror = s; */ /* UNUSED */ del_lfvector(q); del_lfvector(d); @@ -1777,7 +1777,7 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float steps = 55; for (i=0; i<steps; i++) { for (node=cloth->springs; node; node=node->next) { - ClothVertex *cv1, *cv2; + /* ClothVertex *cv1, *cv2; */ /* UNUSED */ int v1, v2; float len, c, l, vec[3]; @@ -1786,8 +1786,8 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float continue; v1 = spring->ij; v2 = spring->kl; - cv1 = cloth->verts + v1; - cv2 = cloth->verts + v2; + /* cv1 = cloth->verts + v1; */ /* UNUSED */ + /* cv2 = cloth->verts + v2; */ /* UNUSED */ len = len_v3v3(cos[v1], cos[v2]); sub_v3_v3v3(vec, cos[v1], cos[v2]); @@ -1827,7 +1827,7 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float return 1; } int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors) -{ +{ unsigned int i=0; float step=0.0f, tf=clmd->sim_parms->timescale; Cloth *cloth = clmd->clothObject; @@ -1981,7 +1981,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase } void implicit_set_positions (ClothModifierData *clmd) -{ +{ Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts; unsigned int numverts = cloth->numverts, i; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5acd6c169a0..91f3c7a22ba 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1,4 +1,6 @@ -/* +/* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -317,7 +319,7 @@ static const char *constraint_adrcodes_to_paths (int adrcode, int *array_index) /* ShapeKey types * NOTE: as we don't have access to the keyblock where the data comes from (for now), - * we'll just use numerical indices for now... + * we'll just use numerical indices for now... */ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { @@ -1103,7 +1105,7 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c agrp->flag = AGRP_SELECTED; if (muteipo) agrp->flag |= AGRP_MUTED; - strncpy(agrp->name, grpname, sizeof(agrp->name)); + BLI_strncpy(agrp->name, grpname, sizeof(agrp->name)); BLI_addtail(&tmp_act.groups, agrp); BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 4b8209ab77e..9e48e691b87 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1,7 +1,4 @@ - -/* key.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -1445,10 +1442,10 @@ KeyBlock *add_keyblock(Key *key, const char *name) tot= BLI_countlist(&key->block); if(name) { - strncpy(kb->name, name, sizeof(kb->name)); + BLI_strncpy(kb->name, name, sizeof(kb->name)); } else { - if(tot==1) strcpy(kb->name, "Basis"); - else sprintf(kb->name, "Key %d", tot-1); + if(tot==1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name)); + else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot-1); } BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name)); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 094214858f9..cbff9c2337e 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -1,7 +1,4 @@ /* - * lattice.c - * - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 841e60e6846..6363512a36a 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -955,9 +955,9 @@ static void get_flags_for_id(ID *id, char *buf) isnode= ((Tex *)id)->use_nodes; if (id->us<0) - sprintf(buf, "-1W "); + strcpy(buf, "-1W "); else if (!id->lib && !isfake && id->us && !isnode) - sprintf(buf, " "); + strcpy(buf, " "); else if(isnode) sprintf(buf, "%c%cN%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' '); else diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index e2659340a90..538e0c98796 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1,7 +1,4 @@ - -/* material.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -194,7 +191,7 @@ void init_material(Material *ma) ma->vol.ms_diff = 1.f; ma->vol.ms_intensity = 1.f; - ma->game.flag=0; + ma->game.flag = GEMAT_BACKCULL; ma->game.alpha_blend=0; ma->game.face_orientation=0; @@ -724,6 +721,48 @@ void test_object_materials(ID *id) } } +void assign_material_id(ID *id, Material *ma, short act) +{ + Material *mao, **matar, ***matarar; + short *totcolp; + + if(act>MAXMAT) return; + if(act<1) act= 1; + + /* prevent crashing when using accidentally */ + BLI_assert(id->lib == NULL); + if(id->lib) return; + + /* test arraylens */ + + totcolp= give_totcolp_id(id); + matarar= give_matarar_id(id); + + if(totcolp==NULL || matarar==NULL) return; + + if(act > *totcolp) { + matar= MEM_callocN(sizeof(void *)*act, "matarray1"); + + if(*totcolp) { + memcpy(matar, *matarar, sizeof(void *)*(*totcolp)); + MEM_freeN(*matarar); + } + + *matarar= matar; + *totcolp= act; + } + + /* in data */ + mao= (*matarar)[act-1]; + if(mao) mao->id.us--; + (*matarar)[act-1]= ma; + + if(ma) + id_us_plus((ID *)ma); + + test_object_materials(id); +} + void assign_material(Object *ob, Material *ma, short act) { Material *mao, **matar, ***matarar; @@ -1284,7 +1323,7 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, const float c *g=1.0f; else *g = tmp; - + tmp = facm + fac*col[2]; if(tmp <= 0.0f) *b = 0.0f; @@ -1773,7 +1812,7 @@ int do_version_tface(Main *main, int fileload) int flag; int index; - /* sometimes mesh has no materials but will need a new one. In those + /* sometimes mesh has no materials but will need a new one. In those * cases we need to ignore the mf->mat_nr and only look at the face * mode because it can be zero as uninitialized or the 1st created material */ @@ -1954,6 +1993,11 @@ int do_version_tface(Main *main, int fileload) } } } + /* material is not used by faces with texface + * set the default flag - do it only once */ + else + if (fileload) + ma->game.flag = GEMAT_BACKCULL; } return nowarning; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 555d35726bc..05d07ddf918 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -1,11 +1,4 @@ -/* mball.c - * - * MetaBalls are created from a single Object (with a name without number in it), - * here the DispList and BoundBox also is located. - * All objects with the same name (but with a number in it) are added to this. - * - * texture coordinates are patched within the displist - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -30,13 +23,18 @@ * Contributor(s): Jiri Hnidek <jiri.hnidek@vslib.cz>. * * ***** END GPL LICENSE BLOCK ***** + * + * MetaBalls are created from a single Object (with a name without number in it), + * here the DispList and BoundBox also is located. + * All objects with the same name (but with a number in it) are added to this. + * + * texture coordinates are patched within the displist */ /** \file blender/blenkernel/intern/mball.c * \ingroup bke */ - #include <stdio.h> #include <string.h> #include <math.h> diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 810e7c285e8..9574c886ccc 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1,8 +1,4 @@ - -/* mesh.c - * - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -1606,3 +1602,19 @@ void mesh_translate(Mesh *me, float offset[3], int do_keys) } } } + + +void BKE_mesh_ensure_navmesh(Mesh *me) +{ + if (!CustomData_has_layer(&me->fdata, CD_RECAST)) { + int i; + int numFaces = me->totface; + int* recastData; + CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData"); + recastData = (int*)CustomData_get_layer(&me->fdata, CD_RECAST); + for (i=0; i<numFaces; i++) { + recastData[i] = i+1; + } + CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData"); + } +} diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index fe26c0ccd2d..9de75a49998 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -1,38 +1,38 @@ /* -* $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. -* -* The Original Code is Copyright (C) 2005 by the Blender Foundation. -* All rights reserved. -* -* Contributor(s): Daniel Dunbar -* Ton Roosendaal, -* Ben Batt, -* Brecht Van Lommel, -* Campbell Barton -* -* ***** END GPL LICENSE BLOCK ***** -* -* Modifier stack implementation. -* -* BKE_modifier.h contains the function prototypes for this file. -* -*/ + * $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. + * + * The Original Code is Copyright (C) 2005 by the Blender Foundation. + * All rights reserved. + * + * Contributor(s): Daniel Dunbar + * Ton Roosendaal, + * Ben Batt, + * Brecht Van Lommel, + * Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + * + * Modifier stack implementation. + * + * BKE_modifier.h contains the function prototypes for this file. + * + */ /** \file blender/blenkernel/intern/modifier.c * \ingroup bke diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index cd264c5ddfd..749930d4278 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1029,7 +1029,7 @@ static void old_mdisps_convert(MFace *mface, MDisps *mdisp) int nvert = (mface->v4)? 4: 3; int newtotdisp = multires_grid_tot[newlvl]*nvert; int x, y, S; - float (*disps)[3], (*out)[3], u, v; + float (*disps)[3], (*out)[3], u = 0.0f, v = 0.0f; /* Quite gcc barking. */ disps = MEM_callocN(sizeof(float) * 3 * newtotdisp, "multires disps"); diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c index 8a2ec1e5169..f670486484b 100644 --- a/source/blender/blenkernel/intern/navmesh_conversion.c +++ b/source/blender/blenkernel/intern/navmesh_conversion.c @@ -1,31 +1,35 @@ -/** -* $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. -* -* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): none yet. -* -* ***** END GPL LICENSE BLOCK ***** -*/ +/* + * $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. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/blenkernel/intern/navmesh_conversion.c + * \ingroup bke + */ #include <math.h> #include <stdlib.h> @@ -328,14 +332,10 @@ struct SortContext const int* trisToFacesMap; }; -/* XXX: not thread-safe, but it's called only from modifiers stack - which isn't threaded. Anyway, better to avoid this in the future */ -static struct SortContext *_qsort_context; - -static int compareByData(const void * a, const void * b) +static int compareByData(void *ctx, const void * a, const void * b) { - return ( _qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)a]] - - _qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)b]] ); + return (((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int*)a]] - + ((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int*)b]] ); } int buildNavMeshData(const int nverts, const float* verts, @@ -367,8 +367,7 @@ int buildNavMeshData(const int nverts, const float* verts, trisMapping[i]=i; context.recastData = recastData; context.trisToFacesMap = trisToFacesMap; - _qsort_context = &context; - qsort(trisMapping, ntris, sizeof(int), compareByData); + recast_qsort(trisMapping, ntris, sizeof(int), &context, compareByData); //search first valid triangle - triangle of convex polygon validTriStart = -1; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 6ce80342dd6..97347d85deb 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -1284,16 +1286,16 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip) if (strip->name[0]==0) { switch (strip->type) { case NLASTRIP_TYPE_CLIP: /* act-clip */ - sprintf(strip->name, "%s", (strip->act)?(strip->act->id.name+2):("<No Action>")); + BLI_strncpy(strip->name, (strip->act)?(strip->act->id.name+2):("<No Action>"), sizeof(strip->name)); break; case NLASTRIP_TYPE_TRANSITION: /* transition */ - sprintf(strip->name, "Transition"); + BLI_strncpy(strip->name, "Transition", sizeof(strip->name)); break; case NLASTRIP_TYPE_META: /* meta */ - sprintf(strip->name, "Meta"); + BLI_strncpy(strip->name, "Meta", sizeof(strip->name)); break; default: - sprintf(strip->name, "NLA Strip"); + BLI_strncpy(strip->name, "NLA Strip", sizeof(strip->name)); break; } } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 524a63a8a95..f0be3c99f13 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1682,7 +1682,7 @@ void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwid void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *)) { if (storagename) - strncpy(ntype->storagename, storagename, sizeof(ntype->storagename)); + BLI_strncpy(ntype->storagename, storagename, sizeof(ntype->storagename)); else ntype->storagename[0] = '\0'; ntype->copystoragefunc = copystoragefunc; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f8669c30809..3e4413cec41 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1,6 +1,4 @@ -/* object.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -1659,7 +1657,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) if(ob->matbits) MEM_freeN(ob->matbits); ob->mat = NULL; ob->matbits= NULL; - if ((target->totcol) && (target->mat) && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) { //XXX OB_SUPPORT_MATERIAL + if ((target->totcol) && (target->mat) && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { int i; ob->colbits = target->colbits; @@ -2839,7 +2837,8 @@ void object_sculpt_modifiers_changed(Object *ob) } } -float give_timeoffset(Object *ob) { +float give_timeoffset(Object *ob) +{ if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) { return ob->sf + give_timeoffset(ob->parent); } else { @@ -2847,7 +2846,8 @@ float give_timeoffset(Object *ob) { } } -int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, float **rot) { +int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, float **rot) +{ if (ob->data==NULL) return 0; @@ -3065,6 +3065,79 @@ void object_camera_matrix( } +void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3], + float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]) +{ + float facx, facy; + float depth; + + /* aspect correcton */ + if (scene) { + float aspx= (float) scene->r.xsch*scene->r.xasp; + float aspy= (float) scene->r.ysch*scene->r.yasp; + + if(aspx < aspy) { + r_asp[0]= aspx / aspy; + r_asp[1]= 1.0; + } + else { + r_asp[0]= 1.0; + r_asp[1]= aspy / aspx; + } + } + else { + r_asp[0]= 1.0f; + r_asp[1]= 1.0f; + } + + if(camera->type==CAM_ORTHO) { + facx= 0.5f * camera->ortho_scale * r_asp[0] * scale[0]; + facy= 0.5f * camera->ortho_scale * r_asp[1] * scale[1]; + r_shift[0]= camera->shiftx * camera->ortho_scale * scale[0]; + r_shift[1]= camera->shifty * camera->ortho_scale * scale[1]; + depth= do_clip ? -((camera->clipsta * scale[2]) + 0.1f) : - drawsize * camera->ortho_scale * scale[2]; + + *r_drawsize= 0.5f * camera->ortho_scale; + } + else { + /* that way it's always visible - clipsta+0.1 */ + float fac; + *r_drawsize= drawsize / ((scale[0] + scale[1] + scale[2]) / 3.0f); + + if(do_clip) { + /* fixed depth, variable size (avoids exceeding clipping range) */ + depth = -(camera->clipsta + 0.1f); + fac = depth / (camera->lens/-16.0f * scale[2]); + } + else { + /* fixed size, variable depth (stays a reasonable size in the 3D view) */ + depth= *r_drawsize * camera->lens/-16.0f * scale[2]; + fac= *r_drawsize; + } + + facx= fac * r_asp[0] * scale[0]; + facy= fac * r_asp[1] * scale[1]; + r_shift[0]= camera->shiftx*fac*2 * scale[0]; + r_shift[1]= camera->shifty*fac*2 * scale[1]; + } + + r_vec[0][0]= r_shift[0] + facx; r_vec[0][1]= r_shift[1] + facy; r_vec[0][2]= depth; + r_vec[1][0]= r_shift[0] + facx; r_vec[1][1]= r_shift[1] - facy; r_vec[1][2]= depth; + r_vec[2][0]= r_shift[0] - facx; r_vec[2][1]= r_shift[1] - facy; r_vec[2][2]= depth; + r_vec[3][0]= r_shift[0] - facx; r_vec[3][1]= r_shift[1] + facy; r_vec[3][2]= depth; +} + +void camera_view_frame(Scene *scene, Camera *camera, float r_vec[4][3]) +{ + float dummy_asp[2]; + float dummy_shift[2]; + float dummy_drawsize; + const float dummy_scale[3]= {1.0f, 1.0f, 1.0f}; + + camera_view_frame_ex(scene, camera, FALSE, 1.0, dummy_scale, + dummy_asp, dummy_shift, &dummy_drawsize, r_vec); +} + #if 0 static int pc_findindex(ListBase *listbase, int index) { diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index ed729d819b7..2c8975e9cb4 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -1,6 +1,4 @@ /* - * blenkernel/packedFile.c - (cleaned up mar-01 nzc) - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -168,7 +166,7 @@ PackedFile *newPackedFileMemory(void *mem, int memlen) return pf; } -PackedFile *newPackedFile(ReportList *reports, const char *filename) +PackedFile *newPackedFile(ReportList *reports, const char *filename, const char *basepath) { PackedFile *pf = NULL; int file, filelen; @@ -185,7 +183,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename) // convert relative filenames to absolute filenames strcpy(name, filename); - BLI_path_abs(name, G.main->name); + BLI_path_abs(name, basepath); // open the file // and create a PackedFile structure @@ -224,7 +222,7 @@ void packAll(Main *bmain, ReportList *reports) for(ima=bmain->image.first; ima; ima=ima->id.next) { if(ima->packedfile == NULL && ima->id.lib==NULL) { if(ima->source==IMA_SRC_FILE) { - ima->packedfile = newPackedFile(reports, ima->name); + ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id)); } else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2); @@ -234,11 +232,11 @@ void packAll(Main *bmain, ReportList *reports) for(vf=bmain->vfont.first; vf; vf=vf->id.next) if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0) - vf->packedfile = newPackedFile(reports, vf->name); + vf->packedfile = newPackedFile(reports, vf->name, bmain->name); for(sound=bmain->sound.first; sound; sound=sound->id.next) if(sound->packedfile == NULL && sound->id.lib==NULL) - sound->packedfile = newPackedFile(reports, sound->name); + sound->packedfile = newPackedFile(reports, sound->name, bmain->name); } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 82a2436a010..806a7871948 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1,6 +1,4 @@ -/* particle.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -3488,6 +3486,7 @@ static void default_particle_settings(ParticleSettings *part) part->totpart= 1000; part->grid_res= 10; part->timetweak= 1.0; + part->courant_target = 0.2; part->integrator= PART_INT_MIDPOINT; part->phystype= PART_PHYS_NEWTON; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index e1ea6e419d3..6b601ed4b1a 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1,6 +1,4 @@ -/* particle_system.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -26,6 +24,9 @@ * * Contributor(s): Raul Fernandez Hernandez (Farsthary), Stephen Swhitehorn. * + * Adaptive time step + * Copyright 2011 AutoCRC + * * ***** END GPL LICENSE BLOCK ***** */ @@ -2321,6 +2322,10 @@ typedef struct SPHRangeData float massfac; int use_size; + + /* Same as SPHData::element_size */ + float element_size; + float flow[3]; } SPHRangeData; typedef struct SPHData { ParticleSystem *psys[10]; @@ -2328,12 +2333,17 @@ typedef struct SPHData { float mass; EdgeHash *eh; float *gravity; + /* Average distance to neighbours (other particles in the support domain), + for calculating the Courant number (adaptive time step). */ + float element_size; + float flow[3]; }SPHData; static void sph_density_accum_cb(void *userdata, int index, float squared_dist) { SPHRangeData *pfr = (SPHRangeData *)userdata; ParticleData *npa = pfr->npsys->particles + index; float q; + float dist; if(npa == pfr->pa || squared_dist < FLT_EPSILON) return; @@ -2344,12 +2354,16 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist) */ if(pfr->tot_neighbors >= 128) return; - + pfr->neighbors[pfr->tot_neighbors].index = index; pfr->neighbors[pfr->tot_neighbors].psys = pfr->npsys; pfr->tot_neighbors++; - q = (1.f - sqrtf(squared_dist)/pfr->h) * pfr->massfac; + dist = sqrtf(squared_dist); + q = (1.f - dist/pfr->h) * pfr->massfac; + + add_v3_v3(pfr->flow, npa->state.vel); + pfr->element_size += dist; if(pfr->use_size) q *= npa->size; @@ -2397,6 +2411,8 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa pfr.density = pfr.near_density = 0.f; pfr.h = h; pfr.pa = pa; + pfr.element_size = fluid->radius; + pfr.flow[0] = pfr.flow[1] = pfr.flow[2] = 0.0f; for(i=0; i<10 && psys[i]; i++) { pfr.npsys = psys[i]; @@ -2405,6 +2421,14 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa BLI_bvhtree_range_query(psys[i]->bvhtree, state->co, h, sph_density_accum_cb, &pfr); } + if (pfr.tot_neighbors > 0) { + pfr.element_size /= pfr.tot_neighbors; + mul_v3_fl(pfr.flow, 1.0f / pfr.tot_neighbors); + } else { + pfr.element_size = MAXFLOAT; + } + sphdata->element_size = pfr.element_size; + VECCOPY(sphdata->flow, pfr.flow); pressure = stiffness * (pfr.density - rest_density); near_pressure = stiffness_near_fac * pfr.near_density; @@ -2471,7 +2495,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa madd_v3_v3fl(force, gravity, fluid->buoyancy * (pfr.density-rest_density)); } -static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash){ +static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash, float *element_size, float flow[3]) { ParticleTarget *pt; int i; @@ -2491,6 +2515,7 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d sphdata.gravity = gravity; sphdata.mass = pa_mass; sphdata.eh = springhash; + //sphdata.element_size and sphdata.flow are set in the callback. /* restore previous state and treat gravity & effectors as external acceleration*/ sub_v3_v3v3(effector_acceleration, pa->state.vel, pa->prev_state.vel); @@ -2499,6 +2524,8 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d copy_particle_key(&pa->state, &pa->prev_state, 0); integrate_particle(part, pa, dtime, effector_acceleration, sph_force_cb, &sphdata); + *element_size = sphdata.element_size; + VECCOPY(flow, sphdata.flow); } /************************************************/ @@ -3582,6 +3609,49 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){ root->co[0] = root->co[1] = root->co[2] = 0.0f; } } + +/* Code for an adaptive time step based on the Courant-Friedrichs-Lewy + condition. */ +#define MIN_TIMESTEP 1.0f / 101.0f +/* Tolerance of 1.5 means the last subframe neither favours growing nor + shrinking (e.g if it were 1.3, the last subframe would tend to be too + small). */ +#define TIMESTEP_EXPANSION_TOLERANCE 1.5f + +/* Calculate the speed of the particle relative to the local scale of the + simulation. This should be called once per particle during a simulation + step, after the velocity has been updated. element_size defines the scale of + the simulation, and is typically the distance to neighbourning particles. */ +void update_courant_num(ParticleSimulationData *sim, ParticleData *pa, + float dtime, float element_size, float flow[3]) +{ + float relative_vel[3]; + float speed; + + sub_v3_v3v3(relative_vel, pa->state.vel, flow); + speed = len_v3(relative_vel); + if (sim->courant_num < speed * dtime / element_size) + sim->courant_num = speed * dtime / element_size; +} +/* Update time step size to suit current conditions. */ +float update_timestep(ParticleSystem *psys, ParticleSimulationData *sim, + float t_frac) +{ + if (sim->courant_num == 0.0f) + psys->dt_frac = 1.0f; + else + psys->dt_frac *= (psys->part->courant_target / sim->courant_num); + CLAMP(psys->dt_frac, MIN_TIMESTEP, 1.0f); + + /* Sync with frame end if it's close. */ + if (t_frac == 1.0f) + return psys->dt_frac; + else if (t_frac + (psys->dt_frac * TIMESTEP_EXPANSION_TOLERANCE) >= 1.0f) + return 1.0f - t_frac; + else + return psys->dt_frac; +} + /************************************************/ /* System Core */ /************************************************/ @@ -3597,7 +3667,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) /* frame & time changes */ float dfra, dtime; float birthtime, dietime; - + /* where have we gone in time since last time */ dfra= cfra - psys->cfra; @@ -3735,6 +3805,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) { EdgeHash *springhash = sph_springhash_build(psys); float *gravity = NULL; + float element_size, flow[3]; if(psys_uses_gravity(sim)) gravity = sim->scene->physics_settings.gravity; @@ -3744,13 +3815,17 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) basic_integrate(sim, p, pa->state.time, cfra); /* actual fluids calculations */ - sph_integrate(sim, pa, pa->state.time, gravity, springhash); + sph_integrate(sim, pa, pa->state.time, gravity, springhash, + &element_size, flow); if(sim->colliders) collision_check(sim, p, pa->state.time, cfra); /* SPH particles are not physical particles, just interpolation particles, thus rotation has not a direct sense for them */ basic_rotate(part, pa, pa->state.time, timestep); + + if (part->time_flag & PART_TIME_AUTOSF) + update_courant_num(sim, pa, dtime, element_size, flow); } sph_springs_modify(psys, timestep); @@ -3952,6 +4027,7 @@ static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNU return totpart - oldtotpart; } + /* Calculates the next state for all particles of the system * In particles code most fra-ending are frames, time-ending are fra*timestep (seconds) * 1. Emit particles @@ -4057,23 +4133,39 @@ static void system_step(ParticleSimulationData *sim, float cfra) } if(psys->totpart) { - int dframe, subframe = 0, totframesback = 0, totsubframe = part->subframes+1; - float fraction; - + int dframe, totframesback = 0; + float t_frac, dt_frac; + /* handle negative frame start at the first frame by doing * all the steps before the first frame */ if((int)cfra == startframe && part->sta < startframe) totframesback = (startframe - (int)part->sta); - + + if (!(part->time_flag & PART_TIME_AUTOSF)) { + /* Constant time step */ + psys->dt_frac = 1.0f / (float) (part->subframes + 1); + } else if ((int)cfra == startframe) { + /* Variable time step; use a very conservative value at the start. + * If it doesn't need to be so small, it will quickly grow. */ + psys->dt_frac = 1.0; + } else if (psys->dt_frac < MIN_TIMESTEP) { + psys->dt_frac = MIN_TIMESTEP; + } + for(dframe=-totframesback; dframe<=0; dframe++) { - /* ok now we're all set so let's go */ - for (subframe = 1; subframe <= totsubframe; subframe++) { - fraction = (float)subframe/(float)totsubframe; - dynamics_step(sim, cfra+dframe+fraction - 1.f); - psys->cfra = cfra+dframe+fraction - 1.f; + /* simulate each subframe */ + dt_frac = psys->dt_frac; + for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) { + sim->courant_num = 0.0f; + dynamics_step(sim, cfra+dframe+t_frac - 1.f); + psys->cfra = cfra+dframe+t_frac - 1.f; +#if 0 + printf("%f,%f,%f,%f\n", cfra+dframe+t_frac - 1.f, t_frac, dt_frac, sim->courant_num); +#endif + if (part->time_flag & PART_TIME_AUTOSF) + dt_frac = update_timestep(psys, sim, t_frac); } } - } /* 4. only write cache starting from second frame */ diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a56010a5ccf..fb69db17b97 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2544,7 +2544,8 @@ static void ptcache_dt_to_str(char *str, double dtime) sprintf(str, "%is", ((int)dtime) % 60); } -static void *ptcache_bake_thread(void *ptr) { +static void *ptcache_bake_thread(void *ptr) +{ int usetimer = 0, sfra, efra; double stime, ptime, ctime, fetd; char run[32], cur[32], etd[32]; diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index d0e4832889b..cdf2e39a4dd 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -1,7 +1,4 @@ - -/* property.c june 2000 - * - * ton roosendaal +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -25,7 +22,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): ton roosendaal * * ***** END GPL LICENSE BLOCK ***** */ diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index d529a6d94c9..a75a075dfc1 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -641,6 +641,8 @@ void sca_remove_ob_poin(Object *obt, Object *ob) bMessageActuator *ma; bParentActuator *para; bArmatureActuator *aa; + bSteeringActuator *sta; + sens= obt->sensors.first; while(sens) { @@ -688,6 +690,10 @@ void sca_remove_ob_poin(Object *obt, Object *ob) if (aa->target == ob) aa->target = NULL; if (aa->subtarget == ob) aa->subtarget = NULL; break; + case ACT_STEERING: + sta = act->data; + if (sta->navmesh == ob) sta->navmesh = NULL; + if (sta->target == ob) sta->target = NULL; } act= act->next; } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 628cd3cfe6a..dfbb0f6318a 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1,6 +1,4 @@ -/* scene.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -56,6 +54,7 @@ #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_callbacks.h" #include "BKE_anim.h" #include "BKE_animsys.h" @@ -435,7 +434,7 @@ Scene *add_scene(const char *name) sce->toolsettings->skgen_resolution = 100; sce->toolsettings->skgen_threshold_internal = 0.01f; sce->toolsettings->skgen_threshold_external = 0.01f; - sce->toolsettings->skgen_angle_limit = 45.0f; + sce->toolsettings->skgen_angle_limit = 45.0f; sce->toolsettings->skgen_length_ratio = 1.3f; sce->toolsettings->skgen_length_limit = 1.5f; sce->toolsettings->skgen_correlation_limit = 0.98f; @@ -532,7 +531,7 @@ Scene *add_scene(const char *name) sce->gm.recastData.agentradius = 0.6f; sce->gm.recastData.edgemaxlen = 12.0f; sce->gm.recastData.edgemaxerror = 1.3f; - sce->gm.recastData.regionminsize = 50.f; + sce->gm.recastData.regionminsize = 8.f; sce->gm.recastData.regionmergesize = 20.f; sce->gm.recastData.vertsperpoly = 6; sce->gm.recastData.detailsampledist = 6.0f; @@ -1029,6 +1028,9 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) float ctime = BKE_curframe(sce); Scene *sce_iter; + /* keep this first */ + BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_PRE); + sound_set_cfra(sce->r.cfra); /* clear animation overrides */ @@ -1055,6 +1057,9 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) /* object_handle_update() on all objects, groups and sets */ scene_update_tagged_recursive(bmain, sce, sce); + + /* keep this last */ + BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_POST); } /* return default layer, also used to patch old files */ diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c index 77153fc37ba..77a79a6c8a4 100644 --- a/source/blender/blenkernel/intern/script.c +++ b/source/blender/blenkernel/intern/script.c @@ -1,10 +1,6 @@ -/* blenkernel/script.c - * - * +/* * $Id$ * - * Function(s) related to struct script management. - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 00f88fb6202..88e9d9209d4 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -1,5 +1,5 @@ /* -* $Id$ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index e5d74177c91..d8d6ed6ea6d 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -41,6 +41,7 @@ #include "BLI_math.h" /* windows needs for M_PI */ #include "BLI_utildefines.h" +#include "BLI_string.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -177,7 +178,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) MEM_freeN(info); cp= BLI_dynlib_find_symbol(pis->handle, "seqname"); - if(cp) strncpy(cp, seqname, 21); + if(cp) BLI_strncpy(cp, seqname, 21); } else { printf ("Plugin returned unrecognized version number\n"); return; @@ -203,7 +204,7 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname) pis= MEM_callocN(sizeof(PluginSeq), "PluginSeq"); - strncpy(pis->name, str, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(pis->name, str, FILE_MAX); open_plugin_seq(pis, seqname); if(pis->doit==NULL) { @@ -1638,8 +1639,6 @@ float hyp3,hyp4,b4,b5 if(wipezone->flip) x = xo - x; angle = wipezone->angle; - posy = facf0 * yo; - if(wipe->forward){ posx = facf0 * xo; posy = facf0 * yo; @@ -2319,7 +2318,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height, /* Swap buffers */ - swap=temp;temp=map;map=swap; + swap=temp;temp=map; /* map=swap; */ /* UNUSED */ /* Tidy up */ MEM_freeN (filter); @@ -2489,7 +2488,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height, /* Swap buffers */ - swap=temp;temp=map;map=swap; + swap=temp;temp=map; /* map=swap; */ /* UNUSED */ /* Tidy up */ MEM_freeN (filter); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index a3237da6234..5a2c53f5b9b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1,5 +1,5 @@ /* -* $Id$ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -2852,7 +2852,8 @@ void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_ch left and right are the bounds at which the sequence is rendered, start and end are from the start and fixed length of the sequence. */ -int seq_tx_get_start(Sequence *seq) { +int seq_tx_get_start(Sequence *seq) +{ return seq->start; } int seq_tx_get_end(Sequence *seq) @@ -3653,7 +3654,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo calc_sequence_disp(scene, seq); /* last active name */ - strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR); seq_load_apply(scene, seq, seq_load); diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index 432dc9ec609..a5afc0afda1 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -1,5 +1,4 @@ /* - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 6ab1574ca80..85140841f15 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1,6 +1,4 @@ /* - * smoke.c - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 2960d8a41e5..88f72c33802 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1,5 +1,4 @@ -/* softbody.c - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -1744,12 +1743,12 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], GHash *hash; GHashIterator *ihash; float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3],d_nvect[3], dv1[3],ve[3],avel[3]={0.0,0.0,0.0}, - vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f, - outerforceaccu[3],innerforceaccu[3], - facedist,n_mag,force_mag_norm,minx,miny,minz,maxx,maxy,maxz, - innerfacethickness = -0.5f, outerfacethickness = 0.2f, - ee = 5.0f, ff = 0.1f, fa=1; - int a, deflected=0, cavel=0,ci=0; + vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f, + outerforceaccu[3], innerforceaccu[3], + facedist, /* n_mag, */ /* UNUSED */ force_mag_norm, minx, miny, minz, maxx, maxy, maxz, + innerfacethickness = -0.5f, outerfacethickness = 0.2f, + ee = 5.0f, ff = 0.1f, fa=1; + int a, deflected=0, cavel=0, ci=0; /* init */ *intrusion = 0.0f; hash = vertexowner->soft->scratch->colliderhash; @@ -1869,7 +1868,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], VECSUB(dv1,opco,nv2); /* abuse dv1 to have vertex in question at *origin* of triangle */ cross_v3_v3v3(d_nvect, edge2, edge1); - n_mag = normalize_v3(d_nvect); + /* n_mag = */ /* UNUSED */ normalize_v3(d_nvect); facedist = dot_v3v3(dv1,d_nvect); // so rules are // @@ -1906,7 +1905,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], VECSUB(dv1,opco,nv4); /* abuse dv1 to have vertex in question at *origin* of triangle */ cross_v3_v3v3(d_nvect, edge2, edge1); - n_mag = normalize_v3(d_nvect); + /* n_mag = */ /* UNUSED */ normalize_v3(d_nvect); facedist = dot_v3v3(dv1,d_nvect); if ((facedist > innerfacethickness) && (facedist < outerfacethickness)){ diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 73d0d70778f..f2d92154c66 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -340,20 +340,13 @@ void sound_load(struct Main *bmain, struct bSound* sound) #endif { char fullpath[FILE_MAX]; - char *path; /* load sound */ PackedFile* pf = sound->packedfile; /* dont modify soundact->sound->name, only change a copy */ BLI_strncpy(fullpath, sound->name, sizeof(fullpath)); - - if(sound->id.lib) - path = sound->id.lib->filepath; - else - path = bmain->name; - - BLI_path_abs(fullpath, path); + BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id)); /* but we need a packed file then */ if (pf) diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index 200dbd41899..ae29230423f 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -1,6 +1,4 @@ -/* speaker.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 2c507370288..b5fc76a8551 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1,6 +1,4 @@ -/* text.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -2792,7 +2790,8 @@ int setcurr_tab_spaces (Text *text, int space) /*********************************/ /* Creates and adds a marker to the list maintaining sorted order */ -void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags) { +void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags) +{ TextMarker *tmp, *marker; marker= MEM_mallocN(sizeof(TextMarker), "text_marker"); @@ -2841,7 +2840,8 @@ TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int en /* Clears all markers on the specified line between two points. If the group or flags fields are non-zero the returned flag must be in the specified group and have at least the specified flags set. */ -short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) { +short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) +{ TextMarker *marker, *next; int lineno= txt_get_span(text->lines.first, line); short cleared= 0; @@ -2866,7 +2866,8 @@ short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, in /* Clears all markers in the specified group (if given) with at least the specified flags set. Useful for clearing temporary markers (group=0, flags=TMARK_TEMP) */ -short txt_clear_markers(Text *text, int group, int flags) { +short txt_clear_markers(Text *text, int group, int flags) +{ TextMarker *marker, *next; short cleared= 0; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 38165182d83..d344f79bb6c 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1,6 +1,4 @@ -/* texture.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -640,7 +638,11 @@ void default_mtex(MTex *mtex) mtex->size[1]= 1.0; mtex->size[2]= 1.0; mtex->tex= NULL; - mtex->texflag= MTEX_3TAP_BUMP | MTEX_BUMP_OBJECTSPACE; + + /* MTEX_BUMP_FLIPPED is temporary before 2.61 release to prevent flipping normals + when creating file in 2.60, opening it in 2.59, saving and opening in 2.60 again */ + mtex->texflag= MTEX_3TAP_BUMP | MTEX_BUMP_OBJECTSPACE | MTEX_BUMP_FLIPPED; + mtex->colormodel= 0; mtex->r= 1.0; mtex->g= 0.0; diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index d413177873f..7d278f37cfb 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -1,7 +1,4 @@ - -/* world.c - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 769a3f9b11e..b989d44c391 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -1,7 +1,4 @@ /* - * Functions for writing avi-format files. - * Added interface for generic movie support (ton) - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -28,7 +25,9 @@ * Contributor(s): Robert Wenzlaff * * ***** END GPL LICENSE BLOCK ***** - * + * + * Functions for writing avi-format files. + * Added interface for generic movie support (ton) */ /** \file blender/blenkernel/intern/writeavi.c diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 13875ff19f7..58a2f45e876 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1,6 +1,3 @@ -/** \file blender/blenkernel/intern/writeffmpeg.c - * \ingroup bke - */ /* * $Id$ * @@ -20,6 +17,10 @@ * */ +/** \file blender/blenkernel/intern/writeffmpeg.c + * \ingroup bke + */ + #ifdef WITH_FFMPEG #include <string.h> #include <stdio.h> @@ -489,6 +490,12 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex c->qmax=51; } + // Keep lossless encodes in the RGB domain. + if (codec_id == CODEC_ID_HUFFYUV || codec_id == CODEC_ID_FFV1) { + /* HUFFYUV was PIX_FMT_YUV422P before */ + c->pix_fmt = PIX_FMT_RGB32; + } + if ((of->oformat->flags & AVFMT_GLOBALHEADER) // || !strcmp(of->oformat->name, "mp4") // || !strcmp(of->oformat->name, "mov") @@ -518,8 +525,8 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex return NULL; } - video_buffersize = 2000000; - video_buffer = (uint8_t*)MEM_mallocN(video_buffersize, + video_buffersize = avpicture_get_size(c->pix_fmt, c->width, c->height); + video_buffer = (uint8_t*)MEM_mallocN(video_buffersize*sizeof(uint8_t), "FFMPEG video buffer"); current_frame = alloc_picture(c->pix_fmt, c->width, c->height); @@ -565,6 +572,11 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex return NULL; } + /* need to prevent floating point exception when using vorbis audio codec, + initialize this value in the same way as it's done in FFmpeg iteslf (sergey) */ + st->codec->time_base.num= 1; + st->codec->time_base.den= st->codec->sample_rate; + audio_outbuf_size = FF_MIN_BUFFER_SIZE; if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD)) @@ -737,7 +749,11 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report } } - av_write_header(of); + if (av_write_header(of) < 0) { + BKE_report(reports, RPT_ERROR, "Could not initialize streams. Probably unsupported codec combination."); + return 0; + } + outfile = of; av_dump_format(of, 0, name, 1); @@ -808,7 +824,8 @@ void flush_ffmpeg(void) ********************************************************************** */ /* Get the output filename-- similar to the other output formats */ -void filepath_ffmpeg(char* string, RenderData* rd) { +void filepath_ffmpeg(char* string, RenderData* rd) +{ char autosplit[20]; const char ** exts = get_file_extensions(rd->ffcodecdata.type); diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index d13d15d1269..d42b952617f 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -1,6 +1,3 @@ -/** \file blender/blenkernel/intern/writeframeserver.c - * \ingroup bke - */ /* * $Id$ * @@ -22,6 +19,10 @@ * */ +/** \file blender/blenkernel/intern/writeframeserver.c + * \ingroup bke + */ + #ifdef WITH_FRAMESERVER #include <string.h> @@ -257,7 +258,11 @@ int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports)) struct timeval tv; struct sockaddr_in addr; int len, rval; +#ifdef FREE_WINDOWS + int socklen; +#else unsigned int socklen; +#endif char buf[4096]; if (connsock != -1) { diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index f20cef9c3ea..b490317fdac 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -40,6 +40,8 @@ struct Main; struct ID; typedef enum { + BLI_CB_EVT_FRAME_CHANGE_PRE, + BLI_CB_EVT_FRAME_CHANGE_POST, BLI_CB_EVT_RENDER_PRE, BLI_CB_EVT_RENDER_POST, BLI_CB_EVT_RENDER_STATS, diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 5f31565d65b..cf3605a80ff 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -76,7 +76,8 @@ struct bArgs { int *passes; }; -static unsigned int case_strhash(const void *ptr) { +static unsigned int case_strhash(const void *ptr) +{ const char *s= ptr; unsigned int i= 0; unsigned char c; diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c index 7587a5195a2..e877e985d94 100644 --- a/source/blender/blenlib/intern/BLI_dynstr.c +++ b/source/blender/blenlib/intern/BLI_dynstr.c @@ -70,7 +70,8 @@ struct DynStr { /***/ -DynStr *BLI_dynstr_new(void) { +DynStr *BLI_dynstr_new(void) +{ DynStr *ds= MEM_mallocN(sizeof(*ds), "DynStr"); ds->elems= ds->last= NULL; ds->curlen= 0; @@ -78,7 +79,8 @@ DynStr *BLI_dynstr_new(void) { return ds; } -void BLI_dynstr_append(DynStr *ds, const char *cstr) { +void BLI_dynstr_append(DynStr *ds, const char *cstr) +{ DynStrElem *dse= malloc(sizeof(*dse)); int cstrlen= strlen(cstr); @@ -220,7 +222,8 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...) } } -int BLI_dynstr_get_len(DynStr *ds) { +int BLI_dynstr_get_len(DynStr *ds) +{ return ds->curlen; } diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index eae4f918a67..8e68d42456f 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -350,7 +350,8 @@ static void sort_along_axis(BVHTree *tree, int start, int end, int axis) //after a call to this function you can expect one of: // every node to left of a[n] are smaller or equal to it // every node to the right of a[n] are greater or equal to it -static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis){ +static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis) +{ int begin = _begin, end = _end, cut; while(end-begin > 3) { diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 98d53ca16db..5219b05b65a 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -705,7 +705,8 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) } } -int BLI_bpathIterator_isDone( struct BPathIterator *bpi) { +int BLI_bpathIterator_isDone( struct BPathIterator *bpi) +{ return bpi->type==BPATH_DONE; } @@ -763,7 +764,8 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo } /* high level function */ -void checkMissingFiles(Main *bmain, ReportList *reports) { +void checkMissingFiles(Main *bmain, ReportList *reports) +{ struct BPathIterator *bpi; /* be sure there is low chance of the path being too short */ @@ -782,7 +784,8 @@ void checkMissingFiles(Main *bmain, ReportList *reports) { } /* dont log any errors at the moment, should probably do this */ -void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) { +void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) +{ int tot= 0, changed= 0, failed= 0, linked= 0; struct BPathIterator *bpi; char filepath[FILE_MAX]; @@ -950,7 +953,8 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char } /* high level function - call from fileselector */ -void findMissingFiles(Main *bmain, const char *str) { +void findMissingFiles(Main *bmain, const char *str) +{ struct BPathIterator *bpi; /* be sure there is low chance of the path being too short */ diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 8ad93495f6d..3e18517f3e5 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -64,7 +64,8 @@ double round(double x); /* from python 3.1 floatobject.c * ndigits must be between 0 and 21 */ -double double_round(double x, int ndigits) { +double double_round(double x, int ndigits) +{ double pow1, pow2, y, z; if (ndigits >= 0) { pow1 = pow(10.0, (double)ndigits); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 0b750d5fff3..8adede3337c 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -785,7 +785,8 @@ void BLI_getlastdir(const char* dir, char *last, const size_t maxlen) /* This is now only used to really get the user's default document folder */ /* On Windows I chose the 'Users/<MyUserName>/Documents' since it's used as default location to save documents */ -const char *BLI_getDefaultDocumentFolder(void) { +const char *BLI_getDefaultDocumentFolder(void) +{ #if !defined(WIN32) return getenv("HOME"); @@ -1206,7 +1207,8 @@ void BLI_char_switch(char *string, char from, char to) } } -void BLI_make_exist(char *dir) { +void BLI_make_exist(char *dir) +{ int a; BLI_char_switch(dir, ALTSEP, SEP); @@ -1550,7 +1552,8 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const return 1; } -char *BLI_first_slash(char *string) { +char *BLI_first_slash(char *string) +{ char *ffslash, *fbslash; ffslash= strchr(string, '/'); @@ -1563,7 +1566,8 @@ char *BLI_first_slash(char *string) { else return fbslash; } -char *BLI_last_slash(const char *string) { +char *BLI_last_slash(const char *string) +{ char *lfslash, *lbslash; lfslash= strrchr(string, '/'); @@ -1577,7 +1581,8 @@ char *BLI_last_slash(const char *string) { } /* adds a slash if there isnt one there already */ -int BLI_add_slash(char *string) { +int BLI_add_slash(char *string) +{ int len = strlen(string); #ifdef WIN32 if (len==0 || string[len-1]!='\\') { @@ -1596,7 +1601,8 @@ int BLI_add_slash(char *string) { } /* removes a slash if there is one */ -void BLI_del_slash(char *string) { +void BLI_del_slash(char *string) +{ int len = strlen(string); while (len) { #ifdef WIN32 diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 0613765b868..57008af1812 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -346,7 +346,7 @@ static int map_insert_vert(PBVH *bvh, GHash *map, if(!BLI_ghash_haskey(map, key)) { if(BLI_bitmap_get(bvh->vert_bitmap, vertex)) { - value = SET_INT_IN_POINTER(-(*face_verts) - 1); + value = SET_INT_IN_POINTER(~(*face_verts)); ++(*face_verts); } else { diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 04a6d15a0ea..e336b914ffa 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -469,7 +469,8 @@ int BLI_exist(const char *name) } /* would be better in fileops.c except that it needs stat.h so add here */ -int BLI_is_dir(const char *file) { +int BLI_is_dir(const char *file) +{ return S_ISDIR(BLI_exist(file)); } @@ -478,17 +479,17 @@ LinkNode *BLI_read_file_as_lines(const char *name) FILE *fp= fopen(name, "r"); LinkNode *lines= NULL; char *buf; - int64_t size; + size_t size; if (!fp) return NULL; fseek(fp, 0, SEEK_END); - size= ftell(fp); + size= (size_t)ftell(fp); fseek(fp, 0, SEEK_SET); buf= MEM_mallocN(size, "file_as_lines"); if (buf) { - int i, last= 0; + size_t i, last= 0; /* * size = because on win32 reading diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 8315161aeda..db5d4dc99eb 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -43,14 +43,16 @@ #include "BLI_dynstr.h" #include "BLI_string.h" -char *BLI_strdupn(const char *str, const size_t len) { +char *BLI_strdupn(const char *str, const size_t len) +{ char *n= MEM_mallocN(len+1, "strdup"); memcpy(n, str, len); n[len]= '\0'; return n; } -char *BLI_strdup(const char *str) { +char *BLI_strdup(const char *str) +{ return BLI_strdupn(str, strlen(str)); } @@ -67,7 +69,8 @@ char *BLI_strdupcat(const char *str1, const char *str2) return n; } -char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy) { +char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy) +{ size_t srclen= strlen(src); size_t cpylen= (srclen>(maxncpy-1))?(maxncpy-1):srclen; @@ -87,7 +90,8 @@ size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...) if (n != -1 && n < count) { buffer[n] = '\0'; - } else { + } + else { buffer[count-1] = '\0'; } @@ -280,7 +284,8 @@ char *BLI_strcasestr(const char *s, const char *find) } -int BLI_strcasecmp(const char *s1, const char *s2) { +int BLI_strcasecmp(const char *s1, const char *s2) +{ int i; for (i=0; ; i++) { @@ -299,7 +304,8 @@ int BLI_strcasecmp(const char *s1, const char *s2) { return 0; } -int BLI_strncasecmp(const char *s1, const char *s2, size_t len) { +int BLI_strncasecmp(const char *s1, const char *s2, size_t len) +{ int i; for (i=0; i<len; i++) { diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index f9cd675dd8c..097ad2bcd74 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -218,7 +218,8 @@ static void *tslot_thread_start(void *tslot_p) return tslot->do_thread(tslot->callerdata); } -int BLI_thread_is_main(void) { +int BLI_thread_is_main(void) +{ return pthread_equal(pthread_self(), mainid); } diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 66080ed2a85..3b14abb0bee 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -109,7 +109,7 @@ void RegisterBlendExtension(void) { lresult = RegCreateKeyEx(root, "blendfile", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd); if (lresult == ERROR_SUCCESS) { - sprintf(buffer,"%s","Blender File"); + strcpy(buffer,"Blender File"); lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1); RegCloseKey(hkey); } @@ -301,7 +301,7 @@ char* dirname(char *path) { char *p; if( path == NULL || *path == '\0' ) - return "."; + return "."; p = path + strlen(path) - 1; while( *p == '/' ) { if( p == path ) @@ -309,11 +309,11 @@ char* dirname(char *path) *p-- = '\0'; } while( p >= path && *p != '/' ) - p--; + p--; return - p < path ? "." : - p == path ? "/" : - (*p = '\0', path); + p < path ? "." : + p == path ? "/" : + (*p = '\0', path); } /* End of copied part */ diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 31b3724e9f6..0e93e5fa8c0 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -240,7 +240,8 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) return names; } -void BLO_blendhandle_close(BlendHandle *bh) { +void BLO_blendhandle_close(BlendHandle *bh) +{ FileData *fd= (FileData*) bh; blo_freefiledata(fd); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e5f259e9644..a7234c107da 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -517,7 +517,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat BLI_addtail(mainlist, m); lib= alloc_libblock(&m->library, ID_LI, "lib"); - strncpy(lib->name, filepath, sizeof(lib->name)-1); + BLI_strncpy(lib->name, filepath, sizeof(lib->name)); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); m->curlib= lib; @@ -4496,7 +4496,9 @@ static void lib_link_scene(FileData *fd, Main *main) seq->scene_sound = NULL; if(seq->scene) { seq->scene= newlibadr(fd, sce->id.lib, seq->scene); - seq->scene_sound = sound_scene_add_scene_sound(sce, seq, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); + if(seq->scene) { + seq->scene_sound = sound_scene_add_scene_sound(sce, seq, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); + } } if(seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera); if(seq->sound) { @@ -5628,7 +5630,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) * link into an unsaved blend file. See [#27405]. * The remap relative option will make it relative again on save - campbell */ if (strncmp(lib->name, "//", 2)==0) { - strncpy(lib->name, lib->filepath, sizeof(lib->name)); + BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name)); } } } @@ -5637,7 +5639,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) /* Libraries store both relative and abs paths, recreate relative paths, * relative to the blend file since indirectly linked libs will be relative to their direct linked library */ if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */ - strncpy(lib->name, lib->filepath, sizeof(lib->name)); + BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name)); BLI_path_rel(lib->name, basepath); } } @@ -7247,7 +7249,7 @@ void convert_tface_mt(FileData *fd, Main *main) G.main = main; if(!(do_version_tface(main, 1))) { - BKE_report(fd->reports, RPT_ERROR, "Texface conversion problem. Error in console"); + BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem. Error in console"); } //XXX hack, material.c uses G.main allover the place, instead of main @@ -10174,7 +10176,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->toolsettings->skgen_resolution = 250; sce->toolsettings->skgen_threshold_internal = 0.1f; sce->toolsettings->skgen_threshold_external = 0.1f; - sce->toolsettings->skgen_angle_limit = 30.0f; + sce->toolsettings->skgen_angle_limit = 30.0f; sce->toolsettings->skgen_length_ratio = 1.3f; sce->toolsettings->skgen_length_limit = 1.5f; sce->toolsettings->skgen_correlation_limit = 0.98f; @@ -10573,7 +10575,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma->mode |= MA_TRANSP; } else { - ma->mode |= MA_ZTRANSP; + /* ma->mode |= MA_ZTRANSP; */ /* leave ztransp as is even if its not used [#28113] */ ma->mode &= ~MA_TRANSP; } @@ -11944,7 +11946,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(!mat->mtex[tex_nr]) continue; if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1; } - + + /* weak! material alpha could be animated */ if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){ mat->mode |= MA_TRANSP; mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP); @@ -12252,47 +12255,85 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - /* put compatibility code here until next subversion bump */ + if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)){ + { + /* Adaptive time step for particle systems */ + ParticleSettings *part; + for (part = main->particle.first; part; part = part->id.next) { + part->courant_target = 0.2f; + part->time_flag &= ~PART_TIME_AUTOSF; + } + } - { + { + /* set defaults for obstacle avoidance, recast data */ + Scene *sce; + for(sce = main->scene.first; sce; sce = sce->id.next) + { + if (sce->gm.levelHeight == 0.f) + sce->gm.levelHeight = 2.f; + + if(sce->gm.recastData.cellsize == 0.0f) + sce->gm.recastData.cellsize = 0.3f; + if(sce->gm.recastData.cellheight == 0.0f) + sce->gm.recastData.cellheight = 0.2f; + if(sce->gm.recastData.agentmaxslope == 0.0f) + sce->gm.recastData.agentmaxslope = (float)M_PI/4; + if(sce->gm.recastData.agentmaxclimb == 0.0f) + sce->gm.recastData.agentmaxclimb = 0.9f; + if(sce->gm.recastData.agentheight == 0.0f) + sce->gm.recastData.agentheight = 2.0f; + if(sce->gm.recastData.agentradius == 0.0f) + sce->gm.recastData.agentradius = 0.6f; + if(sce->gm.recastData.edgemaxlen == 0.0f) + sce->gm.recastData.edgemaxlen = 12.0f; + if(sce->gm.recastData.edgemaxerror == 0.0f) + sce->gm.recastData.edgemaxerror = 1.3f; + if(sce->gm.recastData.regionminsize == 0.0f) + sce->gm.recastData.regionminsize = 8.f; + if(sce->gm.recastData.regionmergesize == 0.0f) + sce->gm.recastData.regionmergesize = 20.f; + if(sce->gm.recastData.vertsperpoly<3) + sce->gm.recastData.vertsperpoly = 6; + if(sce->gm.recastData.detailsampledist == 0.0f) + sce->gm.recastData.detailsampledist = 6.0f; + if(sce->gm.recastData.detailsamplemaxerror == 0.0f) + sce->gm.recastData.detailsamplemaxerror = 1.0f; + } + } + + { + /* flip normals */ + Material *ma= main->mat.first; + while(ma) { + int a; + for(a= 0; a<MAX_MTEX; a++) { + MTex *mtex= ma->mtex[a]; + + if(mtex) { + if((mtex->texflag&MTEX_BUMP_FLIPPED)==0) { + if((mtex->mapto&MAP_DISPLACE)==0) { + if((mtex->mapto&MAP_NORM) && mtex->texflag&(MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) { + Tex *tex= newlibadr(fd, lib, mtex->tex); + + if(!tex || (tex->imaflag&TEX_NORMALMAP)==0) { + mtex->norfac= -mtex->norfac; + mtex->texflag|= MTEX_BUMP_FLIPPED; + } + } + } + } + } + } + + ma= ma->id.next; + } + } } - //set defaults for obstacle avoidance, recast data + /* put compatibility code here until next subversion bump */ { - Scene *sce; - for(sce = main->scene.first; sce; sce = sce->id.next) - { - if (sce->gm.levelHeight == 0.f) - sce->gm.levelHeight = 2.f; - - if(sce->gm.recastData.cellsize == 0.0f) - sce->gm.recastData.cellsize = 0.3f; - if(sce->gm.recastData.cellheight == 0.0f) - sce->gm.recastData.cellheight = 0.2f; - if(sce->gm.recastData.agentmaxslope == 0.0f) - sce->gm.recastData.agentmaxslope = M_PI/4; - if(sce->gm.recastData.agentmaxclimb == 0.0f) - sce->gm.recastData.agentmaxclimb = 0.9f; - if(sce->gm.recastData.agentheight == 0.0f) - sce->gm.recastData.agentheight = 2.0f; - if(sce->gm.recastData.agentradius == 0.0f) - sce->gm.recastData.agentradius = 0.6f; - if(sce->gm.recastData.edgemaxlen == 0.0f) - sce->gm.recastData.edgemaxlen = 12.0f; - if(sce->gm.recastData.edgemaxerror == 0.0f) - sce->gm.recastData.edgemaxerror = 1.3f; - if(sce->gm.recastData.regionminsize == 0.0f) - sce->gm.recastData.regionminsize = 50.f; - if(sce->gm.recastData.regionmergesize == 0.0f) - sce->gm.recastData.regionmergesize = 20.f; - if(sce->gm.recastData.vertsperpoly<3) - sce->gm.recastData.vertsperpoly = 6; - if(sce->gm.recastData.detailsampledist == 0.0f) - sce->gm.recastData.detailsampledist = 6.0f; - if(sce->gm.recastData.detailsamplemaxerror == 0.0f) - sce->gm.recastData.detailsamplemaxerror = 1.0f; - } } /* default values in Freestyle settings */ @@ -12445,7 +12486,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) bfd->main->versionfile= fd->fileversion; bfd->type= BLENFILETYPE_BLEND; - strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)-1); + BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)); while(bhead) { switch(bhead->code) { diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index a176b6eb4cd..61f1b1dfa08 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -426,7 +426,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) //sets the rna_path and array index to curve -void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int array_index ) +void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , const char* rna_path , int array_index ) { std::vector<FCurve*>::iterator it; int i; @@ -603,7 +603,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve * fcu = *iter; BLI_addtail(AnimCurves, fcu); - } + } } @@ -621,16 +621,16 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list //all the curves belonging to the current binding std::vector<FCurve*> animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { - animcurves = curve_map[bindings[j].animation]; - - BLI_strncpy(rna_path, anim_type , sizeof(rna_path)); - modify_fcurve(&animcurves, rna_path, 0 ); - std::vector<FCurve*>::iterator iter; - //Add the curves of the current animation to the object - for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { - FCurve * fcu = *iter; - BLI_addtail(AnimCurves, fcu); - } + animcurves = curve_map[bindings[j].animation]; + + BLI_strncpy(rna_path, anim_type , sizeof(rna_path)); + modify_fcurve(&animcurves, rna_path, 0 ); + std::vector<FCurve*>::iterator iter; + //Add the curves of the current animation to the object + for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { + FCurve * fcu = *iter; + BLI_addtail(AnimCurves, fcu); + } } } diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 9e8f7b42069..77587114374 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -164,7 +164,7 @@ public: int setAnimType ( const COLLADAFW::Animatable * prop , int type, int addition); - void modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int array_index ); + void modify_fcurve(std::vector<FCurve*>* curves , const char* rna_path , int array_index ); // prerequisites: // animlist_map - map animlist id -> animlist // curve_map - map anim id -> curve(s) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 2f5d9e54e50..a6757329ea1 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -466,7 +466,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T if (has_normals && mp->getPositionIndices().getCount() != mp->getNormalIndices().getCount()) { fprintf(stderr, "Warning: Number of normals is different from the number of vertcies, skipping normals\n"); - has_normals = false; + has_normals = false; } unsigned int j, k; diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 92af51326a8..450d0ba7341 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3130,7 +3130,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi /* Draw a widget for some setting */ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting) { - short negflag, ptrsize, enabled, butType; + short negflag, ptrsize /* , enabled */ /* UNUSED */, butType; int flag, icon; void *ptr; const char *tooltip; @@ -3139,7 +3139,7 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan /* get the flag and the pointer to that flag */ flag= acf->setting_flag(ac, setting, &negflag); ptr= acf->setting_ptr(ale, setting, &ptrsize); - enabled= ANIM_channel_setting_get(ac, ale, setting); + /* enabled= ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */ /* get the base icon for the setting */ switch (setting) { diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index faeeee21333..b92d587839b 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -370,7 +370,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... + * then the channels under closed expanders get ignored... * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index d2b1fcc4abd..2774bd2cda4 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -71,12 +71,12 @@ void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short if (timecodes) { int hours=0, minutes=0, seconds=0, frames=0; float raw_seconds= cfra; - char neg[2]= ""; + char neg[2]= {'\0'}; /* get cframes */ if (cfra < 0) { /* correction for negative cfraues */ - sprintf(neg, "-"); + neg[0]= '-'; cfra = -cfra; } if (cfra >= 3600) { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 17b88b4e2ac..eafc47dd47d 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -344,6 +344,13 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) * channel can be kept around). No need to clear channels-flag in order to * keep expander channels with no sub-data out, as those cases should get * dealt with by the recursive detection idiom in place. + * + * Implementation Note: + * YES the _doSubChannels variable is NOT read anywhere. BUT, this is NOT an excuse + * to go steamrolling the logic into a single-line expression as from experience, + * those are notoriously difficult to read + debug when extending later on. The code + * below is purposefully laid out so that each case noted above corresponds clearly to + * one case below. */ #define BEGIN_ANIMFILTER_SUBCHANNELS(expanded_check) \ { \ diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 9c43671cdf4..383e0bac796 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -63,9 +63,9 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) return icon; else if ELEM3(NULL, id, fcu, fcu->rna_path) { if (fcu == NULL) - sprintf(name, "<invalid>"); + strcpy(name, "<invalid>"); else if (fcu->rna_path == NULL) - sprintf(name, "<no path>"); + strcpy(name, "<no path>"); else /* id == NULL */ BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index); } diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 77c67fc4af0..d329874e1ba 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -112,7 +112,7 @@ static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v) static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width) { FMod_Generator *data= (FMod_Generator *)fcm->data; - uiLayout *col, *row; + uiLayout /* *col, */ /* UNUSED */ *row; uiBlock *block; uiBut *but; PointerRNA ptr; @@ -121,7 +121,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr); /* basic settings (backdrop + mode selector + some padding) */ - col= uiLayoutColumn(layout, 1); + /* col= uiLayoutColumn(layout, 1); */ /* UNUSED */ block= uiLayoutGetBlock(layout); uiBlockBeginAlign(block); but= uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL); @@ -521,7 +521,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh /* draw settings for limits modifier */ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { - uiLayout *split, *col, *row; + uiLayout *split, *col /* , *row */ /* UNUSED */; PointerRNA ptr; /* init the RNA-pointer */ @@ -529,7 +529,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* row 1: minimum */ { - row= uiLayoutRow(layout, 0); + /* row= uiLayoutRow(layout, 0); */ /* UNUSED */ /* split into 2 columns */ split= uiLayoutSplit(layout, 0.5f, 0); @@ -547,7 +547,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* row 2: maximum */ { - row= uiLayoutRow(layout, 0); + /* row= uiLayoutRow(layout, 0); */ /* UNUSED */ /* split into 2 columns */ split= uiLayoutSplit(layout, 0.5f, 0); diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index fa619e4cf44..af78fe739cc 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -51,6 +51,7 @@ #include "DNA_node_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" +#include "DNA_space_types.h" #include "DNA_world_types.h" #include "BKE_fcurve.h" @@ -386,6 +387,9 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; + /* when not in graph view, don't use handles */ + SpaceIpo *sipo= (ac->spacetype == SPACE_IPO) ? (SpaceIpo *)ac->sl : NULL; + const short use_handle = sipo ? !(sipo->flag & SIPO_NOHANDLES) : FALSE; /* filter animation data */ filter= ANIMFILTER_DATA_VISIBLE; @@ -397,7 +401,7 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) /* make sure keyframes in F-Curve are all in order, and handles are in valid positions */ sort_time_fcurve(fcu); - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* free temp data */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 58e1549c0ed..fb34245d338 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -540,8 +540,8 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) /* get first constraint and determine type of keyframe constraints to check for * - constraints can be on either Objects or PoseChannels, so we only check if the - * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for - * those structs, allowing us to identify the owner of the data + * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for + * those structs, allowing us to identify the owner of the data */ if (ptr->type == &RNA_Object) { /* Object */ @@ -1748,3 +1748,56 @@ short id_frame_has_keyframe (ID *id, float frame, short filter) } /* ************************************************** */ + +int ED_autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks) +{ + /* auto keyframing */ + if (autokeyframe_cfra_can_key(scene, &ob->id)) { + ListBase dsources = {NULL, NULL}; + + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the Object + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); + + return TRUE; + } + else { + return FALSE; + } +} + +int ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks) +{ + if (autokeyframe_cfra_can_key(scene, &ob->id)) { + ListBase dsources = {NULL, NULL}; + + /* now insert the keyframe(s) using the Keying Set + * 1) add datasource override for the PoseChannel + * 2) insert keyframes + * 3) free the extra info + */ + ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); + ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); + BLI_freelistN(&dsources); + + /* clear any unkeyed tags */ + if (pchan->bone) { + pchan->bone->flag &= ~BONE_UNKEYED; + } + + return TRUE; + } + else { + /* add unkeyed tags */ + if (pchan->bone) { + pchan->bone->flag |= BONE_UNKEYED; + } + + return FALSE; + } +} diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b750bd5ef1c..14891826260 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1889,7 +1889,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc) RigEdge *edge; int large_angle = 0; float avg_angle = 0; - float avg_length = 0; + /* float avg_length = 0; */ /* UNUSED */ int nb_edges = 0; @@ -1901,7 +1901,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc) avg_angle /= nb_edges - 1; /* -1 because last edge doesn't have an angle */ - avg_length = iarc->length / nb_edges; + /* avg_length = iarc->length / nb_edges; */ /* UNUSED */ if (nb_edges > 2) @@ -2202,7 +2202,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, float angle_weight = 1.0; // GET FROM CONTEXT float length_weight = 1.0; float distance_weight = 1.0; +#ifndef USE_THREADS float min_cost = FLT_MAX; +#endif float *vec0, *vec1; int *best_positions; int nb_edges = BLI_countlist(&iarc->edges); @@ -2245,7 +2247,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, int nb_positions = earc->bcount; int nb_memo_nodes = nb_positions * nb_positions * (nb_joints + 1); MemoNode *table = MEM_callocN(nb_memo_nodes * sizeof(MemoNode), "memoization table"); +#ifndef USE_THREADS MemoNode *result; +#endif float **positions_cache = MEM_callocN(sizeof(float*) * (nb_positions + 2), "positions cache"); int i; @@ -2260,11 +2264,15 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, positions_cache[i] = bucket->p; } +#ifndef USE_THREADS result = solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight); - min_cost = result->weight; +#else + solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight); +#endif + copyMemoPositions(best_positions, table, earc->bcount, nb_joints); - + MEM_freeN(table); MEM_freeN(positions_cache); } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 8a7d837d2a8..bf2e17c4e87 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -993,7 +993,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) memcpy(&tempstr[index+1], &pld->searchstr[index], 64-index); } else { - strncpy(tempstr, pld->searchstr, 64); + BLI_strncpy(tempstr, pld->searchstr, sizeof(tempstr)); } /* get marker name */ diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 43122ea08d3..61935aa72ca 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1149,7 +1149,10 @@ static int pose_paste_exec (bContext *C, wmOperator *op) bPoseChannel *chan; int flip= RNA_boolean_get(op->ptr, "flipped"); int selOnly= RNA_boolean_get(op->ptr, "selected_mask"); - + + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "LocRotScale"); + /* sanity checks */ if ELEM(NULL, ob, ob->pose) return OPERATOR_CANCELLED; @@ -1166,7 +1169,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op) if (CTX_DATA_COUNT(C, selected_pose_bones) == 0) selOnly = 0; } - + /* Safely merge all of the channels in the buffer pose into any existing pose */ for (chan= g_posebuf->chanbase.first; chan; chan=chan->next) { if (chan->flag & POSE_KEY) { @@ -1175,30 +1178,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op) if (pchan) { /* keyframing tagging for successful paste */ - if (autokeyframe_cfra_can_key(scene, &ob->id)) { - ListBase dsources = {NULL, NULL}; - - /* get KeyingSet to use */ - KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "LocRotScale"); - - /* now insert the keyframe(s) using the Keying Set - * 1) add datasource override for the PoseChannel - * 2) insert keyframes - * 3) free the extra info - */ - ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); - ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); - BLI_freelistN(&dsources); - - /* clear any unkeyed tags */ - if (chan->bone) - chan->bone->flag &= ~BONE_UNKEYED; - } - else { - /* add unkeyed tags */ - if (chan->bone) - chan->bone->flag |= BONE_UNKEYED; - } + ED_autokeyframe_pchan(C, scene, ob, pchan, ks); } } } @@ -2194,29 +2174,8 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op)) if (pchan->rotmode == ROT_MODE_QUAT) { /* quaternions have 720 degree range */ negate_v4(pchan->quat); - - /* tagging */ - if (autokeyframe_cfra_can_key(scene, &ob->id)) { - ListBase dsources = {NULL, NULL}; - - /* now insert the keyframe(s) using the Keying Set - * 1) add datasource override for the PoseChannel - * 2) insert keyframes - * 3) free the extra info - */ - ANIM_relative_keyingset_add_source(&dsources, &ob->id, &RNA_PoseBone, pchan); - ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); - BLI_freelistN(&dsources); - - /* clear any unkeyed tags */ - if (pchan->bone) - pchan->bone->flag &= ~BONE_UNKEYED; - } - else { - /* add unkeyed tags */ - if (pchan->bone) - pchan->bone->flag |= BONE_UNKEYED; - } + + ED_autokeyframe_pchan(C, scene, ob, pchan, ks); } } CTX_DATA_END; diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 04501243acb..78c9e601d87 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -1353,11 +1353,11 @@ static int joinSubgraphsEnds(ReebGraph *rg, float threshold, int nb_subgraphs) if (end_node && start_node) { - ReebArc *start_arc, *end_arc; + ReebArc *start_arc /* , *end_arc */ /* UNUSED */; int merging = 0; start_arc = start_node->arcs[0]; - end_arc = end_node->arcs[0]; + /* end_arc = end_node->arcs[0]; */ /* UNUSED */ if (start_arc->tail == start_node) { diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 91c06e0f125..0a05086a3a4 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6537,8 +6537,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) return nu; } -static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) { - +static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) +{ Object *obedit= CTX_data_edit_object(C); ListBase *editnurb; Nurb *nu; @@ -6607,11 +6607,13 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) return OPERATOR_FINISHED; } -static int curve_prim_add(bContext *C, wmOperator *op, int type) { +static int curve_prim_add(bContext *C, wmOperator *op, int type) +{ return curvesurf_prim_add(C, op, type, 0); } -static int surf_prim_add(bContext *C, wmOperator *op, int type) { +static int surf_prim_add(bContext *C, wmOperator *op, int type) +{ return curvesurf_prim_add(C, op, type, 1); } diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index fcac070f84e..d8257c524c1 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -259,6 +259,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c) static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int recalc, int mode) { + struct Main *bmain= CTX_data_main(C); Curve *cu= obedit->data; EditFont *ef= cu->editfont; cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0]; @@ -269,7 +270,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re if(mode == FO_EDIT) update_string(cu); - BKE_text_to_curve(scene, obedit, mode); + BKE_text_to_curve(bmain, scene, obedit, mode); if(recalc) DAG_id_tag_update(obedit->data, 0); @@ -928,9 +929,10 @@ static int move_cursor(bContext *C, int type, int select) if(select == 0) { if(cu->selstart) { + struct Main *bmain= CTX_data_main(C); cu->selstart = cu->selend = 0; update_string(cu); - BKE_text_to_curve(scene, obedit, FO_SELCHANGE); + BKE_text_to_curve(bmain, scene, obedit, FO_SELCHANGE); } } @@ -1644,13 +1646,14 @@ static int open_cancel(bContext *UNUSED(C), wmOperator *op) static int open_exec(bContext *C, wmOperator *op) { + struct Main *bmain= CTX_data_main(C); VFont *font; PropertyPointerRNA *pprop; PointerRNA idptr; char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); - font= load_vfont(filepath); + font= load_vfont(bmain, filepath); if(!font) { if(op->customdata) MEM_freeN(op->customdata); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index bd95177637a..ab3c754458e 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -428,7 +428,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... + * then the channels under closed expanders get ignored... * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index cda3c4f3e71..8dd543d8f63 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -313,6 +313,11 @@ typedef enum eAnimFilterFlags { ANIMFILTER_KEYS_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */ } eAnimFilterFlags; +/* utility funcs for auto keyframe */ +int ED_autokeyframe_object(struct bContext *C, struct Scene *scene, struct Object *ob, struct KeyingSet *ks); +int ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct KeyingSet *ks); + + #ifdef __cplusplus } #endif diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index f5abebbebd5..a06497889d9 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -34,6 +34,7 @@ #ifndef UI_INTERFACE_H #define UI_INTERFACE_H +#include "BLO_sys_types.h" /* size_t */ #include "RNA_types.h" #include "DNA_userdef_types.h" @@ -576,7 +577,7 @@ void uiButSetFocusOnEnter (struct wmWindow *win, uiBut *but); typedef struct AutoComplete AutoComplete; -AutoComplete *autocomplete_begin(const char *startname, int maxlen); +AutoComplete *autocomplete_begin(const char *startname, size_t maxlen); void autocomplete_do_name(AutoComplete *autocpl, const char *name); void autocomplete_end(AutoComplete *autocpl, char *autoname); @@ -748,6 +749,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C); void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C); void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex); void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C); +void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr); void uiTemplateList(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *activeptr, const char *activeprop, int rows, int maxrows, int type); @@ -786,6 +788,7 @@ void UI_buttons_operatortypes(void); /* Helpers for Operators */ void uiContextActiveProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index); +void uiContextActivePropertyHandle(struct bContext *C); void uiContextAnimUpdate(const struct bContext *C); void uiFileBrowseContextProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); void uiIDContextProperty(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop); diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index b6837a4b3c9..54400accbc2 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -50,8 +50,8 @@ 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 ICON_DEFAULT_HEIGHT_SCALE ((int)(UI_UNIT_Y * 0.8f)) +#define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f)) #define PREVIEW_DEFAULT_HEIGHT 96 diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index cc4c1eaa21c..678be82f160 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -60,7 +60,7 @@ set(SRC ) if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() if(WITH_HEADLESS) diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript index 5998d4d2953..ec5ae99755d 100644 --- a/source/blender/editors/interface/SConscript +++ b/source/blender/editors/interface/SConscript @@ -14,7 +14,7 @@ incs += ' ../../python/' # python button eval defs = [] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 32fe0fb86f9..a816c1612a1 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -96,7 +96,7 @@ static void ui_free_but(const bContext *C, uiBut *but); int UI_translate_iface(void) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE); #else return 0; @@ -105,7 +105,7 @@ int UI_translate_iface(void) int UI_translate_tooltips(void) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_TOOLTIPS); #else return 0; @@ -114,7 +114,7 @@ int UI_translate_tooltips(void) const char *UI_translate_do_iface(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_iface()) return BLF_gettext(msgid); else @@ -126,7 +126,7 @@ const char *UI_translate_do_iface(const char *msgid) const char *UI_translate_do_tooltip(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_tooltips()) return BLF_gettext(msgid); else @@ -678,6 +678,11 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut SWAP(void *, oldbut->func_argN, but->func_argN) } + /* copy hardmin for list rows to prevent 'sticking' highlight to mouse position + when scrolling without moving mouse (see [#28432]) */ + if(ELEM(oldbut->type, ROW, LISTROW)) + oldbut->hardmax= but->hardmax; + ui_but_update_linklines(block, oldbut, but); BLI_remlink(&block->buttons, but); @@ -746,7 +751,7 @@ static int ui_but_is_rna_undo(uiBut *but) * unforseen conciquences, so best check for ID's we _know_ are not * handled by undo - campbell */ ID *id= but->rnapoin.id.data; - if(ELEM(GS(id->name), ID_SCR, ID_WM)) { + if(ID_CHECK_UNDO(id) == FALSE) { return FALSE; } else { @@ -1528,7 +1533,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value) } /* str will be overwritten */ -void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen) +void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) { if(ui_is_but_unit(but)) { UnitSettings *unit= but->block->unit; @@ -1576,7 +1581,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default) } -void ui_get_but_string(uiBut *but, char *str, int maxlen) +void ui_get_but_string(uiBut *but, char *str, size_t maxlen) { if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) { PropertyType type; @@ -2044,7 +2049,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor wm_subwindow_getsize(window, window->screen->mainwin, &getsizex, &getsizey); block->aspect= 2.0/fabs(getsizex*block->winmat[0][0]); - block->auto_open= 2; + block->auto_open= TRUE; block->flag |= UI_BLOCK_LOOP; /* tag as menu */ } @@ -2143,8 +2148,8 @@ void ui_check_but(uiBut *but) UI_GET_BUT_VALUE_INIT(but, value) if(ui_is_but_float(but)) { - if(value == (double) FLT_MAX) sprintf(but->drawstr, "%sinf", but->str); - else if(value == (double) -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str); + if(value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); + else if(value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str); /* support length type buttons */ else if(ui_is_but_unit(but)) { char new_str[sizeof(but->drawstr)]; @@ -2157,7 +2162,7 @@ void ui_check_but(uiBut *but) } } else { - sprintf(but->drawstr, "%s%d", but->str, (int)value); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value); } if(but->rnaprop) { @@ -2176,7 +2181,7 @@ void ui_check_but(uiBut *but) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); } else { - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); } break; @@ -2194,7 +2199,7 @@ void ui_check_but(uiBut *but) break; case KEYEVT: - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); if (but->flag & UI_SELECT) { strcat(but->drawstr, "Press a key"); } @@ -2226,15 +2231,15 @@ void ui_check_but(uiBut *but) strcat(but->drawstr, "Press a key "); } else - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); break; case BUT_TOGDUAL: /* trying to get the dual-icon to left of text... not very nice */ if(but->str[0]) { - strncpy(but->drawstr, " ", UI_MAX_DRAW_STR); - strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2); + BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2); } break; @@ -2242,13 +2247,13 @@ void ui_check_but(uiBut *but) case HSVCIRCLE: break; default: - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); } /* if we are doing text editing, this will override the drawstr */ if(but->editstr) - strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR); /* text clipping moved to widget drawing code itself */ } @@ -2286,7 +2291,7 @@ int ui_but_can_align(uiBut *but) return !ELEM3(but->type, LABEL, OPTION, OPTIONN); } -static void ui_block_do_align_but(uiBut *first, int nr) +static void ui_block_do_align_but(uiBut *first, short nr) { uiBut *prev, *but=NULL, *next; int flag= 0, cols=0, rows=0; @@ -2423,7 +2428,7 @@ static void ui_block_do_align_but(uiBut *first, int nr) void ui_block_do_align(uiBlock *block) { uiBut *but; - int nr; + short nr; /* align buttons with same align nr */ for(but=block->buttons.first; but;) { @@ -2467,7 +2472,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, but->pointype= type & BUTPOIN; but->bit= type & BIT; but->bitnr= type & 31; - but->icon = 0; + but->icon = ICON_NONE; but->iconadd=0; but->retval= retval; @@ -2514,7 +2519,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, but->pos= -1; /* cursor invisible */ if(ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) { /* add a space to name */ - slen= strlen(but->str); + /* slen remains unchanged from previous assignment, ensure this stays true */ if(slen>0 && slen<UI_MAX_NAME_STR-2) { if(but->str[slen-1]!=' ') { but->str[slen]= ' '; @@ -2741,7 +2746,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, if ((!tip || tip[0]=='\0') && ot && ot->description) { tip= ot->description; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_tooltips()) tip= BLF_gettext(tip); #endif @@ -2804,7 +2809,8 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x1, i * otherwise return -1. * (1<<findBitIndex(x))==x for powers of two. */ -static int findBitIndex(unsigned int x) { +static int findBitIndex(unsigned int x) +{ if (!x || (x&(x-1))!=0) { /* x&(x-1) strips lowest bit */ return -1; } else { @@ -2822,12 +2828,12 @@ static int findBitIndex(unsigned int x) { /* autocomplete helper functions */ struct AutoComplete { - int maxlen; + size_t maxlen; char *truncate; const char *startname; }; -AutoComplete *autocomplete_begin(const char *startname, int maxlen) +AutoComplete *autocomplete_begin(const char *startname, size_t maxlen) { AutoComplete *autocpl; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 1113f90a652..c35996701ee 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -83,7 +83,7 @@ void ui_but_anim_flag(uiBut *but, float cfra) } } -int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen) +int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) { FCurve *fcu; ChannelDriver *driver; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index a1275e237c1..a40900fb39b 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_rect.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_colortools.h" @@ -465,6 +466,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w { #ifdef WITH_HEADLESS (void)rect; + (void)but; #else ImBuf *ibuf= (ImBuf *)but->poin; //GLint scissor[4]; @@ -500,7 +502,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w } #if 0 -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static void ui_draw_but_CHARTAB(uiBut *but) { /* XXX 2.50 bad global access */ @@ -670,7 +672,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) } } -#endif // INTERNATIONAL +#endif // WITH_INTERNATIONAL #endif static void draw_scope_end(rctf *rect, GLint *scissor) @@ -835,7 +837,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* draw grid lines here */ for (i=0; i<6; i++) { char str[4]; - sprintf(str,"%-3d",i*20); + BLI_snprintf(str, sizeof(str), "%-3d",i*20); str[3]='\0'; fdrawline(rect.xmin+22, yofs+(i/5.f)*h, rect.xmax+1, yofs+(i/5.f)*h); BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str, sizeof(str)-1); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 125928c136b..6417a6b58dd 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -631,7 +631,7 @@ static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *dat data->applied= 1; } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data) { ui_apply_but_func(C, but); @@ -1023,7 +1023,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case IDPOIN: ui_apply_but_IDPOIN(C, but, data); break; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL case CHARTAB: ui_apply_but_CHARTAB(C, but, data); break; @@ -1113,9 +1113,9 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, if(but->poin==NULL && but->rnapoin.data==NULL); else if(mode=='c') { if(ui_is_but_float(but)) - sprintf(buf, "%f", ui_get_but_val(but)); + BLI_snprintf(buf, sizeof(buf), "%f", ui_get_but_val(but)); else - sprintf(buf, "%d", (int)ui_get_but_val(but)); + BLI_snprintf(buf, sizeof(buf), "%d", (int)ui_get_but_val(but)); WM_clipboard_text_set(buf, 0); } @@ -1136,7 +1136,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, else if(mode=='c') { ui_get_but_vectorf(but, rgb); - sprintf(buf, "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]); + BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]); WM_clipboard_text_set(buf, 0); } @@ -1307,12 +1307,12 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho } /* mouse inside the widget */ else if (x >= startx) { - float aspect= (but->block->aspect); + const float aspect_sqrt= sqrtf(but->block->aspect); but->pos= strlen(origstr)-but->ofs; /* XXX does not take zoom level into account */ - while (startx + aspect*BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) { + while (startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) { if (but->pos <= 0) break; but->pos--; origstr[but->pos+but->ofs] = 0; @@ -1368,144 +1368,125 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc return changed; } -static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump) +static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump, int jump_all) { - char *str; - int len; - - str= data->str; - len= strlen(str); + const char *str= data->str; + const int len= strlen(str); + const int pos_prev= but->pos; + const int has_sel= (but->selend - but->selsta) > 0; - if(direction) { /* right*/ - /* if there's a selection */ - if ((but->selend - but->selsta) > 0) { - /* extend the selection based on the first direction taken */ - if(select) { - if (!data->selextend) { - data->selextend = EXTEND_RIGHT; - } - if (data->selextend == EXTEND_RIGHT) { - but->selend++; - if (but->selend > len) but->selend = len; - } else if (data->selextend == EXTEND_LEFT) { - but->selsta++; - /* if the selection start has gone past the end, - * flip them so they're in sync again */ - if (but->selsta == but->selend) { - but->pos = but->selsta; - data->selextend = EXTEND_RIGHT; - } - } - } else { + /* special case, quit selection and set cursor */ + if (has_sel && !select) { + if (jump_all) { + but->selsta = but->selend= but->pos = direction ? len : 0; + } + else { + if (direction) { but->selsta = but->pos = but->selend; - data->selextend = 0; } - } else { - if(select) { - /* make a selection, starting from the cursor position */ - int tlen; - but->selsta = but->pos; - - but->pos++; - if(but->pos > (tlen= strlen(str))) but->pos= tlen; - - but->selend = but->pos; - } else if(jump) { - /* jump betweenn special characters (/,\,_,-, etc.), + else { + but->pos = but->selend = but->selsta; + } + } + data->selextend = 0; + } + else { + if(direction) { /* right*/ + if(jump) { + /* jump between special characters (/,\,_,-, etc.), * look at function test_special_char() for complete * list of special character, ctr -> */ while(but->pos < len) { but->pos++; - if(test_special_char(str[but->pos])) break; + if(!jump_all && test_special_char(str[but->pos])) break; } - } else { - int tlen; + } + else { but->pos++; - if(but->pos > (tlen= strlen(str))) but->pos= tlen; + if(but->pos > len) but->pos= len; } } - } - else { /* left */ - /* if there's a selection */ - if ((but->selend - but->selsta) > 0) { - /* extend the selection based on the first direction taken */ - if(select) { - if (!data->selextend) { - data->selextend = EXTEND_LEFT; - } - if (data->selextend == EXTEND_LEFT) { - but->selsta--; - if (but->selsta < 0) but->selsta = 0; - } else if (data->selextend == EXTEND_RIGHT) { - but->selend--; - /* if the selection start has gone past the end, - * flip them so they're in sync again */ - if (but->selsta == but->selend) { - but->pos = but->selsta; - data->selextend = EXTEND_LEFT; - } + else { /* left */ + if(jump) { + + /* left only: compensate for index/change in direction */ + if(but->pos > 0) { + but->pos--; } - } else { - but->pos = but->selend = but->selsta; - data->selextend = 0; - } - } else { - if(select) { - /* make a selection, starting from the cursor position */ - but->selend = but->pos; - - but->pos--; - if(but->pos<0) but->pos= 0; - - but->selsta = but->pos; - } else if(jump) { - /* jump betweenn special characters (/,\,_,-, etc.), + + /* jump between special characters (/,\,_,-, etc.), * look at function test_special_char() for complete * list of special character, ctr -> */ while(but->pos > 0){ but->pos--; - if(test_special_char(str[but->pos])) break; + if(!jump_all && test_special_char(str[but->pos])) break; + } + + /* left only: compensate for index/change in direction */ + if((but->pos != 0) && ABS(pos_prev - but->pos) > 1) { + but->pos++; } - } else { + + } + else { if(but->pos>0) but->pos--; } } - } -} -static void ui_textedit_move_end(uiBut *but, uiHandleButtonData *data, int direction, int select) -{ - char *str; - - str= data->str; - if(direction) { /* right */ - if(select) { - but->selsta = but->pos; - but->selend = strlen(str); - data->selextend = EXTEND_RIGHT; - } else { - but->selsta = but->selend = but->pos= strlen(str); - } - } - else { /* left */ if(select) { - but->selend = but->pos; - but->selsta = 0; - data->selextend = EXTEND_LEFT; - } else { - but->selsta = but->selend = but->pos= 0; + /* existing selection */ + if (has_sel) { + + if(data->selextend == 0) { + data->selextend= EXTEND_RIGHT; + } + + if (direction) { + if (data->selextend == EXTEND_RIGHT) { + but->selend= but->pos; + } + else { + but->selsta= but->pos; + } + } + else { + if (data->selextend == EXTEND_LEFT) { + but->selsta= but->pos; + } + else { + but->selend= but->pos; + } + } + + if (but->selend < but->selsta) { + SWAP(short, but->selsta, but->selend); + data->selextend= (data->selextend == EXTEND_RIGHT) ? EXTEND_LEFT : EXTEND_RIGHT; + } + + } /* new selection */ + else { + if (direction) { + data->selextend= EXTEND_RIGHT; + but->selend= but->pos; + but->selsta= pos_prev; + } + else { + data->selextend= EXTEND_LEFT; + but->selend= pos_prev; + but->selsta= but->pos; + } + } } } } -static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, int all) +static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, const int all, const int jump) { - char *str; - int len, x, changed= 0; + char *str= data->str; + const int len= strlen(str); - str= data->str; - len= strlen(str); + int x, changed= 0; if(all) { if(len) changed=1; @@ -1517,9 +1498,24 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio changed= ui_textedit_delete_selection(but, data); } else if(but->pos>=0 && but->pos<len) { + int step; + + if (jump) { + x = but->pos; + step= 0; + while(x < len) { + x++; + step++; + if(test_special_char(str[x])) break; + } + } + else { + step= 1; + } + for(x=but->pos; x<len; x++) - str[x]= str[x+1]; - str[len-1]='\0'; + str[x]= str[x+step]; + str[len-step]='\0'; changed= 1; } } @@ -1529,11 +1525,26 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio changed= ui_textedit_delete_selection(but, data); } else if(but->pos>0) { + int step; + + if (jump) { + x = but->pos; + step= 0; + while(x > 0) { + x--; + step++; + if((step > 1) && test_special_char(str[x])) break; + } + } + else { + step= 1; + } + for(x=but->pos; x<len; x++) - str[x-1]= str[x]; - str[len-1]='\0'; + str[x-step]= str[x]; + str[len-step]='\0'; - but->pos--; + but->pos -= step; changed= 1; } } @@ -1684,7 +1695,7 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) /* not a file?, strip non utf-8 chars */ if(strip) { /* wont happen often so isnt that annoying to keep it here for a while */ - printf("invalid utf8 - stripped chars %d\n", strip); + printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip); } } @@ -1831,11 +1842,11 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } break; case RIGHTARROWKEY: - ui_textedit_move(but, data, 1, event->shift, event->ctrl); + ui_textedit_move(but, data, 1, event->shift, event->ctrl, FALSE); retval= WM_UI_HANDLER_BREAK; break; case LEFTARROWKEY: - ui_textedit_move(but, data, 0, event->shift, event->ctrl); + ui_textedit_move(but, data, 0, event->shift, event->ctrl, FALSE); retval= WM_UI_HANDLER_BREAK; break; case DOWNARROWKEY: @@ -1845,7 +1856,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case ENDKEY: - ui_textedit_move_end(but, data, 1, event->shift); + ui_textedit_move(but, data, 1, event->shift, TRUE, TRUE); retval= WM_UI_HANDLER_BREAK; break; case UPARROWKEY: @@ -1855,7 +1866,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case HOMEKEY: - ui_textedit_move_end(but, data, 0, event->shift); + ui_textedit_move(but, data, 0, event->shift, TRUE, TRUE); retval= WM_UI_HANDLER_BREAK; break; case PADENTER: @@ -1864,12 +1875,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval= WM_UI_HANDLER_BREAK; break; case DELKEY: - changed= ui_textedit_delete(but, data, 1, 0); + changed= ui_textedit_delete(but, data, 1, 0, event->ctrl); retval= WM_UI_HANDLER_BREAK; break; case BACKSPACEKEY: - changed= ui_textedit_delete(but, data, 0, event->shift); + changed= ui_textedit_delete(but, data, 0, event->shift, event->ctrl); retval= WM_UI_HANDLER_BREAK; break; @@ -3924,7 +3935,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand return WM_UI_HANDLER_CONTINUE; } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event)) { /* XXX 2.50 bad global and state access */ @@ -4367,7 +4378,7 @@ static int ui_but_menu(bContext *C, uiBut *but) PointerRNA ptr_props; if(but->rnapoin.data && but->rnaprop) { - sprintf(buf, "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); WM_operator_properties_create(&ptr_props, "WM_OT_doc_view"); RNA_string_set(&ptr_props, "doc_id", buf); @@ -4584,7 +4595,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) case HSVCIRCLE: retval= ui_do_but_HSVCIRCLE(C, block, but, data, event); break; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL case CHARTAB: retval= ui_do_but_CHARTAB(C, block, but, data, event); break; @@ -4681,7 +4692,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y) /* check if the mouse is in the region */ if(!BLI_in_rcti(&ar->winrct, x, y)) { for(block=ar->uiblocks.first; block; block=block->next) - block->auto_open= 0; + block->auto_open= FALSE; return 0; } @@ -4868,8 +4879,8 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s if(data->used_mouse && !data->autoopentimer) { int time; - if(but->block->auto_open==2) time= 1; // test for toolbox - else if((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open) time= 5*U.menuthreshold2; + if(but->block->auto_open==TRUE) time= 1; // test for toolbox + else if((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open==TRUE) time= 5*U.menuthreshold2; else if(U.uiflag & USER_MENUOPENAUTO) time= 5*U.menuthreshold1; else time= -1; @@ -4967,9 +4978,9 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA /* we disable auto_open in the block after a threshold, because we still * want to allow auto opening adjacent menus even if no button is activated * in between going over to the other button, but only for a short while */ - if(type == BUTTON_ACTIVATE_OVER && but->block->auto_open) + if(type == BUTTON_ACTIVATE_OVER && but->block->auto_open==TRUE) if(but->block->auto_open_last+BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer()) - but->block->auto_open= 0; + but->block->auto_open= FALSE; if(type == BUTTON_ACTIVATE_OVER) { data->used_mouse= 1; @@ -5089,19 +5100,16 @@ void ui_button_active_free(const bContext *C, uiBut *but) } } -/* helper function for insert keyframe, reset to default, etc operators */ -void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index) +static uiBut *ui_context_rna_button_active(const bContext *C) { - ARegion *ar= CTX_wm_region(C); + uiBut *rnabut= NULL; - memset(ptr, 0, sizeof(*ptr)); - *prop= NULL; - *index= 0; + ARegion *ar= CTX_wm_region(C); while(ar) { uiBlock *block; uiBut *but, *activebut= NULL; - + /* find active button */ for(block=ar->uiblocks.first; block; block=block->next) { for(but=block->buttons.first; but; but= but->next) { @@ -5115,22 +5123,53 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P if(activebut && activebut->rnapoin.data) { uiHandleButtonData *data= activebut->active; - /* found RNA button */ - *ptr= activebut->rnapoin; - *prop= activebut->rnaprop; - *index= activebut->rnaindex; + rnabut= activebut; /* recurse into opened menu, like colorpicker case */ if(data && data->menu && (ar != data->menu->region)) { ar = data->menu->region; } else { - return; + return rnabut; } } else { /* no active button */ - return; + return rnabut; + } + } + + return rnabut; +} + +/* helper function for insert keyframe, reset to default, etc operators */ +void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index) +{ + uiBut *activebut= ui_context_rna_button_active(C); + + memset(ptr, 0, sizeof(*ptr)); + + if(activebut && activebut->rnapoin.data) { + *ptr= activebut->rnapoin; + *prop= activebut->rnaprop; + *index= activebut->rnaindex; + } + else { + *prop= NULL; + *index= 0; + } +} + +void uiContextActivePropertyHandle(bContext *C) +{ + uiBut *activebut= ui_context_rna_button_active(C); + if(activebut) { + /* TODO, look into a better way to handle the button change + * currently this is mainly so reset defaults works for the + * operator redo panel - campbell */ + uiBlock *block= activebut->block; + if (block->handle_func) { + block->handle_func(C, block->handle_func_arg, 0); } } } @@ -5914,7 +5953,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE); } else { - printf("Error, but->menu_key type: %d\n", but->type); + printf("%s: error, but->menu_key type: %d\n", __func__, but->type); } break; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index c3a0f438fbe..24434465f5f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -752,7 +752,7 @@ int UI_icon_get_width(int icon_id) if (icon==NULL) { if (G.f & G_DEBUG) - printf("UI_icon_get_width: Internal error, no icon for icon ID: %d\n", icon_id); + printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return 0; } @@ -777,7 +777,7 @@ int UI_icon_get_height(int icon_id) if (icon==NULL) { if (G.f & G_DEBUG) - printf("UI_icon_get_height: Internal error, no icon for icon ID: %d\n", icon_id); + printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return 0; } @@ -825,7 +825,7 @@ static void icon_create_rect(struct PreviewImage* prv_img, enum eIconSizes size) if (!prv_img) { if (G.f & G_DEBUG) - printf("Error: requested preview image does not exist"); + printf("%s, error: requested preview image does not exist", __func__); } if (!prv_img->rect[size]) { prv_img->w[size] = render_size; @@ -842,7 +842,7 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, enum eIco { if (!prv_img) { if (G.f & G_DEBUG) - printf("No preview image for this ID: %s\n", id->name); + printf("%s: no preview image for this ID: %s\n", __func__, id->name); return; } @@ -858,7 +858,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), /* sanity check */ if(w<=0 || h<=0 || w>2000 || h>2000) { - printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h); + printf("%s: icons are %i x %i pixels?\n", __func__, w, h); BLI_assert(!"invalid icon size"); return; } @@ -948,19 +948,19 @@ static int get_draw_size(enum eIconSizes size) return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), int is_preview) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview) { Icon *icon = NULL; DrawInfo *di = NULL; IconImage *iimg; - float fdraw_size= UI_DPI_ICON_FAC*draw_size; + float fdraw_size= is_preview ? draw_size : (draw_size * UI_DPI_ICON_FAC); int w, h; icon = BKE_icon_get(icon_id); if (icon==NULL) { if (G.f & G_DEBUG) - printf("icon_draw_mipmap: Internal error, no icon for icon ID: %d\n", icon_id); + printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return; } @@ -1018,9 +1018,9 @@ static void ui_id_icon_render(bContext *C, ID *id, int big) { /* create the rect if necessary */ - icon_set_image(C, id, pi, 0); /* icon size */ + icon_set_image(C, id, pi, ICON_SIZE_ICON); /* icon size */ if (big) - icon_set_image(C, id, pi, 1); /* bigger preview size */ + icon_set_image(C, id, pi, ICON_SIZE_PREVIEW); /* bigger preview size */ pi->changed[0] = 0; } @@ -1030,7 +1030,7 @@ static void ui_id_icon_render(bContext *C, ID *id, int big) static void ui_id_brush_render(bContext *C, ID *id) { PreviewImage *pi = BKE_previewimg_get(id); - int i; + enum eIconSizes i; if(!pi) return; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 72eb869dea0..6fb7677da6e 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -136,19 +136,10 @@ typedef enum { /* for scope resize zone */ #define SCOPE_RESIZE_PAD 9 -typedef struct { - short xim, yim; - unsigned int *rect; - short xofs, yofs; -} uiIconImage; - - typedef struct uiLinkLine { /* only for draw/edit */ struct uiLinkLine *next, *prev; - + struct uiBut *from, *to; short flag, pad; - - struct uiBut *from, *to; } uiLinkLine; typedef struct { @@ -164,10 +155,10 @@ typedef struct { struct uiBut { struct uiBut *next, *prev; - short type, pointype, bit, bitnr, retval, strwidth, ofs, pos, selsta, selend; - short alignnr; int flag; - + short type, pointype, bit, bitnr, retval, strwidth, ofs, pos, selsta, selend, alignnr; + short pad1; + char *str; char strdata[UI_MAX_NAME_STR]; char drawstr[UI_MAX_DRAW_STR]; @@ -282,7 +273,7 @@ struct uiBlock { float minx, miny, maxx, maxy; float aspect; - short alignnr; + int puphash; // popup menu hash for memory uiButHandleFunc func; void *func_arg1; @@ -306,9 +297,12 @@ struct uiBlock { void *drawextra_arg2; int flag; + short alignnr; + char direction; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ - short auto_open; + char auto_open; + char _pad[7]; double auto_open_last; const char *lockstr; @@ -326,15 +320,12 @@ struct uiBlock { ListBase saferct; // uiSafetyRct list uiPopupBlockHandle *handle; // handle - - int puphash; // popup menu hash for memory void *evil_C; // XXX hack for dynamic operator enums + struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. float _hsv[3]; // XXX, only access via ui_block_hsv_get() char color_profile; // color profile for correcting linear colors for display - struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. - }; typedef struct uiSafetyRct { @@ -364,8 +355,8 @@ extern void ui_set_but_vectorf(uiBut *but, float *vec); extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my); -extern void ui_get_but_string(uiBut *but, char *str, int maxlen); -extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen); +extern void ui_get_but_string(uiBut *but, char *str, size_t maxlen); +extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t 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); @@ -400,9 +391,9 @@ struct uiPopupBlockHandle { /* for operator popups */ struct wmOperatorType *optype; - int opcontext; ScrArea *ctx_area; ARegion *ctx_region; + int opcontext; /* return values */ int butretval; @@ -517,7 +508,7 @@ void ui_but_anim_copy_driver(struct bContext *C); void ui_but_anim_paste_driver(struct bContext *C); void ui_but_anim_add_keyingset(struct bContext *C); void ui_but_anim_remove_keyingset(struct bContext *C); -int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen); +int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); int ui_but_anim_expression_set(uiBut *but, const char *str); int ui_but_anim_expression_create(uiBut *but, const char *str); void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3c02f7d4bd2..ba612fc8727 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -639,7 +639,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i if(!name) { name= ot->name; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL name= UI_translate_do_iface(name); #endif } @@ -768,7 +768,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname if(properties) { PointerRNA tptr; - WM_operator_properties_create(&tptr, opname); + WM_operator_properties_create_ptr(&tptr, ot); if(tptr.data) { IDP_FreeProperty(tptr.data); MEM_freeN(tptr.data); @@ -1219,7 +1219,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s #if 0 /* this name is used for a string comparison and can't be modified, TODO */ name_uiprefix_id(name_ui, id); #else - strcpy(name_ui, id->name+2); + BLI_strncpy(name_ui, id->name+2, sizeof(name_ui)); #endif name= BLI_strdup(name_ui); iconid= ui_id_icon_get((bContext*)C, id, 1); @@ -1432,7 +1432,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const if(!name) { name= mt->label; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL name= UI_translate_do_iface(name); #endif } @@ -2432,7 +2432,7 @@ static void ui_item_estimate(uiItem *item) } } -static void ui_item_align(uiLayout *litem, int nr) +static void ui_item_align(uiLayout *litem, short nr) { uiItem *item; uiButtonItem *bitem; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index fd9386dc5ab..081b528d153 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -295,10 +295,28 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) if(RNA_property_reset(&ptr, prop, (all)? -1: index)) { /* perform updates required for this property */ RNA_property_update(C, &ptr, prop); + + /* as if we pressed the button */ + uiContextActivePropertyHandle(C); + success= 1; } } - + + /* Since we dont want to undo _all_ edits to settings, eg window + * edits on the screen or on operator settings. + * it might be better to move undo's inline - campbell */ + if(success) { + ID *id= ptr.id.data; + if(id && ID_CHECK_UNDO(id)) { + /* do nothing, go ahead with undo */ + } + else { + return OPERATOR_CANCELLED; + } + } + /* end hack */ + return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; } @@ -314,7 +332,7 @@ static void UI_OT_reset_default_button(wmOperatorType *ot) ot->exec= reset_default_button_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_UNDO; /* properties */ RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array"); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index ec7456eebdc..c25e7f23c04 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -444,7 +444,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r int pnl_icons; const char *activename= panel->drawname[0]?panel->drawname:panel->panelname; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL activename= UI_translate_do_iface(activename); #endif diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4221f7c30ff..622d50752fa 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -84,7 +84,7 @@ typedef struct MenuEntry { } MenuEntry; typedef struct MenuData { - char *instr; + const char *instr; const char *title; int titleicon; @@ -92,7 +92,7 @@ typedef struct MenuData { int nitems, itemssize; } MenuData; -static MenuData *menudata_new(char *instr) +static MenuData *menudata_new(const char *instr) { MenuData *md= MEM_mallocN(sizeof(*md), "MenuData"); @@ -137,7 +137,7 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico static void menudata_free(MenuData *md) { - MEM_freeN(md->instr); + MEM_freeN((void *)md->instr); if (md->items) MEM_freeN(md->items); MEM_freeN(md); @@ -156,7 +156,7 @@ static void menudata_free(MenuData *md) * @param str String to be parsed. * @retval new menudata structure, free with menudata_free() */ -static MenuData *decompose_menu_string(char *str) +static MenuData *decompose_menu_string(const char *str) { char *instr= BLI_strdup(str); MenuData *md= menudata_new(instr); @@ -174,7 +174,7 @@ static MenuData *decompose_menu_string(char *str) *s= '\0'; s++; } else if (s[1]=='t') { - nitem_is_title= 1; + nitem_is_title= (s != instr); /* check for empty title */ *s= '\0'; s++; @@ -213,11 +213,13 @@ static MenuData *decompose_menu_string(char *str) nicon= 0; } - if (c=='\0') + if (c=='\0') { break; - } else if (!nitem) + } + } else if (!nitem) { nitem= s; - + } + s++; } @@ -230,9 +232,12 @@ void ui_set_name_menu(uiBut *but, int value) int i; md= decompose_menu_string(but->str); - for (i=0; i<md->nitems; i++) - if (md->items[i].retval==value) - strcpy(but->drawstr, md->items[i].str); + for (i=0; i<md->nitems; i++) { + if (md->items[i].retval==value) { + BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr)); + break; + } + } menudata_free(md); } @@ -1611,7 +1616,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a uiBut *bt; MenuData *md; MenuEntry *entry; - char *instr= arg_str; + const char *instr= arg_str; int columns, rows, a, b; uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); @@ -1645,11 +1650,12 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a } /* inconsistent, but menus with labels do not look good flipped */ - for(a=0, b=0; a<md->nitems; a++, b++) { - entry= &md->items[a]; - - if(entry->sepr && entry->str[0]) + entry= md->items; + for(a=0; a<md->nitems; a++, entry++) { + if(entry->sepr && entry->str[0]) { block->flag |= UI_BLOCK_NO_FLIP; + break; + } } /* create items */ @@ -1798,7 +1804,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb) if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart); if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); - sprintf(col, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); + BLI_snprintf(col, sizeof(col), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); strcpy(bt->poin, col); } @@ -1986,10 +1992,10 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* existence of profile means storage is in linear color space, with display correction */ if (block->color_profile == BLI_PR_NONE) { - sprintf(tip, "Value in Display Color Space"); + BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip)); copy_v3_v3(rgb_gamma, rgb); } else { - sprintf(tip, "Value in Linear RGB Color Space"); + BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip)); /* make an sRGB version, for Hex code */ linearrgb_to_srgb_v3_v3(rgb_gamma, rgb); } @@ -2058,7 +2064,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR rgb[3]= 1.0f; } - sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); + BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); @@ -2152,7 +2158,7 @@ static int ui_popup_string_hash(char *str) return hash; } -static int ui_popup_menu_hash(char *str) +static int ui_popup_menu_hash(const char *str) { return BLI_ghashutil_strhash(str); } @@ -2202,8 +2208,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi { uiBlock *block; uiBut *bt; - ScrArea *sa; - ARegion *ar; uiPopupMenu *pup= arg_pup; int offset[2], direction, minwidth, width, height, flip; @@ -2275,10 +2279,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi else { /* for a header menu we set the direction automatic */ if(!pup->slideout && flip) { - sa= CTX_wm_area(C); - ar= CTX_wm_region(C); - + ScrArea *sa= CTX_wm_area(C); if(sa && sa->headertype==HEADERDOWN) { + ARegion *ar= CTX_wm_region(C); if(ar && ar->regiontype == RGN_TYPE_HEADER) { uiBlockSetDirection(block, UI_TOP); uiBlockFlipOrder(block); @@ -2305,7 +2308,6 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut uiStyle *style= UI_GetStyle(); uiPopupBlockHandle *handle; uiPopupMenu *pup; - pup= MEM_callocN(sizeof(uiPopupMenu), "menu dummy"); pup->block= uiBeginBlock(C, NULL, "ui_button_menu_create", UI_EMBOSSP); pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style); @@ -2320,6 +2322,19 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut pup->popup= 1; pup->block->flag |= UI_BLOCK_NO_FLIP; } + /* some enums reversing is strange, currently we have no good way to + * reverse some enum's but not others, so reverse all so the first menu + * items are always close to the mouse cursor */ +#if 0 + else { + /* if this is an rna button then we can assume its an enum + * flipping enums is generally not good since the order can be + * important [#28786] */ + if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) { + pup->block->flag |= UI_BLOCK_NO_FLIP; + } + } +#endif if(str) { /* menu is created from a string */ @@ -2369,7 +2384,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) char titlestr[256]; if(icon) { - sprintf(titlestr, " %s", title); + BLI_snprintf(titlestr, sizeof(titlestr), " %s", title); uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } else { @@ -2467,7 +2482,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...) va_list ap; char titlestr[256]; - sprintf(titlestr, "OK? %%i%d", ICON_QUESTION); + BLI_snprintf(titlestr, sizeof(titlestr), "OK? %%i%d", ICON_QUESTION); va_start(ap, str); vconfirm_opname(C, opname, titlestr, str, ap); @@ -2507,9 +2522,9 @@ void uiPupMenuError(bContext *C, const char *str, ...) char nfmt[256]; char titlestr[256]; - sprintf(titlestr, "Error %%i%d", ICON_ERROR); + BLI_snprintf(titlestr, sizeof(titlestr), "Error %%i%d", ICON_ERROR); - sprintf(nfmt, "%s", str); + BLI_strncpy(nfmt, str, sizeof(nfmt)); va_start(ap, str); vconfirm_opname(C, NULL, titlestr, nfmt, ap); @@ -2556,7 +2571,7 @@ void uiPupMenuInvoke(bContext *C, const char *idname) MenuType *mt= WM_menutype_find(idname, TRUE); if(mt==NULL) { - printf("uiPupMenuInvoke: named menu \"%s\" not found\n", idname); + printf("%s: named menu \"%s\" not found\n", __func__, idname); return; } diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 3a9879384a3..92d02ff3dc2 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -42,6 +42,7 @@ #include "BLI_listbase.h" #include "BLI_rect.h" #include "BLI_string.h" +#include "BLI_utildefines.h" #include "BKE_global.h" @@ -315,14 +316,14 @@ void uiStyleInit(void) font= MEM_callocN(sizeof(uiFont), "ui font"); BLI_addtail(&U.uifonts, font); - strcpy(font->filename, "default"); + BLI_strncpy(font->filename, "default", sizeof(font->filename)); font->uifont_id= UIFONT_DEFAULT; } for(font= U.uifonts.first; font; font= font->next) { if(font->uifont_id==UIFONT_DEFAULT) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL int font_size= datatoc_bfont_ttf_size; unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf; static int last_font_size = 0; @@ -357,7 +358,7 @@ void uiStyleInit(void) if (font->blf_id == -1) { if (G.f & G_DEBUG) - printf("uiStyleInit error, no fonts available\n"); + printf("%s: error, no fonts available\n", __func__); } else { /* ? just for speed to initialize? diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 926378719d5..6102a9fb722 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -412,10 +412,10 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(id->us > 1) { char str[32]; - sprintf(str, "%d", id->us); + BLI_snprintf(str, sizeof(str), "%d", id->us); but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(_("Displays number of users of this data. Click to make a single-user copy"))); + UI_translate_do_tooltip(_("Display 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) || !editable) @@ -724,7 +724,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif block= uiLayoutGetBlock(row); /* VIRTUAL MODIFIER */ // XXX this is not used now, since these cannot be accessed via RNA - sprintf(str, "%s parent deform", md->name); + BLI_snprintf(str, sizeof(str), "%s parent deform", md->name); uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); but = uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Make Real")), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, @@ -959,13 +959,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) cti= constraint_get_typeinfo(con); if (cti == NULL) { /* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ - if (con->type == CONSTRAINT_TYPE_NULL) - strcpy(typestr, "Null"); - else - strcpy(typestr, "Unknown"); + BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? "Null" : "Unknown", sizeof(typestr)); } else - strcpy(typestr, cti->name); + BLI_strncpy(typestr, cti->name, sizeof(typestr)); /* determine whether constraint is proxy protected or not */ if (proxylocked_constraints_owner(ob, pchan)) @@ -1043,7 +1040,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* enabled */ uiBlockSetEmboss(block, UI_EMBOSSN); - uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); + uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF); uiBlockSetEmboss(block, UI_EMBOSS); uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); @@ -2112,7 +2109,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe manode= give_node_material(ma); if(manode) { char str[MAX_ID_NAME + 12]; - sprintf(str, "Node %s", manode->id.name+2); + BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name+2); uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1)); } else if(ma->use_nodes) { @@ -2281,7 +2278,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * uiItemL(row, "", ICON_NONE); /* next/prev button */ - sprintf(str, "%d :", i); + BLI_snprintf(str, sizeof(str), "%d :", i); but= uiDefIconTextButR_prop(block, NUM, 0, 0, str, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, ""); if(i == 0) uiButSetFlag(but, UI_BUT_DISABLED); @@ -2545,3 +2542,61 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); } +/********************************* Keymap *************************************/ + +static void keymap_item_modified(bContext *UNUSED(C), void *kmi_p, void *UNUSED(unused)) +{ + wmKeyMapItem *kmi= (wmKeyMapItem*)kmi_p; + WM_keyconfig_update_tag(NULL, kmi); +} + +static void template_keymap_item_properties(uiLayout *layout, const char *title, PointerRNA *ptr) +{ + uiLayout *flow; + + uiItemS(layout); + + if(title) + uiItemL(layout, title, ICON_NONE); + + flow= uiLayoutColumnFlow(layout, 2, 0); + + RNA_STRUCT_BEGIN(ptr, prop) { + int flag= RNA_property_flag(prop); + + if(flag & PROP_HIDDEN) + continue; + + /* recurse for nested properties */ + if(RNA_property_type(prop) == PROP_POINTER) { + PointerRNA propptr= RNA_property_pointer_get(ptr, prop); + const char *name= RNA_property_ui_name(prop); + + if(propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) { + template_keymap_item_properties(layout, name, &propptr); + continue; + } + } + + /* add property */ + uiItemR(flow, ptr, RNA_property_identifier(prop), 0, NULL, ICON_NONE); + } + RNA_STRUCT_END; +} + +void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr) +{ + PointerRNA propptr= RNA_pointer_get(ptr, "properties"); + + if(propptr.data) { + uiBut *but= uiLayoutGetBlock(layout)->buttons.last; + + template_keymap_item_properties(layout, NULL, &propptr); + + /* attach callbacks to compensate for missing properties update, + we don't know which keymap (item) is being modified there */ + for(; but; but=but->next) + uiButSetFunc(but, keymap_item_modified, ptr->data, NULL); + } +} + diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index a49060eaca2..206ecbad1d0 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -36,6 +36,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BLF_translation.h" @@ -116,7 +117,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind } case PROP_COLLECTION: { char text[256]; - sprintf(text, UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); + BLI_snprintf(text, sizeof(text), UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL); uiButSetFlag(but, UI_BUT_DISABLED); break; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 45829646145..0215cc05d36 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -574,7 +574,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect) /* prepares shade colors */ -static void shadecolors4(char *coltop, char *coldown, const char *color, short shadetop, short shadedown) +static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown) { coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255); @@ -889,7 +889,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect UI_icon_draw_aspect(xs, ys, icon, aspect, alpha); } - if(but->flag & UI_ICON_SUBMENU) { + if((but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP)) { xs= rect->xmax-17; ys= (rect->ymin+rect->ymax- height)/2; @@ -1493,7 +1493,7 @@ void ui_widget_color_init(ThemeUI *tui) /* ************ button callbacks, state ***************** */ -static void widget_state_blend(char *cp, const char *cpstate, const float fac) +static void widget_state_blend(char cp[3], const char cpstate[3], const float fac) { if(fac != 0.0f) { cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 0aaf6fe3bc6..30ae69b71b8 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -785,7 +785,7 @@ static void VIEW2D_OT_zoom_out(wmOperatorType *ot) } /* ********************************************************* */ -/* DRAG-ZOOM OPERATOR */ +/* DRAG-ZOOM OPERATOR */ /* MMB Drag - allows non-uniform scaling by dragging mouse * diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 02a25a2a122..f45f706b892 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -52,4 +52,16 @@ set(SRC mesh_intern.h ) +if(WITH_GAMEENGINE) + add_definitions(-DWITH_GAMEENGINE) + + list(APPEND INC + ../../../../extern/recastnavigation + ) + + list(APPEND SRC + mesh_navmesh.c + ) +endif() + blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index b992ae5f04c..6546a44adeb 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -3,6 +3,8 @@ Import ('env') sources = env.Glob('*.c') +defs = [] + incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader' @@ -15,4 +17,10 @@ if env['OURPLATFORM'] == 'linux': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] -env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), [], libtype=['core'], priority=[45] ) +if env['WITH_BF_GAMEENGINE']: + incs += ' #/extern/recastnavigation' + defs.append('WITH_GAMEENGINE') +else: + sources.remove('mesh_navmesh.c') + +env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), defs, libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 0707b651a9f..b26893bfbea 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -137,7 +137,7 @@ static void EM_select_mirrored(Object *obedit, EditMesh *em, int extend) void EM_automerge(Scene *scene, Object *obedit, int update) { Mesh *me= obedit ? obedit->data : NULL; /* can be NULL */ - int len; + /* int len; */ /* UNUSED */ if ((scene->toolsettings->automerge) && (obedit && obedit->type==OB_MESH && (obedit->mode & OB_MODE_EDIT)) @@ -145,7 +145,7 @@ void EM_automerge(Scene *scene, Object *obedit, int update) EditMesh *em= me->edit_mesh; int totvert= em->totvert, totedge= em->totedge, totface= em->totface; - len = removedoublesflag(em, 1, 1, scene->toolsettings->doublimit); + /* len = */ /* UNUSED */ removedoublesflag(em, 1, 1, scene->toolsettings->doublimit); if (totvert != em->totvert || totedge != em->totedge || totface != em->totface) { if (update) { DAG_id_tag_update(&me->id, 0); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 6c07bb1bac5..7bd9c3ac348 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1591,7 +1591,7 @@ static void fill_quad_single(EditMesh *em, EditFace *efa, struct GHash *gh, int EditEdge *cedge=NULL; EditVert *v[4], **verts; EditFace *hold; - short start=0, end, left, right, vertsize,i; + short start=0, /* end, */ /* UNUSED */ left, right, vertsize,i; v[0] = efa->v1; v[1] = efa->v2; @@ -1613,7 +1613,7 @@ static void fill_quad_single(EditMesh *em, EditFace *efa, struct GHash *gh, int // the array to the correct direction if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);} - end = (start+1)%4; + /* end = (start+1)%4; */ /* UNUSED */ left = (start+2)%4; right = (start+3)%4; @@ -1677,7 +1677,7 @@ static void fill_tri_single(EditMesh *em, EditFace *efa, struct GHash *gh, int n EditEdge *cedge=NULL; EditVert *v[3], **verts; EditFace *hold; - short start=0, end, op, vertsize,i; + short start=0, /* end, */ /* UNUSED */ op, vertsize,i; v[0] = efa->v1; v[1] = efa->v2; @@ -1697,8 +1697,8 @@ static void fill_tri_single(EditMesh *em, EditFace *efa, struct GHash *gh, int n // the array to the correct direction if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);} - end = (start+1)%3; - op = (start+2)%3; + /* end = (start+1)%3; */ /* UNUSED */ + op = (start+2)%3; /* We should have something like this now @@ -1888,7 +1888,7 @@ static void fill_quad_double_adj_fan(EditMesh *em, EditFace *efa, struct GHash * EditEdge *cedge[2]={NULL, NULL}; EditVert *v[4], *op=NULL, **verts[2]; EditFace *hold; - short start=0, start2=0, vertsize,i; + short start=0, start2=0, /* vertsize, */ /* UNUSED */ i; v[0] = efa->v1; v[1] = efa->v2; @@ -1905,7 +1905,7 @@ static void fill_quad_double_adj_fan(EditMesh *em, EditFace *efa, struct GHash * verts[0] = BLI_ghash_lookup(gh, cedge[0]); verts[1] = BLI_ghash_lookup(gh, cedge[1]); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -1952,7 +1952,7 @@ static void fill_quad_double_adj_inner(EditMesh *em, EditFace *efa, struct GHash EditEdge *cedge[2]={NULL, NULL}; EditVert *v[4], *op=NULL, **verts[2],**inner; EditFace *hold; - short start=0, start2=0, vertsize,i; + short start=0, start2=0, /* vertsize, */ /* UNUSED */ i; float co[3]; v[0] = efa->v1; @@ -1970,7 +1970,7 @@ static void fill_quad_double_adj_inner(EditMesh *em, EditFace *efa, struct GHash verts[0] = BLI_ghash_lookup(gh, cedge[0]); verts[1] = BLI_ghash_lookup(gh, cedge[1]); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -2297,7 +2297,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i EditVert **verts[4], ***innerverts; EditFace *hold; EditEdge temp; - short vertsize, i, j; + short /* vertsize, */ /* UNUSED */ i, j; // Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1] verts[0] = BLI_ghash_lookup(gh, efa->e1); @@ -2306,7 +2306,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i verts[3] = BLI_ghash_lookup(gh, efa->e4); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -2392,7 +2392,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty) { EditVert **verts[3], ***innerverts; - short vertsize, i, j; + short /* vertsize, */ /* UNUSED */ i, j; EditFace *hold; EditEdge temp; @@ -2402,7 +2402,7 @@ static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int n verts[2] = BLI_ghash_lookup(gh, efa->e3); //This is the index size of the verts array - vertsize = numcuts+2; + /* vertsize = numcuts+2; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -2547,7 +2547,7 @@ static void fill_quad_singlevert(EditMesh *em, EditFace *efa, struct GHash *gh) EditEdge *cedge=NULL; EditVert *v[4], **verts; EditFace *hold; - short start=0, end, left, right, vertsize; + short start=0, end, left, right /* , vertsize */ /* UNUSED */; v[0] = efa->v1; v[1] = efa->v2; @@ -2562,7 +2562,7 @@ static void fill_quad_singlevert(EditMesh *em, EditFace *efa, struct GHash *gh) // Point verts to the array of new verts for cedge verts = BLI_ghash_lookup(gh, cedge); //This is the index size of the verts array - vertsize = 3; + /* vertsize = 3; */ /* UNUSED */ // Is the original v1 the same as the first vert on the selected edge? // if not, the edge is running the opposite direction in this face so flip @@ -3629,7 +3629,7 @@ static const EnumPropertyItem axis_items_xy[]= { static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) { EditVert **verts[2]; - EditFace *face[2], *efa, *newFace[2]; + EditFace *face[2], *efa /* , *newFace[2] */ /* UNUSED */; EditEdge **edges[2], **hiddenedges, *srchedge; int facecount, p1, p2, p3, p4, fac1, fac2, i, j; int numhidden, numshared, p[2][4]; @@ -3720,16 +3720,16 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) if(fac1 == 3 && fac2 == 3) { /* no need of reverse setup */ - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); } else if(fac1 == 4 && fac2 == 3) { if(dir == DIRECTION_CCW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); } else if (dir == DIRECTION_CW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1); verts[0][p[0][2]]->f |= SELECT; verts[1][p[1][1]]->f |= SELECT; @@ -3737,11 +3737,11 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) } else if(fac1 == 3 && fac2 == 4) { if(dir == DIRECTION_CCW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); } else if (dir == DIRECTION_CW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]); verts[0][p[0][1]]->f |= SELECT; verts[1][p[1][2]]->f |= SELECT; @@ -3750,11 +3750,11 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) } else if(fac1 == 4 && fac2 == 4) { if(dir == DIRECTION_CCW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); } else if (dir == DIRECTION_CW) { - newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]); - newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]); + /* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]); + /* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]); verts[0][p[0][2]]->f |= SELECT; verts[1][p[1][2]]->f |= SELECT; diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 0a4ab3c399f..18e6de16dac 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -40,6 +40,7 @@ struct bContext; struct wmOperatorType; struct wmOperator; +struct ViewContext; /* ******************** editface.c */ @@ -64,7 +65,7 @@ extern struct EditEdge *addedgelist(EditMesh *em, struct EditVert *v1, struct Ed extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges); extern struct EditEdge *findedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2); -void em_setup_viewcontext(struct bContext *C, ViewContext *vc); +void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc); void MESH_OT_separate(struct wmOperatorType *ot); @@ -170,7 +171,7 @@ void MESH_OT_solidify(struct wmOperatorType *ot); void MESH_OT_select_nth(struct wmOperatorType *ot); -extern EditEdge *findnearestedge(ViewContext *vc, int *dist); +extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist); void editmesh_select_by_material(EditMesh *em, int index); void EM_recalc_normal_direction(EditMesh *em, int inside, int select); /* makes faces righthand turning */ void EM_select_more(EditMesh *em); @@ -186,7 +187,7 @@ void faceloop_select(EditMesh *em, EditEdge *startedge, int select); * if 0, unselected vertice are given the bias * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased */ -extern EditVert *findnearestvert(ViewContext *vc, int *dist, short sel, short strict); +extern EditVert *findnearestvert(struct ViewContext *vc, int *dist, short sel, short strict); /* ******************* editmesh_tools.c */ @@ -258,5 +259,12 @@ void MESH_OT_drop_named_image(struct wmOperatorType *ot); void MESH_OT_edgering_select(struct wmOperatorType *ot); void MESH_OT_loopcut(struct wmOperatorType *ot); +/* ******************* mesh_navmesh.c */ +void MESH_OT_navmesh_make(struct wmOperatorType *ot); +void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot); +void MESH_OT_navmesh_face_add(struct wmOperatorType *ot); +void MESH_OT_navmesh_reset(struct wmOperatorType *ot); +void MESH_OT_navmesh_clear(struct wmOperatorType *ot); + #endif // MESH_INTERN_H diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c new file mode 100644 index 00000000000..4ae1cdeed02 --- /dev/null +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -0,0 +1,679 @@ +/** +* $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. +* +* The Original Code is Copyright (C) 2011 by Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Benoit Bolsee, +* Nick Samarin +* +* ***** END GPL LICENSE BLOCK ***** +*/ + +#include <math.h> + +#include "MEM_guardedalloc.h" + +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" +#include "DNA_modifier_types.h" +#include "DNA_ID.h" + +#include "BKE_library.h" +#include "BKE_depsgraph.h" +#include "BKE_context.h" +#include "BKE_main.h" +#include "BKE_mesh.h" +#include "BKE_modifier.h" +#include "BKE_scene.h" +#include "BKE_DerivedMesh.h" +#include "BKE_cdderivedmesh.h" +#include "BKE_report.h" + +#include "BLI_editVert.h" +#include "BLI_listbase.h" +#include "BLI_utildefines.h" +#include "BLI_math_vector.h" + +#include "ED_object.h" +#include "ED_mesh.h" +#include "ED_screen.h" + +#include "RNA_access.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "mesh_intern.h" +#include "recast-capi.h" + +static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r) +{ + MVert *mvert; + int nfaces= 0, *tri, i, curnverts, basenverts, curnfaces; + MFace *mface; + float co[3], wco[3]; + Object *ob; + LinkNode *oblink, *dmlink; + DerivedMesh *dm; + Scene* scene= CTX_data_scene(C); + LinkNode* dms= NULL; + + int nverts, ntris, *tris; + float *verts; + + nverts= 0; + ntris= 0; + + /* calculate number of verts and tris */ + for(oblink= obs; oblink; oblink= oblink->next) { + ob= (Object*) oblink->link; + dm= mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH); + BLI_linklist_append(&dms, (void*)dm); + + nverts+= dm->getNumVerts(dm); + nfaces= dm->getNumFaces(dm); + ntris+= nfaces; + + /* resolve quad faces */ + mface= dm->getFaceArray(dm); + for(i= 0; i<nfaces; i++) { + MFace* mf= &mface[i]; + if(mf->v4) + ntris+=1; + } + } + + /* create data */ + verts= MEM_mallocN(sizeof(float)*3*nverts, "createVertsTrisData verts"); + tris= MEM_mallocN(sizeof(int)*3*ntris, "createVertsTrisData faces"); + + basenverts= 0; + tri= tris; + for(oblink= obs, dmlink= dms; oblink && dmlink; + oblink= oblink->next, dmlink= dmlink->next) { + ob= (Object*) oblink->link; + dm= (DerivedMesh*) dmlink->link; + + curnverts= dm->getNumVerts(dm); + mvert= dm->getVertArray(dm); + + /* copy verts */ + for(i= 0; i<curnverts; i++) { + MVert *v= &mvert[i]; + + copy_v3_v3(co, v->co); + mul_v3_m4v3(wco, ob->obmat, co); + + verts[3*(basenverts+i)+0]= wco[0]; + verts[3*(basenverts+i)+1]= wco[2]; + verts[3*(basenverts+i)+2]= wco[1]; + } + + /* create tris */ + curnfaces= dm->getNumFaces(dm); + mface= dm->getFaceArray(dm); + + for(i= 0; i<curnfaces; i++) { + MFace* mf= &mface[i]; + + tri[0]= basenverts + mf->v1; + tri[1]= basenverts + mf->v3; + tri[2]= basenverts + mf->v2; + tri += 3; + + if(mf->v4) { + tri[0]= basenverts + mf->v1; + tri[1]= basenverts + mf->v4; + tri[2]= basenverts + mf->v3; + tri += 3; + } + } + + basenverts+= curnverts; + } + + /* release derived mesh */ + for(dmlink= dms; dmlink; dmlink= dmlink->next) { + dm= (DerivedMesh*) dmlink->link; + dm->release(dm); + } + + BLI_linklist_free(dms, NULL); + + *nverts_r= nverts; + *verts_r= verts; + *ntris_r= ntris; + *tris_r= tris; +} + +static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris, + struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh) +{ + float bmin[3], bmax[3]; + struct recast_heightfield *solid; + unsigned char *triflags; + struct recast_compactHeightfield* chf; + struct recast_contourSet *cset; + int width, height, walkableHeight, walkableClimb, walkableRadius; + int minRegionArea, mergeRegionArea, maxEdgeLen; + float detailSampleDist, detailSampleMaxError; + + recast_calcBounds(verts, nverts, bmin, bmax); + + /* ** Step 1. Initialize build config ** */ + walkableHeight= (int)ceilf(recastParams->agentheight/ recastParams->cellheight); + walkableClimb= (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); + walkableRadius= (int)ceilf(recastParams->agentradius / recastParams->cellsize); + minRegionArea= (int)(recastParams->regionminsize * recastParams->regionminsize); + mergeRegionArea= (int)(recastParams->regionmergesize * recastParams->regionmergesize); + maxEdgeLen= (int)(recastParams->edgemaxlen/recastParams->cellsize); + detailSampleDist= recastParams->detailsampledist< 0.9f ? 0 : + recastParams->cellsize * recastParams->detailsampledist; + detailSampleMaxError= recastParams->cellheight * recastParams->detailsamplemaxerror; + + /* Set the area where the navigation will be build. */ + recast_calcGridSize(bmin, bmax, recastParams->cellsize, &width, &height); + + /* ** Step 2: Rasterize input polygon soup ** */ + /* Allocate voxel heightfield where we rasterize our input data to */ + solid= recast_newHeightfield(); + + if(!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) { + recast_destroyHeightfield(solid); + + return 0; + } + + /* Allocate array that can hold triangle flags */ + triflags= MEM_callocN(sizeof(unsigned char)*ntris, "buildNavMesh triflags"); + + /* Find triangles which are walkable based on their slope and rasterize them */ + recast_markWalkableTriangles(RAD2DEG(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags); + recast_rasterizeTriangles(verts, nverts, tris, triflags, ntris, solid); + MEM_freeN(triflags); + + /* ** Step 3: Filter walkables surfaces ** */ + recast_filterLowHangingWalkableObstacles(walkableClimb, solid); + recast_filterLedgeSpans(walkableHeight, walkableClimb, solid); + recast_filterWalkableLowHeightSpans(walkableHeight, solid); + + /* ** Step 4: Partition walkable surface to simple regions ** */ + + chf= recast_newCompactHeightfield(); + if(!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) { + recast_destroyHeightfield(solid); + recast_destroyCompactHeightfield(chf); + + return 0; + } + + recast_destroyHeightfield(solid); + solid = NULL; + + if (!recast_erodeWalkableArea(walkableRadius, chf)) { + recast_destroyCompactHeightfield(chf); + + return 0; + } + + /* Prepare for region partitioning, by calculating distance field along the walkable surface */ + if(!recast_buildDistanceField(chf)) { + recast_destroyCompactHeightfield(chf); + + return 0; + } + + /* Partition the walkable surface into simple regions without holes */ + if(!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) { + recast_destroyCompactHeightfield(chf); + + return 0; + } + + /* ** Step 5: Trace and simplify region contours ** */ + /* Create contours */ + cset= recast_newContourSet(); + + if(!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) { + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + + return 0; + } + + /* ** Step 6: Build polygons mesh from contours ** */ + *pmesh= recast_newPolyMesh(); + if(!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) { + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + recast_destroyPolyMesh(*pmesh); + + return 0; + } + + + /* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */ + + *dmesh= recast_newPolyMeshDetail(); + if(!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) { + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + recast_destroyPolyMesh(*pmesh); + recast_destroyPolyMeshDetail(*dmesh); + + return 0; + } + + recast_destroyCompactHeightfield(chf); + recast_destroyContourSet(cset); + + return 1; +} + +static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base* base) +{ + float co[3], rot[3]; + EditMesh *em; + int i,j, k; + unsigned short* v; + int face[3]; + Scene *scene= CTX_data_scene(C); + Object* obedit; + int createob= base==NULL; + int nverts, nmeshes, nvp; + unsigned short *verts, *polys; + unsigned int *meshes; + float bmin[3], cs, ch, *dverts; + unsigned char *tris; + + zero_v3(co); + zero_v3(rot); + + if(createob) { + /* create new object */ + obedit= ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); + } + else { + obedit= base->object; + scene_select_base(scene, base); + copy_v3_v3(obedit->loc, co); + copy_v3_v3(obedit->rot, rot); + } + + ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); + em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); + + if(!createob) { + /* clear */ + if(em->verts.first) free_vertlist(em, &em->verts); + if(em->edges.first) free_edgelist(em, &em->edges); + if(em->faces.first) free_facelist(em, &em->faces); + if(em->selected.first) BLI_freelistN(&(em->selected)); + } + + /* create verts for polygon mesh */ + verts= recast_polyMeshGetVerts(pmesh, &nverts); + recast_polyMeshGetBoundbox(pmesh, bmin, NULL); + recast_polyMeshGetCell(pmesh, &cs, &ch); + + for(i= 0; i<nverts; i++) { + v= &verts[3*i]; + co[0]= bmin[0] + v[0]*cs; + co[1]= bmin[1] + v[1]*ch; + co[2]= bmin[2] + v[2]*cs; + SWAP(float, co[1], co[2]); + addvertlist(em, co, NULL); + } + + /* create custom data layer to save polygon idx */ + CustomData_add_layer_named(&em->fdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData"); + + /* create verts and faces for detailed mesh */ + meshes= recast_polyMeshDetailGetMeshes(dmesh, &nmeshes); + polys= recast_polyMeshGetPolys(pmesh, NULL, &nvp); + dverts= recast_polyMeshDetailGetVerts(dmesh, NULL); + tris= recast_polyMeshDetailGetTris(dmesh, NULL); + + for(i= 0; i<nmeshes; i++) { + int uniquevbase= em->totvert; + unsigned int vbase= meshes[4*i+0]; + unsigned short ndv= meshes[4*i+1]; + unsigned short tribase= meshes[4*i+2]; + unsigned short trinum= meshes[4*i+3]; + const unsigned short* p= &polys[i*nvp*2]; + int nv= 0; + + for(j= 0; j < nvp; ++j) { + if(p[j]==0xffff) break; + nv++; + } + + /* create unique verts */ + for(j= nv; j<ndv; j++) { + copy_v3_v3(co, &dverts[3*(vbase + j)]); + SWAP(float, co[1], co[2]); + addvertlist(em, co, NULL); + } + + EM_init_index_arrays(em, 1, 0, 0); + + /* create faces */ + for(j= 0; j<trinum; j++) { + unsigned char* tri= &tris[4*(tribase+j)]; + EditFace* newFace; + int* polygonIdx; + + for(k= 0; k<3; k++) { + if(tri[k]<nv) + face[k]= p[tri[k]]; /* shared vertex */ + else + face[k]= uniquevbase+tri[k]-nv; /* unique vertex */ + } + newFace= addfacelist(em, EM_get_vert_for_index(face[0]), EM_get_vert_for_index(face[2]), + EM_get_vert_for_index(face[1]), NULL, NULL, NULL); + + /* set navigation polygon idx to the custom layer */ + polygonIdx= (int*)CustomData_em_get(&em->fdata, newFace->data, CD_RECAST); + *polygonIdx= i+1; /* add 1 to avoid zero idx */ + } + + EM_free_index_arrays(); + } + + recast_destroyPolyMesh(pmesh); + recast_destroyPolyMeshDetail(dmesh); + + BKE_mesh_end_editmesh((Mesh*)obedit->data, em); + + DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + + + ED_object_exit_editmode(C, EM_FREEDATA); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit); + + if(createob) { + obedit->gameflag&= ~OB_COLLISION; + obedit->gameflag|= OB_NAVMESH; + obedit->body_type= OB_BODY_TYPE_NAVMESH; + rename_id((ID *)obedit, "Navmesh"); + } + + BKE_mesh_ensure_navmesh(obedit->data); + + return obedit; +} + +static int create_navmesh_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene* scene= CTX_data_scene(C); + int nverts= 0, ntris= 0; + float *verts= NULL; + int *tris= 0; + struct recast_polyMesh *pmesh= NULL; + struct recast_polyMeshDetail *dmesh= NULL; + LinkNode* obs= NULL; + Base* navmeshBase= NULL; + + CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { + if(base->object->body_type==OB_BODY_TYPE_NAVMESH) { + if(!navmeshBase || base == scene->basact) + navmeshBase= base; + } + else + BLI_linklist_append(&obs, (void*)base->object); + } + CTX_DATA_END; + + createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris); + BLI_linklist_free(obs, NULL); + buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh); + createRepresentation(C, pmesh, dmesh, navmeshBase); + + MEM_freeN(verts); + MEM_freeN(tris); + + return OPERATOR_FINISHED; +} + +void MESH_OT_navmesh_make(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Create navigation mesh"; + ot->description= "Create navigation mesh for selected objects"; + ot->idname= "MESH_OT_navmesh_make"; + + /* api callbacks */ + ot->exec= create_navmesh_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int navmesh_face_copy_exec(bContext *C, wmOperator *op) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + + /* do work here */ + EditFace *efa_act= EM_get_actFace(em, 0); + + if(efa_act) { + if(CustomData_has_layer(&em->fdata, CD_RECAST)) { + EditFace *efa; + int targetPolyIdx= *(int*)CustomData_em_get(&em->fdata, efa_act->data, CD_RECAST); + targetPolyIdx= targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx; + + if(targetPolyIdx > 0) { + /* set target poly idx to other selected faces */ + for (efa= (EditFace *)em->faces.first; efa; efa= efa->next) { + if((efa->f & SELECT) && efa != efa_act) { + int* recastDataBlock= (int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST); + *recastDataBlock= targetPolyIdx; + } + } + } + else { + BKE_report(op->reports, RPT_ERROR, "Active face has no index set"); + } + } + } + + DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + + BKE_mesh_end_editmesh((Mesh*)obedit->data, em); + + return OPERATOR_FINISHED; +} + +void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "NavMesh Copy Face Index"; + ot->description= "Copy the index from the active face"; + ot->idname= "MESH_OT_navmesh_face_copy"; + + /* api callbacks */ + ot->poll= ED_operator_editmesh; + ot->exec= navmesh_face_copy_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int compare(const void * a, const void * b){ + return ( *(int*)a - *(int*)b ); +} + +static int findFreeNavPolyIndex(EditMesh* em) +{ + /* construct vector of indices */ + int numfaces= em->totface; + int* indices= MEM_callocN(sizeof(int)*numfaces, "findFreeNavPolyIndex(indices)"); + EditFace* ef= (EditFace*)em->faces.last; + int i, idx= 0, freeIdx= 1; + + while(ef) { + int polyIdx= *(int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); + indices[idx]= polyIdx; + idx++; + ef= ef->prev; + } + + qsort(indices, numfaces, sizeof(int), compare); + + /* search first free index */ + freeIdx= 1; + for(i= 0; i<numfaces; i++) { + if(indices[i]==freeIdx) + freeIdx++; + else if(indices[i]>freeIdx) + break; + } + + MEM_freeN(indices); + + return freeIdx; +} + +static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + EditFace *ef; + + if(CustomData_has_layer(&em->fdata, CD_RECAST)) { + int targetPolyIdx= findFreeNavPolyIndex(em); + + if(targetPolyIdx>0) { + /* set target poly idx to selected faces */ + ef= (EditFace*)em->faces.last; + while(ef) { + if(ef->f & SELECT) { + int *recastDataBlock= (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); + *recastDataBlock= targetPolyIdx; + } + ef= ef->prev; + } + } + } + + DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + + BKE_mesh_end_editmesh((Mesh*)obedit->data, em); + return OPERATOR_FINISHED; +} + +void MESH_OT_navmesh_face_add(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "NavMesh New Face Index"; + ot->description= "Add a new index and assign it to selected faces"; + ot->idname= "MESH_OT_navmesh_face_add"; + + /* api callbacks */ + ot->poll= ED_operator_editmesh; + ot->exec= navmesh_face_add_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int navmesh_obmode_data_poll(bContext *C) +{ + Object *ob = ED_object_active_context(C); + if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) { + Mesh *me= ob->data; + return CustomData_has_layer(&me->fdata, CD_RECAST); + } + return FALSE; +} + +static int navmesh_obmode_poll(bContext *C) +{ + Object *ob = ED_object_active_context(C); + if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) { + return TRUE; + } + return FALSE; +} + +static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *ob = ED_object_active_context(C); + Mesh *me= ob->data; + + CustomData_free_layers(&me->fdata, CD_RECAST, me->totface); + + BKE_mesh_ensure_navmesh(me); + + DAG_id_tag_update(&me->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, &me->id); + + return OPERATOR_FINISHED; +} + +void MESH_OT_navmesh_reset(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "NavMesh Reset Index Values"; + ot->description= "Assign a new index to every face"; + ot->idname= "MESH_OT_navmesh_reset"; + + /* api callbacks */ + ot->poll= navmesh_obmode_poll; + ot->exec= navmesh_reset_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *ob = ED_object_active_context(C); + Mesh *me= ob->data; + + CustomData_free_layers(&me->fdata, CD_RECAST, me->totface); + + DAG_id_tag_update(&me->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, &me->id); + + return OPERATOR_FINISHED; +} + +void MESH_OT_navmesh_clear(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "NavMesh Clear Data"; + ot->description= "Remove navmesh data from this mesh"; + ot->idname= "MESH_OT_navmesh_clear"; + + /* api callbacks */ + ot->poll= navmesh_obmode_data_poll; + ot->exec= navmesh_clear_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 4d8194a2979..d74685fa29f 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -153,6 +153,14 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_solidify); WM_operatortype_append(MESH_OT_select_nth); + +#ifdef WITH_GAMEENGINE + WM_operatortype_append(MESH_OT_navmesh_make); + WM_operatortype_append(MESH_OT_navmesh_face_copy); + WM_operatortype_append(MESH_OT_navmesh_face_add); + WM_operatortype_append(MESH_OT_navmesh_reset); + WM_operatortype_append(MESH_OT_navmesh_clear); +#endif } #if 0 /* UNUSED, remove? */ diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index b9b8ddc6305..c78c9fddbe8 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -58,16 +58,6 @@ set(SRC object_intern.h ) -if(WITH_GAMEENGINE) - list(APPEND INC - ../../../../extern/recastnavigation/Recast/Include - ) - - list(APPEND SRC - object_navmesh.cpp - ) -endif() - if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript index cdda16582ef..d4739236ba1 100644 --- a/source/blender/editors/object/SConscript +++ b/source/blender/editors/object/SConscript @@ -1,13 +1,13 @@ #!/usr/bin/python Import ('env') -sources = env.Glob('*.c') + env.Glob('*.cpp') +sources = env.Glob('*.c') incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc ../../blenloader' incs += ' ../../makesrna ../../python ../../ikplugin' incs += ' ../../render/extern/include ../../gpu' # for object_bake.c -incs += ' #extern/recastnavigation/Recast/Include' +incs += ' #extern/recastnavigation' defs = [] diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 0292977f816..5d8781e0a6d 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -175,12 +175,18 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl /********************* Add Object Operator ********************/ +void view_align_update(struct Main *UNUSED(main), struct Scene *UNUSED(scene), struct PointerRNA *ptr) +{ + RNA_struct_idprops_unset(ptr, "rotation"); +} + 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"); + prop= RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view"); + RNA_def_property_update_runtime(prop, view_align_update); if(do_editmode) { prop= RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", "Enter editmode when adding this object"); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 07c006a7995..446c359b9f2 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -883,7 +883,8 @@ static void multiresbake_start(MultiresBakeRender *bkr) finish_images(bkr); } -static int multiresbake_check(bContext *C, wmOperator *op) { +static int multiresbake_check(bContext *C, wmOperator *op) +{ Scene *scene= CTX_data_scene(C); Object *ob; Mesh *me; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 8ca481655d0..76cbfdc88e7 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1221,7 +1221,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) cu1->vfontbi= cu->vfontbi; id_us_plus((ID *)cu1->vfontbi); - BKE_text_to_curve(scene, base->object, 0); /* needed? */ + BKE_text_to_curve(bmain, scene, base->object, 0); /* needed? */ BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family)); @@ -1368,7 +1368,7 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v strcat (str, "|Object Constraints%x22"); strcat (str, "|NLA Strips%x26"); -// XXX if (OB_SUPPORT_MATERIAL(ob)) { +// XXX if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) { // strcat(str, "|Texture Space%x17"); // } diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 434111c1227..7bb98f4aeb1 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -225,10 +225,5 @@ void OBJECT_OT_group_remove(struct wmOperatorType *ot); /* object_bake.c */ void OBJECT_OT_bake_image(wmOperatorType *ot); -/* object_navmesh.cpp */ -void OBJECT_OT_create_navmesh(struct wmOperatorType *ot); -void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot); -void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot); - #endif /* ED_OBJECT_INTERN_H */ diff --git a/source/blender/editors/object/object_navmesh.cpp b/source/blender/editors/object/object_navmesh.cpp deleted file mode 100644 index ae97b40eb49..00000000000 --- a/source/blender/editors/object/object_navmesh.cpp +++ /dev/null @@ -1,628 +0,0 @@ -/** -* $Id$ -* -* ***** BEGIN GPL LICENSE BLOCK ***** -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -* The Original Code is Copyright (C) 2004 by Blender Foundation -* All rights reserved. -* -* The Original Code is: all of this file. -* -* Contributor(s): none yet. -* -* ***** END GPL LICENSE BLOCK ***** -*/ - -#include <math.h> -#include "Recast.h" - -extern "C" -{ -#include "MEM_guardedalloc.h" - -#include "DNA_scene_types.h" -#include "DNA_object_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_modifier_types.h" -#include "DNA_ID.h" - -#include "BKE_library.h" -#include "BKE_depsgraph.h" -#include "BKE_context.h" -#include "BKE_mesh.h" -#include "BKE_modifier.h" -#include "BKE_scene.h" -#include "BKE_DerivedMesh.h" -#include "BKE_cdderivedmesh.h" -#include "BLI_editVert.h" -#include "BLI_listbase.h" -#include "BLI_utildefines.h" -#include "ED_object.h" -#include "BLI_math_vector.h" - -#include "RNA_access.h" - -#include "ED_mesh.h" - -/*mesh/mesh_intern.h */ -extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example); -extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges); -extern void free_vertlist(EditMesh *em, ListBase *edve); -extern void free_edgelist(EditMesh *em, ListBase *lb); -extern void free_facelist(EditMesh *em, ListBase *lb); - -#include "WM_api.h" -#include "WM_types.h" - -static void createVertsTrisData(bContext *C, LinkNode* obs, int& nverts, float*& verts, int &ntris, int*& tris) -{ - MVert *mvert; - int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces; - MFace *mface; - float co[3], wco[3]; - Object *ob; - LinkNode *oblink, *dmlink; - DerivedMesh *dm; - Scene* scene = CTX_data_scene(C); - LinkNode* dms = NULL; - - nverts = 0; - ntris = 0; - //calculate number of verts and tris - for (oblink = obs; oblink; oblink = oblink->next) - { - ob = (Object*) oblink->link; - DerivedMesh *dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH); - BLI_linklist_append(&dms, (void*)dm); - - nverts += dm->getNumVerts(dm); - nfaces = dm->getNumFaces(dm); - ntris += nfaces; - - //resolve quad faces - mface = dm->getFaceArray(dm); - for (i=0; i<nfaces; i++) - { - MFace* mf = &mface[i]; - if (mf->v4) - ntris+=1; - } - } - - //create data - verts = (float*) MEM_mallocN(sizeof(float)*3*nverts, "verts"); - tris = (int*) MEM_mallocN(sizeof(int)*3*ntris, "faces"); - - basenverts = 0; - tri = tris; - for (oblink = obs, dmlink = dms; oblink && dmlink; - oblink = oblink->next, dmlink = dmlink->next) - { - ob = (Object*) oblink->link; - dm = (DerivedMesh*) dmlink->link; - - curnverts = dm->getNumVerts(dm); - mvert = dm->getVertArray(dm); - //copy verts - for (i=0; i<curnverts; i++) - { - MVert *v = &mvert[i]; - copy_v3_v3(co, v->co); - mul_v3_m4v3(wco, ob->obmat, co); - verts[3*(basenverts+i)+0] = wco[0]; - verts[3*(basenverts+i)+1] = wco[2]; - verts[3*(basenverts+i)+2] = wco[1]; - } - - //create tris - curnfaces = dm->getNumFaces(dm); - mface = dm->getFaceArray(dm); - for (i=0; i<curnfaces; i++) - { - MFace* mf = &mface[i]; - tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v3; tri[2]= basenverts + mf->v2; - tri += 3; - if (mf->v4) - { - tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v4; tri[2]= basenverts + mf->v3; - tri += 3; - } - } - basenverts += curnverts; - } - - //release derived mesh - for (dmlink = dms; dmlink; dmlink = dmlink->next) - { - dm = (DerivedMesh*) dmlink->link; - dm->release(dm); - } - BLI_linklist_free(dms, NULL); -} - -static bool buildNavMesh(const RecastData& recastParams, int nverts, float* verts, int ntris, int* tris, - rcPolyMesh*& pmesh, rcPolyMeshDetail*& dmesh) -{ - float bmin[3], bmax[3]; - rcHeightfield* solid; - unsigned char *triflags; - rcCompactHeightfield* chf; - rcContourSet *cset; - - rcCalcBounds(verts, nverts, bmin, bmax); - - // - // Step 1. Initialize build config. - // - rcConfig cfg; - memset(&cfg, 0, sizeof(cfg)); - { -/* - float cellsize = 0.3f; - float cellheight = 0.2f; - float agentmaxslope = M_PI/4; - float agentmaxclimb = 0.9f; - float agentheight = 2.0f; - float agentradius = 0.6f; - float edgemaxlen = 12.0f; - float edgemaxerror = 1.3f; - float regionminsize = 50.f; - float regionmergesize = 20.f; - int vertsperpoly = 6; - float detailsampledist = 6.0f; - float detailsamplemaxerror = 1.0f; - cfg.cs = cellsize; - cfg.ch = cellheight; - cfg.walkableSlopeAngle = agentmaxslope/M_PI*180.f; - cfg.walkableHeight = (int)ceilf(agentheight/ cfg.ch); - cfg.walkableClimb = (int)floorf(agentmaxclimb / cfg.ch); - cfg.walkableRadius = (int)ceilf(agentradius / cfg.cs); - cfg.maxEdgeLen = (int)(edgemaxlen/cellsize); - cfg.maxSimplificationError = edgemaxerror; - cfg.minRegionSize = (int)rcSqr(regionminsize); - cfg.mergeRegionSize = (int)rcSqr(regionmergesize); - cfg.maxVertsPerPoly = vertsperpoly; - cfg.detailSampleDist = detailsampledist< 0.9f ? 0 : cellsize * detailsampledist; - cfg.detailSampleMaxError = cellheight * detailsamplemaxerror; -*/ - cfg.cs = recastParams.cellsize; - cfg.ch = recastParams.cellheight; - cfg.walkableSlopeAngle = recastParams.agentmaxslope/((float)M_PI)*180.f; - cfg.walkableHeight = (int)ceilf(recastParams.agentheight/ cfg.ch); - cfg.walkableClimb = (int)floorf(recastParams.agentmaxclimb / cfg.ch); - cfg.walkableRadius = (int)ceilf(recastParams.agentradius / cfg.cs); - cfg.maxEdgeLen = (int)(recastParams.edgemaxlen/recastParams.cellsize); - cfg.maxSimplificationError = recastParams.edgemaxerror; - cfg.minRegionSize = (int)rcSqr(recastParams.regionminsize); - cfg.mergeRegionSize = (int)rcSqr(recastParams.regionmergesize); - cfg.maxVertsPerPoly = recastParams.vertsperpoly; - cfg.detailSampleDist = recastParams.detailsampledist< 0.9f ? 0 : - recastParams.cellsize * recastParams.detailsampledist; - cfg.detailSampleMaxError = recastParams.cellheight * recastParams.detailsamplemaxerror; - - } - - // Set the area where the navigation will be build. - vcopy(cfg.bmin, bmin); - vcopy(cfg.bmax, bmax); - rcCalcGridSize(cfg.bmin, cfg.bmax, cfg.cs, &cfg.width, &cfg.height); - - // - // Step 2. Rasterize input polygon soup. - // - // Allocate voxel heightfield where we rasterize our input data to. - solid = new rcHeightfield; - if (!solid) - return false; - - if (!rcCreateHeightfield(*solid, cfg.width, cfg.height, cfg.bmin, cfg.bmax, cfg.cs, cfg.ch)) - return false; - - // Allocate array that can hold triangle flags. - triflags = (unsigned char*) MEM_mallocN(sizeof(unsigned char)*ntris, "triflags"); - if (!triflags) - return false; - // Find triangles which are walkable based on their slope and rasterize them. - memset(triflags, 0, ntris*sizeof(unsigned char)); - rcMarkWalkableTriangles(cfg.walkableSlopeAngle, verts, nverts, tris, ntris, triflags); - rcRasterizeTriangles(verts, nverts, tris, triflags, ntris, *solid); - MEM_freeN(triflags); - MEM_freeN(verts); - MEM_freeN(tris); - - // - // Step 3. Filter walkables surfaces. - // - rcFilterLedgeSpans(cfg.walkableHeight, cfg.walkableClimb, *solid); - rcFilterWalkableLowHeightSpans(cfg.walkableHeight, *solid); - - // - // Step 4. Partition walkable surface to simple regions. - // - - chf = new rcCompactHeightfield; - if (!chf) - return false; - if (!rcBuildCompactHeightfield(cfg.walkableHeight, cfg.walkableClimb, RC_WALKABLE, *solid, *chf)) - return false; - - delete solid; - - // Prepare for region partitioning, by calculating distance field along the walkable surface. - if (!rcBuildDistanceField(*chf)) - return false; - - // Partition the walkable surface into simple regions without holes. - if (!rcBuildRegions(*chf, cfg.walkableRadius, cfg.borderSize, cfg.minRegionSize, cfg.mergeRegionSize)) - return false; - - // - // Step 5. Trace and simplify region contours. - // - // Create contours. - cset = new rcContourSet; - if (!cset) - return false; - - if (!rcBuildContours(*chf, cfg.maxSimplificationError, cfg.maxEdgeLen, *cset)) - return false; - - // - // Step 6. Build polygons mesh from contours. - // - pmesh = new rcPolyMesh; - if (!pmesh) - return false; - if (!rcBuildPolyMesh(*cset, cfg.maxVertsPerPoly, *pmesh)) - return false; - - - // - // Step 7. Create detail mesh which allows to access approximate height on each polygon. - // - - dmesh = new rcPolyMeshDetail; - if (!dmesh) - return false; - - if (!rcBuildPolyMeshDetail(*pmesh, *chf, cfg.detailSampleDist, cfg.detailSampleMaxError, *dmesh)) - return false; - - delete chf; - delete cset; - - return true; -} - -static Object* createRepresentation(bContext *C, rcPolyMesh*& pmesh, rcPolyMeshDetail*& dmesh, Base* base) -{ - float co[3], rot[3]; - EditMesh *em; - int i,j, k; - unsigned short* v; - int face[3]; - Main *bmain = CTX_data_main(C); - Scene *scene= CTX_data_scene(C); - Object* obedit; - int createob = base==NULL; - zero_v3(co); - zero_v3(rot); - if (createob) - { - //create new object - obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); - } - else - { - obedit = base->object; - scene_select_base(scene, base); - copy_v3_v3(obedit->loc, co); - copy_v3_v3(obedit->rot, rot); - } - - ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); - em = BKE_mesh_get_editmesh(((Mesh *)obedit->data)); - - if (!createob) - { - //clear - if(em->verts.first) free_vertlist(em, &em->verts); - if(em->edges.first) free_edgelist(em, &em->edges); - if(em->faces.first) free_facelist(em, &em->faces); - if(em->selected.first) BLI_freelistN(&(em->selected)); - } - - //create verts for polygon mesh - for(i = 0; i < pmesh->nverts; i++) { - v = &pmesh->verts[3*i]; - co[0] = pmesh->bmin[0] + v[0]*pmesh->cs; - co[1] = pmesh->bmin[1] + v[1]*pmesh->ch; - co[2] = pmesh->bmin[2] + v[2]*pmesh->cs; - SWAP(float, co[1], co[2]); - addvertlist(em, co, NULL); - } - - //create custom data layer to save polygon idx - CustomData_add_layer_named(&em->fdata, CD_RECAST, CD_CALLOC, NULL, 0, "recastData"); - - //create verts and faces for detailed mesh - for (i=0; i<dmesh->nmeshes; i++) - { - int uniquevbase = em->totvert; - unsigned short vbase = dmesh->meshes[4*i+0]; - unsigned short ndv = dmesh->meshes[4*i+1]; - unsigned short tribase = dmesh->meshes[4*i+2]; - unsigned short trinum = dmesh->meshes[4*i+3]; - const unsigned short* p = &pmesh->polys[i*pmesh->nvp*2]; - int nv = 0; - for (j = 0; j < pmesh->nvp; ++j) - { - if (p[j] == 0xffff) break; - nv++; - } - //create unique verts - for (j=nv; j<ndv; j++) - { - copy_v3_v3(co, &dmesh->verts[3*(vbase + j)]); - SWAP(float, co[1], co[2]); - addvertlist(em, co, NULL); - } - - EM_init_index_arrays(em, 1, 0, 0); - - //create faces - for (j=0; j<trinum; j++) - { - unsigned char* tri = &dmesh->tris[4*(tribase+j)]; - EditFace* newFace; - for (k=0; k<3; k++) - { - if (tri[k]<nv) - face[k] = p[tri[k]]; //shared vertex - else - face[k] = uniquevbase+tri[k]-nv; //unique vertex - } - newFace = addfacelist(em, EM_get_vert_for_index(face[0]), EM_get_vert_for_index(face[2]), - EM_get_vert_for_index(face[1]), NULL, NULL, NULL); - - //set navigation polygon idx to the custom layer - int* polygonIdx = (int*)CustomData_em_get(&em->fdata, newFace->data, CD_RECAST); - *polygonIdx = i+1; //add 1 to avoid zero idx - } - - EM_free_index_arrays(); - } - - delete pmesh; pmesh = NULL; - delete dmesh; dmesh = NULL; - - BKE_mesh_end_editmesh((Mesh*)obedit->data, em); - - DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - - ED_object_exit_editmode(C, EM_FREEDATA); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit); - - if (createob) - { - obedit->gameflag &= ~OB_COLLISION; - obedit->gameflag |= OB_NAVMESH; - obedit->body_type = OB_BODY_TYPE_NAVMESH; - rename_id((ID *)obedit, "Navmesh"); - } - - ModifierData *md= modifiers_findByType(obedit, eModifierType_NavMesh); - if (!md) - { - ED_object_modifier_add(NULL, bmain, scene, obedit, NULL, eModifierType_NavMesh); - } - - return obedit; -} - -static int create_navmesh_exec(bContext *C, wmOperator *op) -{ - Scene* scene = CTX_data_scene(C); - int nverts, ntris; - float* verts; - int* tris; - rcPolyMesh* pmesh; - rcPolyMeshDetail* dmesh; - LinkNode* obs = NULL; - Base* navmeshBase = NULL; - //CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) //expand macros to avoid error in convertion from void* - { - ListBase ctx_data_list; - CollectionPointerLink *ctx_link; - CTX_data_selected_editable_bases(C, &ctx_data_list); - for(ctx_link = (CollectionPointerLink *)ctx_data_list.first; - ctx_link; ctx_link = (CollectionPointerLink *)ctx_link->next) { - Base* base= (Base*)ctx_link->ptr.data; - { - if (base->object->body_type==OB_BODY_TYPE_NAVMESH) - { - if (!navmeshBase || base==CTX_data_active_base(C)) - navmeshBase = base; - } - else - BLI_linklist_append(&obs, (void*)base->object); - } - CTX_DATA_END; - createVertsTrisData(C, obs, nverts, verts, ntris, tris); - BLI_linklist_free(obs, NULL); - buildNavMesh(scene->gm.recastData, nverts, verts, ntris, tris, pmesh, dmesh); - createRepresentation(C, pmesh, dmesh, navmeshBase); - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_create_navmesh(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Create navigation mesh"; - ot->description= "Create navigation mesh for selected objects"; - ot->idname= "OBJECT_OT_create_navmesh"; - - /* api callbacks */ - ot->exec= create_navmesh_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -static int assign_navpolygon_poll(bContext *C) -{ - Object *ob= (Object *)CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - if (!ob || !ob->data) - return 0; - return (((Mesh*)ob->data)->edit_mesh != NULL); -} - -static int assign_navpolygon_exec(bContext *C, wmOperator *op) -{ - Object *obedit= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - //do work here - int targetPolyIdx = -1; - EditFace *ef, *efa; - efa = EM_get_actFace(em, 0); - if (efa) - { - if (CustomData_has_layer(&em->fdata, CD_RECAST)) - { - targetPolyIdx = *(int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST); - targetPolyIdx = targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx; - if (targetPolyIdx>0) - { - //set target poly idx to other selected faces - ef = (EditFace*)em->faces.last; - while(ef) - { - if((ef->f & SELECT )&& ef!=efa) - { - int* recastDataBlock = (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); - *recastDataBlock = targetPolyIdx; - } - ef = ef->prev; - } - } - } - } - - DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - BKE_mesh_end_editmesh((Mesh*)obedit->data, em); - return OPERATOR_FINISHED; -} - -void OBJECT_OT_assign_navpolygon(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Assign polygon index"; - ot->description= "Assign polygon index to face by active face"; - ot->idname= "OBJECT_OT_assign_navpolygon"; - - /* api callbacks */ - ot->poll = assign_navpolygon_poll; - ot->exec= assign_navpolygon_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -static int compare(const void * a, const void * b){ - return ( *(int*)a - *(int*)b ); -} -static int findFreeNavPolyIndex(EditMesh* em) -{ - //construct vector of indices - int numfaces = em->totface; - int* indices = new int[numfaces]; - EditFace* ef = (EditFace*)em->faces.last; - int idx = 0; - while(ef) - { - int polyIdx = *(int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); - indices[idx] = polyIdx; - idx++; - ef = ef->prev; - } - qsort(indices, numfaces, sizeof(int), compare); - //search first free index - int freeIdx = 1; - for (int i=0; i<numfaces; i++) - { - if (indices[i]==freeIdx) - freeIdx++; - else if (indices[i]>freeIdx) - break; - } - delete [] indices; - return freeIdx; -} - -static int assign_new_navpolygon_exec(bContext *C, wmOperator *op) -{ - Object *obedit= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - EditFace *ef; - if (CustomData_has_layer(&em->fdata, CD_RECAST)) - { - int targetPolyIdx = findFreeNavPolyIndex(em); - if (targetPolyIdx>0) - { - //set target poly idx to selected faces - ef = (EditFace*)em->faces.last; - while(ef) - { - if(ef->f & SELECT ) - { - int* recastDataBlock = (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST); - *recastDataBlock = targetPolyIdx; - } - ef = ef->prev; - } - } - } - - DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - BKE_mesh_end_editmesh((Mesh*)obedit->data, em); - return OPERATOR_FINISHED; -} - -void OBJECT_OT_assign_new_navpolygon(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Assign new polygon index"; - ot->description= "Assign new polygon index to face"; - ot->idname= "OBJECT_OT_assign_new_navpolygon"; - - /* api callbacks */ - ot->poll = assign_navpolygon_poll; - ot->exec= assign_new_navpolygon_exec; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} -} diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index a9cb0423739..5a2437b1911 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -214,12 +214,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_bake_image); WM_operatortype_append(OBJECT_OT_drop_named_material); - -#ifdef WITH_GAMEENGINE - WM_operatortype_append(OBJECT_OT_create_navmesh); - WM_operatortype_append(OBJECT_OT_assign_navpolygon); - WM_operatortype_append(OBJECT_OT_assign_new_navpolygon); -#endif } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index ec5aa19d3c0..389c0941cc2 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1243,9 +1243,11 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt) return 1; break; case MAKE_LINKS_MATERIALS: - if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL) && - ELEM5(obt->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL)) + if (OB_TYPE_SUPPORT_MATERIAL(ob->type) && + OB_TYPE_SUPPORT_MATERIAL(obt->type)) + { return 1; + } break; case MAKE_LINKS_ANIMDATA: case MAKE_LINKS_DUPLIGROUP: diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 4c29490b0f0..4ca7d272503 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -230,21 +230,9 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op, if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) { /* run provided clearing function */ clear_func(ob); - - /* auto keyframing */ - if (autokeyframe_cfra_can_key(scene, &ob->id)) { - ListBase dsources = {NULL, NULL}; - - /* now insert the keyframe(s) using the Keying Set - * 1) add datasource override for the Object - * 2) insert keyframes - * 3) free the extra info - */ - ANIM_relative_keyingset_add_source(&dsources, &ob->id, NULL, NULL); - ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); - BLI_freelistN(&dsources); - } - + + ED_autokeyframe_object(C, scene, ob, ks); + /* tag for updates */ DAG_id_tag_update(&ob->id, OB_RECALC_OB); } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 5265261f3af..7b4db347315 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -756,7 +756,8 @@ static void vgroup_normalize(Object *ob) It returns the number that it added (0-2) It relies on verts having -1 for unassigned indices */ -static int tryToAddVerts(int *verts, int length, int a, int b) { +static int tryToAddVerts(int *verts, int length, int a, int b) +{ char containsA = FALSE; char containsB = FALSE; int added = 0; @@ -786,7 +787,8 @@ and returns an array of indices of size count count is an int passed by reference so it can be assigned the value of the length here. */ -static int* getSurroundingVerts(Mesh *me, int vert, int *count) { +static int* getSurroundingVerts(Mesh *me, int vert, int *count) +{ int length = 0; int *tverts; int *verts = NULL; @@ -848,7 +850,8 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count) { /* get a single point in space by averaging a point cloud (vectors of size 3) coord is the place the average is stored, points is the point cloud, count is the number of points in the cloud */ -static void getSingleCoordinate(MVert *points, int count, float coord[3]) { +static void getSingleCoordinate(MVert *points, int count, float coord[3]) +{ int i; zero_v3(coord); for(i = 0; i < count; i++) { @@ -875,7 +878,8 @@ static void getNearestPointOnPlane(const float norm[3], const float coord[3], co } /* distance of two vectors a and b of size length */ -static float distance(float* a, float *b, int length) { +static float distance(float* a, float *b, int length) +{ int i; float sum = 0; for(i = 0; i < length; i++) { @@ -888,7 +892,9 @@ static float distance(float* a, float *b, int length) { compute the amount of vertical distance relative to the plane and store it in dists, then get the horizontal and vertical change and store them in changes */ -static void getVerticalAndHorizontalChange(float *norm, float d, float *coord, float *start, float distToStart, float *end, float (*changes)[2], float *dists, int index) { +static void getVerticalAndHorizontalChange(float *norm, float d, float *coord, float *start, float distToStart, + float *end, float (*changes)[2], float *dists, int index) +{ // A=Q-((Q-P).N)N // D = (a*x0 + b*y0 +c*z0 +d) float projA[3] = {0}, projB[3] = {0}; @@ -906,7 +912,8 @@ static void getVerticalAndHorizontalChange(float *norm, float d, float *coord, f } // I need the derived mesh to be forgotten so the positions are recalculated with weight changes (see dm_deform_recalc) -static void dm_deform_clear(DerivedMesh *dm, Object *ob) { +static void dm_deform_clear(DerivedMesh *dm, Object *ob) +{ if(ob->derivedDeform && (ob->derivedDeform)==dm) { ob->derivedDeform->needsFree = 1; ob->derivedDeform->release(ob->derivedDeform); @@ -919,19 +926,23 @@ static void dm_deform_clear(DerivedMesh *dm, Object *ob) { } // recalculate the deformation -static DerivedMesh* dm_deform_recalc(Scene *scene, Object *ob) { +static DerivedMesh* dm_deform_recalc(Scene *scene, Object *ob) +{ return mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH); } -/* by changing nonzero weights, try to move a vertex in me->mverts with index 'index' to distToBe distance away from the provided plane -strength can change distToBe so that it moves towards distToBe by that percentage -cp changes how much the weights are adjusted to check the distance +/* by changing nonzero weights, try to move a vertex in me->mverts with index 'index' to +distToBe distance away from the provided plane strength can change distToBe so that it moves +towards distToBe by that percentage cp changes how much the weights are adjusted +to check the distance index is the index of the vertex being moved norm and d are the plane's properties for the equation: ax + by + cz + d = 0 coord is a point on the plane */ -static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, int index, float norm[3], float coord[3], float d, float distToBe, float strength, float cp) { +static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, int index, float norm[3], + float coord[3], float d, float distToBe, float strength, float cp) +{ DerivedMesh *dm; MDeformWeight *dw; MVert m; @@ -939,7 +950,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in int totweight = dvert->totweight; float oldw = 0; float oldPos[3] = {0}; - float vc, hc, dist; + float vc, hc, dist = 0.0f /* Not necessary, but quites down gcc warnings! */; int i, k; float (*changes)[2] = MEM_mallocN(sizeof(float *)*totweight*2, "vertHorzChange"); float *dists = MEM_mallocN(sizeof(float)*totweight, "distance"); @@ -1086,7 +1097,8 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in dm_deform_clear(dm, ob); dm = NULL; } } - }while(wasChange && (distToStart-distToBe)/fabs(distToStart-distToBe) == (dists[bestIndex]-distToBe)/fabs(dists[bestIndex]-distToBe)); + } while(wasChange && (distToStart-distToBe)/fabs(distToStart-distToBe) == + (dists[bestIndex]-distToBe)/fabs(dists[bestIndex]-distToBe)); MEM_freeN(upDown); MEM_freeN(changes); MEM_freeN(dists); @@ -2311,7 +2323,8 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "lock_active", TRUE, "Lock Active", "Keep the values of the active group while normalizing others"); + RNA_def_boolean(ot->srna, "lock_active", TRUE, "Lock Active", + "Keep the values of the active group while normalizing others"); } static int vertex_group_fix_exec(bContext *C, wmOperator *op) @@ -2349,7 +2362,8 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot) /* identifiers */ ot->name= "Fix Vertex Group Deform"; ot->idname= "OBJECT_OT_vertex_group_fix"; - ot->description= "Modify the position of selected vertices by changing only their respective groups' weights (this tool may be slow for many vertices)"; + ot->description= "Modify the position of selected vertices by changing only their respective " + "groups' weights (this tool may be slow for many vertices)"; /* api callbacks */ ot->poll= vertex_group_poll; @@ -2358,8 +2372,10 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to", -10.0f, 10.0f); - RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength", "The distance moved can be changed by this multiplier", -2.0f, 2.0f); - RNA_def_float(ot->srna, "accuracy", 1.0f, 0.05f, FLT_MAX, "Change Sensitivity", "Changes the amount weights are altered with each iteration: lower values are slower", 0.05f, 1.f); + RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength", + "The distance moved can be changed by this multiplier", -2.0f, 2.0f); + RNA_def_float(ot->srna, "accuracy", 1.0f, 0.05f, FLT_MAX, "Change Sensitivity", + "Change the amount weights are altered with each iteration: lower values are slower", 0.05f, 1.f); } @@ -2417,8 +2433,10 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "auto_assign", TRUE, "Add Weights", "Add verts from groups that have zero weight before inverting"); - RNA_def_boolean(ot->srna, "auto_remove", TRUE, "Remove Weights", "Remove verts from groups that have zero weight after inverting"); + RNA_def_boolean(ot->srna, "auto_assign", TRUE, "Add Weights", + "Add verts from groups that have zero weight before inverting"); + RNA_def_boolean(ot->srna, "auto_remove", TRUE, "Remove Weights", + "Remove verts from groups that have zero weight after inverting"); } @@ -2507,7 +2525,8 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) /* identifiers */ ot->name= "Mirror Vertex Group"; ot->idname= "OBJECT_OT_vertex_group_mirror"; - ot->description= "Mirror all vertex groups, flip weights and/or names, editing only selected vertices, flipping when both sides are selected otherwise copy from unselected"; + ot->description= "Mirror all vertex groups, flip weights and/or names, editing only selected vertices, " + "flipping when both sides are selected otherwise copy from unselected"; /* api callbacks */ ot->poll= vertex_group_poll_edit; @@ -2579,7 +2598,9 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) 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); + 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/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 74e91cf32ea..019d6df9b73 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3918,7 +3918,7 @@ void PE_undo_push(Scene *scene, const char *str) /* make new */ edit->curundo= undo= MEM_callocN(sizeof(PTCacheUndo), "particle undo file"); - strncpy(undo->name, str, 64-1); + BLI_strncpy(undo->name, str, sizeof(undo->name)); BLI_addtail(&edit->undo, undo); /* and limit amount to the maximum */ diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 11796d01620..918adcac138 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -844,7 +844,7 @@ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss) return; } -static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) +static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, short do_job) { Scene *scene= CTX_data_scene(C); int i; @@ -871,12 +871,10 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) ListBase *fobjects = MEM_callocN(sizeof(ListBase), "fluid objects"); FluidsimModifierData *fluidmd = NULL; Mesh *mesh = NULL; - - wmJob *steve; + FluidBakeJob *fb; elbeemSimulationSettings *fsset= MEM_callocN(sizeof(elbeemSimulationSettings), "Fluid sim settings"); - - steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS); + fb= MEM_callocN(sizeof(FluidBakeJob), "fluid bake job"); if(getenv(strEnvName)) { @@ -1083,12 +1081,25 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) /* custom data for fluid bake job */ fb->settings = fsset; - /* setup job */ - WM_jobs_customdata(steve, fb, fluidbake_free); - WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME); - WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, fluidbake_endjob); - - WM_jobs_start(CTX_wm_manager(C), steve); + if(do_job) { + wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS); + + /* setup job */ + WM_jobs_customdata(steve, fb, fluidbake_free); + WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME); + WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, fluidbake_endjob); + + WM_jobs_start(CTX_wm_manager(C), steve); + } + else { + short dummy_stop, dummy_do_update; + float dummy_progress; + + /* blocking, use with exec() */ + fluidbake_startjob((void *)fb, &dummy_stop, &dummy_do_update, &dummy_progress); + fluidbake_endjob((void *)fb); + fluidbake_free((void *)fb); + } /* ******** free stored animation data ******** */ fluidbake_free_data(channels, fobjects, NULL, NULL); @@ -1121,7 +1132,7 @@ FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss)) } /* only compile dummy functions */ -static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob)) +static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob), short UNUSED(do_job)) { return 0; } @@ -1130,13 +1141,21 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object /***************************** Operators ******************************/ -static int fluid_bake_exec(bContext *C, wmOperator *op) +static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* only one bake job at a time */ if(WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) - return 0; + return OPERATOR_CANCELLED; - if(!fluidsimBake(C, op->reports, CTX_data_active_object(C))) + if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE)) + return OPERATOR_CANCELLED; + + return OPERATOR_FINISHED; +} + +static int fluid_bake_exec(bContext *C, wmOperator *op) +{ + if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), FALSE)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -1150,6 +1169,7 @@ void FLUID_OT_bake(wmOperatorType *ot) ot->idname= "FLUID_OT_bake"; /* api callbacks */ + ot->invoke= fluid_bake_invoke; ot->exec= fluid_bake_exec; ot->poll= ED_operator_object_active_editable; } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index b937f9a4104..70709a22d3d 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -344,7 +344,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre /* copy over object color, in case material uses it */ copy_v4_v4(base->object->col, sp->col); - if(ELEM4(base->object->type, OB_MESH, OB_CURVE, OB_SURF, OB_MBALL)) { + if(OB_TYPE_SUPPORT_MATERIAL(base->object->type)) { /* don't use assign_material, it changed mat->id.us, which shows in the UI */ Material ***matar= give_matarar(base->object); int actcol= MAX2(base->object->actcol > 0, 1) - 1; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 8951df9221e..28f486117b7 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -831,6 +831,9 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int prefsizex= ar->sizex?ar->sizex:ar->type->prefsizex; if(ar->regiontype==RGN_TYPE_HEADER) prefsizey= ar->type->prefsizey; + else if(ar->regiontype==RGN_TYPE_UI && sa->spacetype == SPACE_FILE) { + prefsizey= UI_UNIT_Y * 2 + (UI_UNIT_Y/2); + } else prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey; @@ -1375,9 +1378,9 @@ static const char *editortype_pup(void) "|Outliner %x3" "|User Preferences %x19" "|Info%x7" - + "|%l" - + "|File Browser %x5" "|%l" diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 589d652a275..827c14b1c0d 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -364,7 +364,8 @@ void fdrawXORcirc(float xofs, float yofs, float rad) set_inverted_drawing(0); } -void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments) { +void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments) +{ int i; glBegin(GL_TRIANGLE_FAN); @@ -378,7 +379,8 @@ void glutil_draw_filled_arc(float start, float angle, float radius, int nsegment glEnd(); } -void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments) { +void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments) +{ int i; glBegin(GL_LINE_STRIP); @@ -797,7 +799,8 @@ void bglBegin(int mode) } } -int bglPointHack(void) { +int bglPointHack(void) +{ float value[4]; int pointhack_px; glGetFloatv(GL_POINT_SIZE_RANGE, value); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index eb919261127..1c53be15a0f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -356,9 +356,13 @@ typedef struct UndoImageTile { struct UndoImageTile *next, *prev; char idname[MAX_ID_NAME]; /* name instead of pointer*/ + char ibufname[IB_FILENAME_SIZE]; void *rect; int x, y; + + short source; + char gen_type; } UndoImageTile; static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0}; @@ -389,8 +393,9 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int int allocsize; for(tile=lb->first; tile; tile=tile->next) - if(tile->x == x_tile && tile->y == y_tile && strcmp(tile->idname, ima->id.name)==0) - return tile->rect; + if(tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source) + if(strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0) + return tile->rect; if (*tmpibuf==NULL) *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); @@ -404,6 +409,11 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char); tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect"); + strcpy(tile->ibufname, ibuf->name); + + tile->gen_type= ima->gen_type; + tile->source= ima->source; + undo_copy_tile(tile, *tmpibuf, ibuf, 0); undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize); @@ -424,18 +434,30 @@ static void image_undo_restore(bContext *C, ListBase *lb) for(tile=lb->first; tile; tile=tile->next) { /* find image based on name, pointer becomes invalid with global undo */ - if(ima && strcmp(tile->idname, ima->id.name)==0); + if(ima && strcmp(tile->idname, ima->id.name)==0) { + /* ima is valid */ + } else { - for(ima=bmain->image.first; ima; ima=ima->id.next) - if(strcmp(tile->idname, ima->id.name)==0) - break; + ima= BLI_findstring(&bmain->image, tile->idname, offsetof(ID, name)); } ibuf= BKE_image_get_ibuf(ima, NULL); + if(ima && ibuf && strcmp(tile->ibufname, ibuf->name)!=0) { + /* current ImBuf filename was changed, probably current frame + was changed when paiting on image sequence, rather than storing + full image user (which isn't so obvious, btw) try to find ImBuf with + matched file name in list of already loaded images */ + + ibuf= BLI_findstring(&ima->ibufs, tile->ibufname, offsetof(ImBuf, name)); + } + if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) continue; + if (ima->gen_type != tile->gen_type || ima->source != tile->source) + continue; + undo_copy_tile(tile, tmpibuf, ibuf, 1); GPU_free_image(ima); /* force OpenGL reload */ @@ -1857,11 +1879,13 @@ static int IsectPT2Df_limit(float pt[2], float v1[2], float v2[2], float v3[2], /* Clip the face by a bucket and set the uv-space bucket_bounds_uv * so we have the clipped UV's to do pixel intersection tests with * */ -static int float_z_sort_flip(const void *p1, const void *p2) { +static int float_z_sort_flip(const void *p1, const void *p2) +{ return (((float *)p1)[2] < ((float *)p2)[2] ? 1:-1); } -static int float_z_sort(const void *p1, const void *p2) { +static int float_z_sort(const void *p1, const void *p2) +{ return (((float *)p1)[2] < ((float *)p2)[2] ?-1:1); } @@ -2666,9 +2690,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index tf = ps->dm_mtface+face_index; if (tpage_last != tf->tpage) { tpage_last = tf->tpage; - - image_index = -1; /* sanity check */ - + for (image_index=0; image_index < ps->image_tot; image_index++) { if (ps->projImages[image_index].ima == tpage_last) { ibuf = ps->projImages[image_index].ibuf; @@ -3686,7 +3708,8 @@ 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, int use_color_correction) { +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 already holds a texture result here from higher level function */ float rgba_br[3]; @@ -3702,7 +3725,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo if(use_color_correction){ srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb); } - else { + else { VECCOPY(rgba, ps->brush->rgb); } rgba[3] = 1.0; @@ -4875,7 +4898,6 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) time= PIL_check_seconds_timer(); tablet= 0; - pressure= 0; pop->s.blend= pop->s.brush->blend; if(event->custom == EVT_DATA_TABLET) { @@ -4886,8 +4908,9 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) if(wmtab->Active == EVT_TABLET_ERASER) pop->s.blend= IMB_BLEND_ERASE_ALPHA; } - else /* otherwise airbrush becomes 1.0 pressure instantly */ + else { /* otherwise airbrush becomes 1.0 pressure instantly */ pressure= pop->prev_pressure ? pop->prev_pressure : 1.0f; + } if(pop->first) { pop->prevmouse[0]= event->mval[0]; diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index ba0c2c8be92..345cda63f5a 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -34,6 +34,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "DNA_userdef_types.h" @@ -106,7 +107,7 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor BLI_addtail(&stack->elems, uel); /* name can be a dynamic string */ - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); /* limit amount to the maximum amount*/ nr= 0; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0c2cb2ee36d..cf90c43f3e1 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -290,7 +290,7 @@ static void make_vertexcol(Object *ob) /* single ob */ } /* mirror_vgroup is set to -1 when invalid */ -static void wpaint_mirror_vgroup_ensure(Object *ob, int *vgroup_mirror) +static int wpaint_mirror_vgroup_ensure(Object *ob) { bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef - 1); @@ -317,13 +317,12 @@ static void wpaint_mirror_vgroup_ensure(Object *ob, int *vgroup_mirror) /* curdef should never be NULL unless this is * a lamp and ED_vgroup_add_name fails */ if(curdef) { - *vgroup_mirror= mirrdef; - return; + return mirrdef; } } } - *vgroup_mirror= -1; + return -1; } static void copy_vpaint_prev(VPaint *vp, unsigned int *mcol, int tot) @@ -424,9 +423,9 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight) vgroup= ob->actdef-1; - /* if mirror painting, find the other group */ + /* if mirror painting, find the other group */ if(me->editflag & ME_EDIT_MIRROR_X) { - wpaint_mirror_vgroup_ensure(ob, &vgroup_mirror); + vgroup_mirror= wpaint_mirror_vgroup_ensure(ob); } copy_wpaint_prev(wp, me->dvert, me->totvert); @@ -1114,31 +1113,33 @@ static void do_weight_paint_auto_normalize(MDeformVert *dvert, #endif /* the active group should be involved in auto normalize */ -static void do_weight_paint_auto_normalize_all_groups(MDeformVert *dvert, char *map, char do_auto_normalize) +static void do_weight_paint_auto_normalize_all_groups(MDeformVert *dvert, const char *vgroup_validmap, char do_auto_normalize) { -// MDeformWeight *dw = dvert->dw; - float sum=0.0f, fac=0.0f; - int i, tot=0; - - if (do_auto_normalize == FALSE) + if (do_auto_normalize == FALSE) { return; + } + else { + float sum= 0.0f, fac; + unsigned int i, tot=0; + MDeformWeight *dw; + + for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) { + if (vgroup_validmap[dw->def_nr]) { + tot++; + sum += dw->weight; + } + } - for (i=0; i<dvert->totweight; i++) { - if (map[dvert->dw[i].def_nr]) { - tot += 1; - sum += dvert->dw[i].weight; + if ((tot == 0) || (sum == 1.0f) || (sum == 0.0f)) { + return; } - } - - if (!tot || sum == 1.0f) - return; - fac = sum; - fac = fac==0.0f ? 1.0f : 1.0f / fac; + fac= 1.0f / sum; - for (i=0; i<dvert->totweight; i++) { - if (map[dvert->dw[i].def_nr]) { - dvert->dw[i].weight *= fac; + for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) { + if (vgroup_validmap[dw->def_nr]) { + dw->weight *= fac; + } } } } @@ -1580,43 +1581,49 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert ) { Mesh *me= ob->data; + MDeformVert *dv= &me->dvert[index]; MDeformWeight *dw, *uw; int vgroup= ob->actdef-1; if(wp->flag & VP_ONLYVGROUP) { - dw= defvert_find_index(&me->dvert[index], vgroup); + dw= defvert_find_index(dv, vgroup); uw= defvert_find_index(wp->wpaint_prev+index, vgroup); } else { - dw= defvert_verify_index(&me->dvert[index], vgroup); + dw= defvert_verify_index(dv, vgroup); uw= defvert_verify_index(wp->wpaint_prev+index, vgroup); } - if(dw==NULL || uw==NULL) + + if(dw==NULL || uw==NULL) { return; + } /* TODO: De-duplicate the simple weight paint - jason */ /* ... or not, since its <10 SLOC - campbell */ /* If there are no locks or multipaint, * then there is no need to run the more complicated checks */ - if( (wpi->do_multipaint == FALSE || wpi->defbase_tot_sel <= 1) && - (wpi->lock_flags == NULL || has_locked_group(&me->dvert[index], wpi->lock_flags) == FALSE)) + if( (wpi->do_multipaint == FALSE || wpi->defbase_tot_sel <= 1) && + (wpi->lock_flags == NULL || has_locked_group(dv, wpi->lock_flags) == FALSE)) { wpaint_blend(wp, dw, uw, alpha, paintweight, wpi->do_flip, FALSE); - do_weight_paint_auto_normalize_all_groups(&me->dvert[index], wpi->vgroup_validmap, wpi->do_auto_normalize); if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */ - int j= mesh_get_x_mirror_vert(ob, index); - if(j>=0) { + int index_mirr= mesh_get_x_mirror_vert(ob, index); + if(index_mirr != -1) { + MDeformVert *dv_mirr= &me->dvert[index_mirr]; /* copy, not paint again */ - uw= defvert_verify_index(me->dvert+j, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup); - + uw= defvert_verify_index(dv_mirr, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup); uw->weight= dw->weight; - - do_weight_paint_auto_normalize_all_groups(me->dvert+j, wpi->vgroup_validmap, wpi->do_auto_normalize); } } + + /* important to normalize after mirror, otherwise mirror gets wight + * which has already been scaled down in relation to other weights, + * then scales a second time [#26193]. Tricky multi-paint code doesn't + * suffer from this problem - campbell */ + do_weight_paint_auto_normalize_all_groups(dv, wpi->vgroup_validmap, wpi->do_auto_normalize); } else { /* use locks and/or multipaint */ @@ -1627,7 +1634,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert float oldChange = 0; int i; MDeformWeight *tdw = NULL, *tuw; - MDeformVert dv= {NULL}; + MDeformVert dv_copy= {NULL}; oldw = dw->weight; wpaint_blend(wp, dw, uw, alpha, paintweight, wpi->do_flip, wpi->do_multipaint && wpi->defbase_tot_sel >1); @@ -1636,17 +1643,17 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert /* setup multi-paint */ if(wpi->defbase_tot_sel > 1 && wpi->do_multipaint) { - dv.dw= MEM_dupallocN(me->dvert[index].dw); - dv.flag = me->dvert[index].flag; - dv.totweight = me->dvert[index].totweight; + dv_copy.dw= MEM_dupallocN(dv->dw); + dv_copy.flag = dv->flag; + dv_copy.totweight = dv->totweight; tdw = dw; tuw = uw; change = get_mp_change(wp->wpaint_prev+index, wpi->defbase_sel, neww - oldw); if(change) { if(!tdw->weight) { - i = get_first_selected_nonzero_weight(&me->dvert[index], wpi->defbase_sel); + i = get_first_selected_nonzero_weight(dv, wpi->defbase_sel); if(i>=0) { - tdw = &(me->dvert[index].dw[i]); + tdw = &(dv->dw[i]); tuw = defvert_verify_index(wp->wpaint_prev+index, tdw->def_nr); } else { @@ -1660,7 +1667,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert if( testw > tuw->weight ) { if(change > oldChange) { /* reset the weights and use the new change */ - reset_to_prev(wp->wpaint_prev+index, &me->dvert[index]); + reset_to_prev(wp->wpaint_prev+index, dv); } else { /* the old change was more significant, so set @@ -1670,7 +1677,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } else { if(change < oldChange) { - reset_to_prev(wp->wpaint_prev+index, &me->dvert[index]); + reset_to_prev(wp->wpaint_prev+index, dv); } else { change = 0; @@ -1685,25 +1692,24 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } if(apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) { - reset_to_prev(&dv, &me->dvert[index]); + reset_to_prev(&dv_copy, dv); change = 0; oldChange = 0; } - if(dv.dw) { - MEM_freeN(dv.dw); + if(dv_copy.dw) { + MEM_freeN(dv_copy.dw); } - /* dvert may have been altered greatly */ - dw = defvert_find_index(&me->dvert[index], vgroup); + /* dv may have been altered greatly */ + dw = defvert_find_index(dv, vgroup); if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */ - int j= mesh_get_x_mirror_vert(ob, index); - if(j>=0) { + int index_mirr= mesh_get_x_mirror_vert(ob, index); + if(index_mirr != -1) { + MDeformVert *dv_mirr= &me->dvert[index_mirr]; /* copy, not paint again */ - uw= defvert_verify_index(me->dvert+j, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup); - + uw= defvert_verify_index(dv_mirr, (wpi->vgroup_mirror != -1) ? wpi->vgroup_mirror : vgroup); //uw->weight= dw->weight; - - apply_mp_locks_normalize(me, wpi, j, uw, tdw, change, oldChange, oldw, neww); + apply_mp_locks_normalize(me, wpi, index_mirr, uw, tdw, change, oldChange, oldw, neww); } } } @@ -1799,7 +1805,6 @@ struct WPaintData { float wpimat[3][3]; /*variables for auto normalize*/ - int auto_normalize; char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/ char *lock_flags; int defbase_tot; @@ -1810,26 +1815,26 @@ static char *wpaint_make_validmap(Object *ob) bDeformGroup *dg; ModifierData *md; char *vgroup_validmap; - GHash *gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh"); - int i = 0, step1=1; + GHash *gh; + int i, step1=1; - /*add all names to a hash table*/ - for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) { - BLI_ghash_insert(gh, dg->name, NULL); + if(ob->defbase.first == NULL) { + return NULL; } - if (!i) - return NULL; + gh= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh"); - vgroup_validmap= MEM_callocN(i, "wpaint valid map"); + /*add all names to a hash table*/ + for (dg=ob->defbase.first; dg; dg=dg->next) { + BLI_ghash_insert(gh, dg->name, NULL); + } /*now loop through the armature modifiers and identify deform bones*/ for (md = ob->modifiers.first; md; md= !md->next && step1 ? (step1=0), modifiers_getVirtualModifierList(ob) : md->next) { if (!(md->mode & (eModifierMode_Realtime|eModifierMode_Virtual))) continue; - if (md->type == eModifierType_Armature) - { + if (md->type == eModifierType_Armature) { ArmatureModifierData *amd= (ArmatureModifierData*) md; if(amd->object && amd->object->pose) { @@ -1848,12 +1853,12 @@ static char *wpaint_make_validmap(Object *ob) } } } - + + vgroup_validmap= MEM_mallocN(BLI_ghash_size(gh), "wpaint valid map"); + /*add all names to a hash table*/ for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) { - if (BLI_ghash_lookup(gh, dg->name) != NULL) { - vgroup_validmap[i] = TRUE; - } + vgroup_validmap[i]= (BLI_ghash_lookup(gh, dg->name) != NULL); } BLI_ghash_free(gh, NULL, NULL); @@ -1891,21 +1896,12 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED /*set up auto-normalize, and generate map for detecting which vgroups affect deform bones*/ - wpd->auto_normalize = ts->auto_normalize; wpd->defbase_tot = BLI_countlist(&ob->defbase); wpd->lock_flags = gen_lock_flags(ob, wpd->defbase_tot); - if (wpd->auto_normalize || ts->multipaint || wpd->lock_flags) + if (ts->auto_normalize || ts->multipaint || wpd->lock_flags) { wpd->vgroup_validmap = wpaint_make_validmap(ob); - - // if(qual & LR_CTRLKEY) { - // sample_wpaint(scene, ar, v3d, 0); - // return; - // } - // if(qual & LR_SHIFTKEY) { - // sample_wpaint(scene, ar, v3d, 1); - // return; - // } - + } + /* ALLOCATIONS! no return after this line */ /* painting on subsurfs should give correct points too, this returns me->totvert amount */ wpd->vertexcosnos= mesh_get_mapped_verts_nors(scene, ob); @@ -1933,9 +1929,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED if(ob->defbase.first==NULL) { ED_vgroup_add(ob); } - - // if(ob->lay & v3d->lay); else error("Active object is not in this layer"); - + /* imat for normals */ mul_m4_m4m4(mat, ob->obmat, wpd->vc.rv3d->viewmat); invert_m4_m4(imat, mat); @@ -1943,7 +1937,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED /* if mirror painting, find the other group */ if(me->editflag & ME_EDIT_MIRROR_X) { - wpaint_mirror_vgroup_ensure(ob, &wpd->vgroup_mirror); + wpd->vgroup_mirror= wpaint_mirror_vgroup_ensure(ob); } return 1; @@ -2006,7 +2000,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P wpi.vgroup_validmap= wpd->vgroup_validmap; wpi.do_flip= RNA_boolean_get(itemptr, "pen_flip"); wpi.do_multipaint= (ts->multipaint != 0); - wpi.do_auto_normalize= (ts->auto_normalize != 0); + wpi.do_auto_normalize= ((ts->auto_normalize != 0) && (wpi.vgroup_validmap != NULL)); /* *** done setting up WeightPaintInfo *** */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 62d6d5f16b8..5a888e6f595 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -154,7 +154,7 @@ static int sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) if(mmd) return 0; - /* non-locked shaoe keys could be handled in the same way as deformed mesh */ + /* non-locked shape keys could be handled in the same way as deformed mesh */ if((ob->shapeflag&OB_SHAPE_LOCK)==0 && me->key && ob->shapenr) return 1; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 5b72e87f95a..d03c2b19300 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -519,6 +519,7 @@ static int sound_poll(bContext *C) static int pack_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Editing* ed = CTX_data_scene(C)->ed; bSound* sound; @@ -530,7 +531,7 @@ static int pack_exec(bContext *C, wmOperator *op) if(!sound || sound->packedfile) return OPERATOR_CANCELLED; - sound->packedfile= newPackedFile(op->reports, sound->name); + sound->packedfile= newPackedFile(op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id)); sound_load(CTX_data_main(C), sound); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 60662334e20..a05053a2d9d 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -233,7 +233,8 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max, cons /* get data to filter, from Action or Dopesheet */ // XXX: what is sel doing here?! - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); + // Commented it, was breaking things (eg. the "auto preview range" tool). + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_SEL *//*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* set large values to try to override */ @@ -458,6 +459,8 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op) /* copy keyframes */ if (ac.datatype == ANIMCONT_GPENCIL) { // FIXME... + BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil mode"); + return OPERATOR_CANCELLED; } else { if (copy_action_keys(&ac)) { @@ -496,13 +499,15 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - if(ac.reports==NULL) { + if (ac.reports==NULL) { ac.reports= op->reports; } /* paste keyframes */ if (ac.datatype == ANIMCONT_GPENCIL) { // FIXME... + BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for Grease Pencil mode"); + return OPERATOR_CANCELLED; } else { if (paste_action_keys(&ac, offset_mode, merge_mode)) { @@ -679,12 +684,13 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) duplicate_action_keys(&ac); /* validate keyframes after editing */ - ANIM_editkeyframes_refresh(&ac); + if (ac.datatype != ANIMCONT_GPENCIL) + ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); - return OPERATOR_FINISHED; // xxx - start transform + return OPERATOR_FINISHED; } static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) @@ -708,9 +714,6 @@ void ACTION_OT_duplicate (wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* to give to transform */ - RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); } /* ******************** Delete Keyframes Operator ************************* */ @@ -763,7 +766,8 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) delete_action_keys(&ac); /* validate keyframes after editing */ - ANIM_editkeyframes_refresh(&ac); + if (ac.datatype != ANIMCONT_GPENCIL) + ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); @@ -1380,6 +1384,10 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; + // XXX... + if (ac.datatype == ANIMCONT_GPENCIL) + return OPERATOR_PASS_THROUGH; + /* get snapping mode */ mode= RNA_enum_get(op->ptr, "type"); @@ -1490,6 +1498,10 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op) if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; + // XXX... + if (ac.datatype == ANIMCONT_GPENCIL) + return OPERATOR_PASS_THROUGH; + /* get mirroring mode */ mode= RNA_enum_get(op->ptr, "type"); diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 9d2ac3fd8e2..4a2860335fe 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -234,7 +234,7 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture) else if(buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; - if(ob && ob->type && (ob->type<OB_LAMP)) { + if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { ma= give_current_material(ob, ob->actcol); RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; @@ -721,8 +721,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(ptr) { Object *ob= ptr->data; - if(ob && ob->type && (ob->type<OB_LAMP) && ob->totcol) - CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1); + if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) { + /* a valid actcol isn't ensured [#27526] */ + int matnr= ob->actcol-1; + if(matnr < 0) matnr= 0; + CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]); + } } return 1; diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 5a965fc076b..1b9e3fdfb4a 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -138,7 +138,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) wmKeyMap *keymap; ListBase *lb; - const int prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ + const float prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index b2b734159ff..611bf79603e 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -111,8 +111,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar) { /* Button layout. */ const int max_x = ar->winx - 10; - const int line1_y = IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN*2; - const int line2_y = IMASEL_BUTTONS_MARGIN; + const int line1_y = ar->winy - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN); + const int line2_y = line1_y - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN); const int input_minw = 20; const int btn_h = UI_UNIT_Y; const int btn_fn_w = UI_UNIT_X; @@ -520,7 +520,7 @@ 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-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_WIDTH_SCALE); + file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE); sx += ICON_DEFAULT_WIDTH_SCALE + 4; } diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index fd52c3c4199..0955d264ca8 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1176,7 +1176,9 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) * until this is properly supported just disable it. */ static int file_directory_poll(bContext *C) { - return ED_operator_file_active(C) && filelist_lib(CTX_wm_space_file(C)->files) == NULL; + /* sfile->files can be NULL on file load */ + SpaceFile *sfile= CTX_wm_space_file(C); + return ED_operator_file_active(C) && (sfile->files==NULL || filelist_lib(sfile->files)==NULL); } void FILE_OT_directory(struct wmOperatorType *ot) diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 86be1538f1e..f56a4294bf4 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -244,7 +244,8 @@ static int compare_size(const void *a1, const void *a2) else return BLI_natstrcmp(entry1->relname,entry2->relname); } -static int compare_extension(const void *a1, const void *a2) { +static int compare_extension(const void *a1, const void *a2) +{ const struct direntry *entry1=a1, *entry2=a2; const char *sufix1, *sufix2; const char *nil=""; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 1e113abfcd2..e3571886cf4 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -246,6 +246,11 @@ short ED_fileselect_set_params(SpaceFile *sfile) sfile->folders_prev = folderlist_new(); folderlist_pushdir(sfile->folders_prev, sfile->params->dir); + /* switching thumbnails needs to recalc layout [#28809] */ + if (sfile->layout) { + sfile->layout->dirty= TRUE; + } + return 1; } @@ -466,12 +471,13 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar) int maxlen = 0; int numfiles; int textheight; + if (sfile->layout == NULL) { sfile->layout = MEM_callocN(sizeof(struct FileLayout), "file_layout"); - sfile->layout->dirty = 1; - } - - if (!sfile->layout->dirty) return; + sfile->layout->dirty = TRUE; + } else if (sfile->layout->dirty == FALSE) { + return; + } numfiles = filelist_numfiles(sfile->files); textheight = (int)file_font_pointsize(); @@ -538,7 +544,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar) layout->width = sfile->layout->columns * (layout->tile_w + 2*layout->tile_border_x) + layout->tile_border_x*2; layout->flag = FILE_LAYOUT_HOR; } - layout->dirty= 0; + layout->dirty= FALSE; } FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar) diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 18270bfaa26..7a70ed9c0a0 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -154,7 +154,7 @@ static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) SpaceFile *sfile= (SpaceFile*)sa->spacedata.first; //printf("file_init\n"); - if(sfile->layout) sfile->layout->dirty= 1; + if(sfile->layout) sfile->layout->dirty= TRUE; } @@ -242,7 +242,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) BLI_strncpy(sfile->params->renameedit, sfile->params->renamefile, sizeof(sfile->params->renameedit)); params->renamefile[0] = '\0'; } - if (sfile->layout) sfile->layout->dirty= 1; + if (sfile->layout) sfile->layout->dirty= TRUE; } @@ -520,9 +520,14 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); + /* scrolling here is just annoying, disable it */ + ar->v2d.cur.ymax= ar->v2d.cur.ymax - ar->v2d.cur.ymin; + ar->v2d.cur.ymin= 0; + /* set view2d view matrix for scrolling (without scrollers) */ UI_view2d_view_ortho(&ar->v2d); + file_draw_buttons(C, ar); UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 28fd1cd3304..f1593105d5b 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -245,13 +245,15 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT } /* update callback for active keyframe properties - base updates stuff */ -static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, void *UNUSED(bezt_ptr)) +static void graphedit_activekey_update_cb(bContext *C, void *fcu_ptr, void *UNUSED(bezt_ptr)) { + SpaceIpo *sipo= CTX_wm_space_graph(C); + const short use_handle = !(sipo->flag & SIPO_NOHANDLES); FCurve *fcu = (FCurve *)fcu_ptr; /* make sure F-Curve and its handles are still valid after this editing */ sort_time_fcurve(fcu); - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* update callback for active keyframe properties - handle-editing wrapper */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 45bd1d58a53..33c3ae45a58 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1567,6 +1567,7 @@ static int pack_test(bContext *C, wmOperator *op) static int pack_exec(bContext *C, wmOperator *op) { + struct Main *bmain= CTX_data_main(C); Image *ima= CTX_data_edit_image(C); ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); int as_png= RNA_boolean_get(op->ptr, "as_png"); @@ -1582,7 +1583,7 @@ static int pack_exec(bContext *C, wmOperator *op) if(as_png) BKE_image_memorypack(ima); else - ima->packedfile= newPackedFile(op->reports, ima->name); + ima->packedfile= newPackedFile(op->reports, ima->name, ID_BLEND_PATH(bmain, &ima->id)); WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima); diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 3121ddaa3b4..126d75e76cb 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -87,7 +87,7 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *repo if (bool) { bg[0]=220; bg[1]=128; bg[2]=96; } else { bg[0]=214; bg[1]=122; bg[2]=90; } } -#if 0 // XXX: this looks like the selected colour, so don't use this +#if 0 // XXX: this looks like the selected color, so don't use this else if (report->type & RPT_OPERATOR_ALL) { if (bool) { bg[0]=96; bg[1]=128; bg[2]=255; } else { bg[0]=90; bg[1]=122; bg[2]=249; } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 3a4371e8bb9..eec8bfb469b 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1747,6 +1747,7 @@ static int get_col_actuator(int type) case ACT_CONSTRAINT: return TH_PANEL; case ACT_STATE: return TH_PANEL; case ACT_ARMATURE: return TH_PANEL; + case ACT_STEERING: return TH_PANEL; default: return TH_PANEL; } } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 970eccb8be3..150847ce825 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1538,6 +1538,7 @@ static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), Poi static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "index", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_smooth_mask", 0, NULL, ICON_NONE); } static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1938,7 +1939,7 @@ static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), Poin /* only once called */ static void node_texture_set_butfunc(bNodeType *ntype) { - ntype->uifuncbut = NULL; + ntype->uifuncbut = NULL; if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) { ntype->uifunc = node_texture_buts_proc; } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 916e59eae9c..baa755ef841 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3266,7 +3266,8 @@ void NODE_OT_delete(wmOperatorType *ot) } /* ****************** Delete with reconnect ******************* */ -static int is_connected_to_input_socket(bNode* node, bNodeLink* link) { +static int is_connected_to_input_socket(bNode* node, bNodeLink* link) +{ bNodeSocket *sock; if (link->tonode == node) { for(sock= node->inputs.first; sock; sock= sock->next) { diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 3751d8efae8..8bc0ae51415 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -33,6 +33,7 @@ #ifndef ED_NODE_INTERN_H #define ED_NODE_INTERN_H +#include <stddef.h> /* for size_t */ #include "UI_interface.h" /* internal exports only */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 65ce2e71d8d..10ca482ae0e 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1248,7 +1248,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis==SO_DATABLOCKS && soops->search_string[0]!=0)) && (tselem->flag & TSE_SEARCHMATCH)) { - /* TODO - add search highlight colour to theme? */ + /* TODO - add search highlight color to theme? */ glColor4f(0.2f, 0.5f, 0.2f, 0.3f); glRecti(startx, *starty+1, ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1); } diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 49d8b6b5da4..673ddaebc5f 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -182,6 +182,10 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_NLA_ACTCHANGE: ED_region_tag_redraw(ar); break; + case ND_ANIMCHAN: + if(wmn->action==NA_SELECTED) + ED_region_tag_redraw(ar); + break; } break; } diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 89e9a22c9a1..a0999c9a03b 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -134,7 +134,7 @@ void SEQUENCER_OT_select_handles(struct wmOperatorType *ot); void SEQUENCER_OT_select_active_side(struct wmOperatorType *ot); void SEQUENCER_OT_select_border(struct wmOperatorType *ot); void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot); - +void SEQUENCER_OT_select_grouped(struct wmOperatorType *ot); /* sequencer_select.c */ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 5c13b57cca8..b53284136de 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -103,7 +103,8 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_select_handles); WM_operatortype_append(SEQUENCER_OT_select_active_side); WM_operatortype_append(SEQUENCER_OT_select_border); - + WM_operatortype_append(SEQUENCER_OT_select_grouped); + /* sequencer_add.c */ WM_operatortype_append(SEQUENCER_OT_scene_strip_add); WM_operatortype_append(SEQUENCER_OT_movie_strip_add); @@ -165,7 +166,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_meta_toggle", TABKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SEQUENCER_OT_meta_make", GKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_meta_make", GKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_meta_separate", GKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); @@ -247,6 +248,8 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_select_border", BKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_menu(keymap, "SEQUENCER_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_menu(keymap, "SEQUENCER_MT_change", CKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index a6cc65017bb..7e718dc176a 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -47,6 +47,7 @@ #include "DNA_scene_types.h" #include "BKE_context.h" +#include "BKE_report.h" #include "BKE_sequencer.h" #include "WM_api.h" @@ -169,11 +170,11 @@ static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) { if(seq->strip) - strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } else if(seq->type==SEQ_SOUND) { if(seq->strip) - strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } seq->flag|= SELECT; recurs_sel_seq(seq); @@ -389,12 +390,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) { if(seq->strip) { - strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } } else if (seq->type == SEQ_SOUND) { if(seq->strip) { - strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } } @@ -530,7 +531,8 @@ void SEQUENCER_OT_select(wmOperatorType *ot) /* run recursivly to select linked */ -static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { +static int select_more_less_seq__internal(Scene *scene, int sel, int linked) +{ Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq, *neighbor; int change=0; @@ -881,3 +883,270 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) /* rna */ WM_operator_properties_gesture_border(ot, FALSE); } + +/* ****** Selected Grouped ****** */ + +static EnumPropertyItem sequencer_prop_select_grouped_types[] = { + {1, "TYPE", 0, "Type", "Shared strip type"}, + {2, "TYPE_BASIC", 0, "Global Type", "All strips of same basic type (Graphical or Sound)"}, + {3, "TYPE_EFFECT", 0, "Effect Type", + "Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"}, + {4, "DATA", 0, "Data", "Shared data (scene, image, sound, etc.)"}, + {5, "EFFECT", 0, "Effect", "Shared effects"}, + {6, "EFFECT_LINK", 0, "Effect/Linked", + "Other strips affected by the active one (sharing some time, and below or effect-assigned)"}, + {7, "OVERLAP", 0, "Overlap", "Overlapping time"}, + {0, NULL, 0, NULL, NULL} +}; + +#define SEQ_IS_SOUND(_seq) ((_seq->type & SEQ_SOUND) && !(_seq->type & SEQ_EFFECT)) + +#define SEQ_IS_EFFECT(_seq) (_seq->type & SEQ_EFFECT) + +#define SEQ_USE_DATA(_seq) (_seq->type == SEQ_SCENE || SEQ_HAS_PATH(_seq)) + +static short select_grouped_type(Editing *ed, Sequence *actseq) +{ + Sequence *seq; + short changed = FALSE; + + SEQP_BEGIN(ed, seq) { + if (seq->type == actseq->type) { + seq->flag |= SELECT; + changed = TRUE; + } + } + SEQ_END; + + return changed; +} + +static short select_grouped_type_basic(Editing *ed, Sequence *actseq) +{ + Sequence *seq; + short changed = FALSE; + short is_sound = SEQ_IS_SOUND(actseq); + + SEQP_BEGIN(ed, seq) { + if (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq)) { + seq->flag |= SELECT; + changed = TRUE; + } + } + SEQ_END; + + return changed; +} + +static short select_grouped_type_effect(Editing *ed, Sequence *actseq) +{ + Sequence *seq; + short changed = FALSE; + short is_effect = SEQ_IS_EFFECT(actseq); + + SEQP_BEGIN(ed, seq) { + if (is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq)) { + seq->flag |= SELECT; + changed = TRUE; + } + } + SEQ_END; + + return changed; +} + +static short select_grouped_data(Editing *ed, Sequence *actseq) +{ + Sequence *seq; + short changed = FALSE; + Scene *sce = actseq->scene; + char *dir = actseq->strip ? actseq->strip->dir : NULL; + + if (!SEQ_USE_DATA(actseq)) + return changed; + + if (SEQ_HAS_PATH(actseq) && dir) { + SEQP_BEGIN(ed, seq) { + if (SEQ_HAS_PATH(seq) && seq->strip && strcmp(seq->strip->dir, dir) == 0) { + seq->flag |= SELECT; + changed = TRUE; + } + } + SEQ_END; + } + else { + SEQP_BEGIN(ed, seq) { + if (seq->type == SEQ_SCENE && seq->scene == sce) { + seq->flag |= SELECT; + changed = TRUE; + } + } + SEQ_END; + } + + return changed; +} + +static short select_grouped_effect(Editing *ed, Sequence *actseq) +{ + Sequence *seq; + short changed = FALSE; + short effects[SEQ_EFFECT_MAX+1]; + int i; + + for (i = 0; i <= SEQ_EFFECT_MAX; i++) + effects[i] = FALSE; + + SEQP_BEGIN(ed, seq) { + if (ELEM3(actseq, seq->seq1, seq->seq2, seq->seq3)) { + effects[seq->type] = TRUE; + } + } + SEQ_END; + + SEQP_BEGIN(ed, seq) { + if (effects[seq->type]) { + if(seq->seq1) seq->seq1->flag |= SELECT; + if(seq->seq2) seq->seq2->flag |= SELECT; + if(seq->seq3) seq->seq3->flag |= SELECT; + changed = TRUE; + } + } + SEQ_END; + + return changed; +} + +static short select_grouped_time_overlap(Editing *ed, Sequence *actseq) +{ + Sequence *seq; + short changed = FALSE; + + SEQP_BEGIN(ed, seq) { + if (!((seq->startdisp >= actseq->enddisp) || (seq->enddisp < actseq->startdisp))) { + seq->flag |= SELECT; + changed = TRUE; + } + } + SEQ_END; + + return changed; +} + +static short select_grouped_effect_link(Editing *ed, Sequence *actseq) +{ + Sequence *seq = NULL; + short changed = FALSE; + short is_audio = ((actseq->type == SEQ_META) || SEQ_IS_SOUND(actseq)); + int startdisp = actseq->startdisp; + int enddisp = actseq->enddisp; + int machine = actseq->machine; + SeqIterator iter; + + SEQP_BEGIN(ed, seq) { + seq->tmp= NULL; + } + SEQ_END; + + actseq->tmp= SET_INT_IN_POINTER(TRUE); + + for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) { + seq = iter.seq; + + /* Ignore all seqs already selected! */ + /* Ignore all seqs not sharing some time with active one. */ + /* Ignore all seqs of incompatible types (audio vs video). */ + if ((seq->flag & SELECT) || (seq->startdisp >= enddisp) || (seq->enddisp < startdisp) + || (!is_audio && SEQ_IS_SOUND(seq)) + || (is_audio && !((seq->type == SEQ_META) || SEQ_IS_SOUND(seq)))) + continue; + + /* If the seq is an effect one, we need extra cheking! */ + if (SEQ_IS_EFFECT(seq) && ((seq->seq1 && seq->seq1->tmp) || + (seq->seq2 && seq->seq2->tmp) || + (seq->seq3 && seq->seq3->tmp))) + { + if (startdisp > seq->startdisp) startdisp = seq->startdisp; + if (enddisp < seq->enddisp) enddisp = seq->enddisp; + if (machine < seq->machine) machine = seq->machine; + + seq->tmp= SET_INT_IN_POINTER(TRUE); + + seq->flag |= SELECT; + changed = TRUE; + + /* Unfortunately, we must restart checks from the begining. */ + seq_end(&iter); + seq_begin(ed, &iter, 1); + } + + /* Video strips bellow active one, or any strip for audio (order do no matters here!). */ + else if (seq->machine < machine || is_audio) { + seq->flag |= SELECT; + changed = TRUE; + } + } + seq_end(&iter); + + return changed; +} + +static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, 0); + Sequence *seq, *actseq = seq_active_get(scene); + int type = RNA_enum_get(op->ptr, "type"); + short changed = 0, extend; + + extend = RNA_boolean_get(op->ptr, "extend"); + + if (actseq == NULL) { + BKE_report(op->reports, RPT_ERROR, "No Active Sequence!"); + return OPERATOR_CANCELLED; + } + + if (extend == 0) { + SEQP_BEGIN(ed, seq) { + seq->flag &= ~SELECT; + changed = TRUE; + } + SEQ_END; + } + + if(type==1) changed |= select_grouped_type(ed, actseq); + else if(type==2) changed |= select_grouped_type_basic(ed, actseq); + else if(type==3) changed |= select_grouped_type_effect(ed, actseq); + else if(type==4) changed |= select_grouped_data(ed, actseq); + else if(type==5) changed |= select_grouped_effect(ed, actseq); + else if(type==6) changed |= select_grouped_effect_link(ed, actseq); + else if(type==7) changed |= select_grouped_time_overlap(ed, actseq); + + if (changed) { + WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); + return OPERATOR_FINISHED; + } + + return OPERATOR_CANCELLED; +} + +void SEQUENCER_OT_select_grouped(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Grouped"; + ot->description = "Select all strips grouped by various properties"; + ot->idname = "SEQUENCER_OT_select_grouped"; + + /* api callbacks */ + ot->invoke = WM_menu_invoke; + ot->exec = sequencer_select_grouped_exec; + ot->poll = sequencer_edit_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first"); + ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_select_grouped_types, 0, "Type", ""); +} + diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 4c617115a3d..10d355bd0c3 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1421,8 +1421,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar) y -= st->lheight; - strncpy(str, item->name, SUGG_LIST_WIDTH); - str[SUGG_LIST_WIDTH] = '\0'; + BLI_strncpy(str, item->name, SUGG_LIST_WIDTH); w = text_font_width(st, str); diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 51b4b838171..08008f455e6 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -51,7 +51,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) { - SuggItem *item, *first, *last, *sel; + SuggItem *item, *first, *last /* , *sel */ /* UNUSED */; TextLine *tmp; int l, x, y, w, h, i; int tgti, *top; @@ -62,7 +62,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) first = texttool_suggest_first(); last = texttool_suggest_last(); - sel = texttool_suggest_selected(); + /* sel = texttool_suggest_selected(); */ /* UNUSED */ top = texttool_suggest_top(); if(!last || !first) diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index fc35ab93f70..83a695ba72a 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -146,7 +146,7 @@ static void cp_shade_color3ub (unsigned char cp[3], const int offset) } /* This function sets the gl-color for coloring a certain bone (based on bcolor) */ -static short set_pchan_glColor (short colCode, int boneflag, int constflag) +static short set_pchan_glColor (short colCode, int boneflag, short constflag) { switch (colCode) { case PCHAN_COLOR_NORMAL: @@ -438,39 +438,39 @@ static void draw_bonevert_solid(void) } static float bone_octahedral_verts[6][3]= { - { 0.0f, 0.0f, 0.0f}, - { 0.1f, 0.1f, 0.1f}, - { 0.1f, 0.1f, -0.1f}, - {-0.1f, 0.1f, -0.1f}, - {-0.1f, 0.1f, 0.1f}, - { 0.0f, 1.0f, 0.0f} + { 0.0f, 0.0f, 0.0f}, + { 0.1f, 0.1f, 0.1f}, + { 0.1f, 0.1f, -0.1f}, + {-0.1f, 0.1f, -0.1f}, + {-0.1f, 0.1f, 0.1f}, + { 0.0f, 1.0f, 0.0f} }; static unsigned int bone_octahedral_wire_sides[8]= {0, 1, 5, 3, 0, 4, 5, 2}; static unsigned int bone_octahedral_wire_square[8]= {1, 2, 3, 4, 1}; static unsigned int bone_octahedral_solid_tris[8][3]= { - {2, 1, 0}, /* bottom */ - {3, 2, 0}, - {4, 3, 0}, - {1, 4, 0}, - - {5, 1, 2}, /* top */ - {5, 2, 3}, - {5, 3, 4}, - {5, 4, 1} + {2, 1, 0}, /* bottom */ + {3, 2, 0}, + {4, 3, 0}, + {1, 4, 0}, + + {5, 1, 2}, /* top */ + {5, 2, 3}, + {5, 3, 4}, + {5, 4, 1} }; /* aligned with bone_octahedral_solid_tris */ static float bone_octahedral_solid_normals[8][3]= { - { 0.70710683f, -0.70710683f, 0.00000000f}, - {-0.00000000f, -0.70710683f, -0.70710683f}, - {-0.70710683f, -0.70710683f, 0.00000000f}, - { 0.00000000f, -0.70710683f, 0.70710683f}, - { 0.99388373f, 0.11043154f, -0.00000000f}, - { 0.00000000f, 0.11043154f, -0.99388373f}, - {-0.99388373f, 0.11043154f, 0.00000000f}, - { 0.00000000f, 0.11043154f, 0.99388373f} + { 0.70710683f, -0.70710683f, 0.00000000f}, + {-0.00000000f, -0.70710683f, -0.70710683f}, + {-0.70710683f, -0.70710683f, 0.00000000f}, + { 0.00000000f, -0.70710683f, 0.70710683f}, + { 0.99388373f, 0.11043154f, -0.00000000f}, + { 0.00000000f, 0.11043154f, -0.99388373f}, + {-0.99388373f, 0.11043154f, 0.00000000f}, + { 0.00000000f, 0.11043154f, 0.99388373f} }; static void draw_bone_octahedral(void) @@ -697,13 +697,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= - *(si+a) * dirvec[0] + *(co+a) * norvec[0]; vec[1]= - *(si+a) * dirvec[1] + *(co+a) * norvec[1]; vec[2]= - *(si+a) * dirvec[2] + *(co+a) * norvec[2]; - - vec1[0]= headvec[0] + head*vec[0]; - vec1[1]= headvec[1] + head*vec[1]; - vec1[2]= headvec[2] + head*vec[2]; - vec2[0]= headvec[0] + (head+dist)*vec[0]; - vec2[1]= headvec[1] + (head+dist)*vec[1]; - vec2[2]= headvec[2] + (head+dist)*vec[2]; + + madd_v3_v3v3fl(vec1, headvec, vec, head); + madd_v3_v3v3fl(vec2, headvec, vec, head + dist); glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); @@ -715,13 +711,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= *(si+a) * dirvec[0] + *(co+a) * norvec[0]; vec[1]= *(si+a) * dirvec[1] + *(co+a) * norvec[1]; vec[2]= *(si+a) * dirvec[2] + *(co+a) * norvec[2]; - - vec1[0]= tailvec[0] + tail*vec[0]; - vec1[1]= tailvec[1] + tail*vec[1]; - vec1[2]= tailvec[2] + tail*vec[2]; - vec2[0]= tailvec[0] + (tail+dist)*vec[0]; - vec2[1]= tailvec[1] + (tail+dist)*vec[1]; - vec2[2]= tailvec[2] + (tail+dist)*vec[2]; + + madd_v3_v3v3fl(vec1, tailvec, vec, tail); + madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist); //glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); @@ -733,14 +725,10 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= - *(si) * dirvec[0] + *(co) * norvec[0]; vec[1]= - *(si) * dirvec[1] + *(co) * norvec[1]; vec[2]= - *(si) * dirvec[2] + *(co) * norvec[2]; - - vec1[0]= headvec[0] + head*vec[0]; - vec1[1]= headvec[1] + head*vec[1]; - vec1[2]= headvec[2] + head*vec[2]; - vec2[0]= headvec[0] + (head+dist)*vec[0]; - vec2[1]= headvec[1] + (head+dist)*vec[1]; - vec2[2]= headvec[2] + (head+dist)*vec[2]; - + + madd_v3_v3v3fl(vec1, headvec, vec, head); + madd_v3_v3v3fl(vec2, headvec, vec, head + dist); + //glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); //glColor4ub(255, 255, 255, 0); @@ -752,7 +740,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel /* smat, imat = mat & imat to draw screenaligned */ -static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float head, tail /*, length*/; float *headvec, *tailvec, dirvec[3]; @@ -839,21 +827,17 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, glLoadName(id | BONESEL_BONE); glBegin(GL_LINES); - vec[0]= headvec[0] + norvech[0]; - vec[1]= headvec[1] + norvech[1]; - vec[2]= headvec[2] + norvech[2]; + + add_v3_v3v3(vec, headvec, norvech); glVertex3fv(vec); - vec[0]= tailvec[0] + norvect[0]; - vec[1]= tailvec[1] + norvect[1]; - vec[2]= tailvec[2] + norvect[2]; + + add_v3_v3v3(vec, tailvec, norvect); glVertex3fv(vec); - vec[0]= headvec[0] - norvech[0]; - vec[1]= headvec[1] - norvech[1]; - vec[2]= headvec[2] - norvech[2]; + + sub_v3_v3v3(vec, headvec, norvech); glVertex3fv(vec); - vec[0]= tailvec[0] - norvect[0]; - vec[1]= tailvec[1] - norvect[1]; - vec[2]= tailvec[2] - norvect[2]; + + sub_v3_v3v3(vec, tailvec, norvect); glVertex3fv(vec); glEnd(); @@ -861,7 +845,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, } /* does wire only for outline selecting */ -static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { GLUquadricObj *qobj; float head, tail, length; @@ -991,7 +975,7 @@ static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0}; static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38}; -static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float length; @@ -1125,7 +1109,7 @@ static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float l } } -static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float xwidth, length, zwidth; @@ -1238,7 +1222,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len } } -static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { Mat4 *bbones = NULL; int segments = 0; @@ -1288,7 +1272,7 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, uns draw_wire_bone_segments(pchan, bbones, length, segments); } -static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, float length) +static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, float length) { /* Draw a 3d octahedral bone, we use normalized space based on length, @@ -1659,7 +1643,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, float smat[4][4], imat[4][4], bmat[4][4]; int index= -1; short do_dashed= 3, draw_wire= 0; - short flag, constflag; + int flag; /* being set below */ arm->layer_used= 0; @@ -1880,6 +1864,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) { if (bone->layer & arm->layer) { + const short constflag= pchan->constflag; if ((do_dashed & 1) && (pchan->parent)) { /* Draw a line from our root to the parent's tip * - only if V3D_HIDE_HELPLINES is enabled... @@ -1901,16 +1886,16 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, * - only if temporary chain (i.e. "autoik") */ if (arm->flag & ARM_POSEMODE) { - if (pchan->constflag & PCHAN_HAS_IK) { + if (constflag & PCHAN_HAS_IK) { if (bone->flag & BONE_SELECTED) { - if (pchan->constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0); + if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0); else glColor3ub(200, 200, 50); // add theme! glLoadName(index & 0xFFFF); pchan_draw_IK_root_lines(pchan, !(do_dashed & 2)); } } - else if (pchan->constflag & PCHAN_HAS_SPLINEIK) { + else if (constflag & PCHAN_HAS_SPLINEIK) { if (bone->flag & BONE_SELECTED) { glColor3ub(150, 200, 50); // add theme! @@ -1935,7 +1920,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, flag |= BONE_DRAW_ACTIVE; /* extra draw service for pose mode */ - constflag= pchan->constflag; /* set color-set to use */ set_pchan_colorset(ob, pchan); diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 546e5ccba5d..76263f5ac3d 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -309,16 +309,24 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) { unsigned char obcol[4]; - int istex, solidtex= 0; + int istex, solidtex; // XXX scene->obedit warning - if(v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) { + + /* texture draw is abused for mask selection mode, do this so wire draw + * with face selection in weight paint is not lit. */ + if((v3d->drawtype <= OB_WIRE) && (ob->mode & OB_MODE_WEIGHT_PAINT)) { + solidtex= FALSE; + Gtexdraw.islit= 0; + } + else if(v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) { /* draw with default lights in solid draw mode and edit mode */ - solidtex= 1; + solidtex= TRUE; Gtexdraw.islit= -1; } else { /* draw with lights in the scene otherwise */ + solidtex= FALSE; Gtexdraw.islit= GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp); } @@ -442,9 +450,9 @@ static void add_tface_color_layer(DerivedMesh *dm) } } else if (tface && tface->mode&TF_OBCOL) { for(j=0;j<4;j++) { - finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[0]); + finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]); finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]); - finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[2]); + finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[2]); } } else if (!mcol) { if (tface) { @@ -463,9 +471,9 @@ static void add_tface_color_layer(DerivedMesh *dm) else copy_v3_v3(col, &ma->r); for(j=0;j<4;j++) { - finalCol[i*4+j].b = FTOCHAR(col[2]); + finalCol[i*4+j].b = FTOCHAR(col[0]); finalCol[i*4+j].g = FTOCHAR(col[1]); - finalCol[i*4+j].r = FTOCHAR(col[0]); + finalCol[i*4+j].r = FTOCHAR(col[2]); } } else @@ -477,9 +485,9 @@ static void add_tface_color_layer(DerivedMesh *dm) } } else { for(j=0;j<4;j++) { - finalCol[i*4+j].b = mcol[i*4+j].r; + finalCol[i*4+j].r = mcol[i*4+j].r; finalCol[i*4+j].g = mcol[i*4+j].g; - finalCol[i*4+j].r = mcol[i*4+j].b; + finalCol[i*4+j].b = mcol[i*4+j].b; } } } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5c0c6917b4a..14708259a8a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1370,15 +1370,12 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob { /* a standing up pyramid with (0,0,0) as top */ Camera *cam; - float vec[8][4], facx, facy, depth, aspx, aspy, caspx, caspy, shx, shy; + float tvec[3]; + float vec[4][3], asp[2], shift[2], scale[3]; int i; float drawsize; const short is_view= (rv3d->persp==RV3D_CAMOB && ob==v3d->camera); - const float scax= 1.0f / len_v3(ob->obmat[0]); - const float scay= 1.0f / len_v3(ob->obmat[1]); - const float scaz= 1.0f / len_v3(ob->obmat[2]); - #ifdef VIEW3D_CAMERA_BORDER_HACK if(is_view && !(G.f & G_PICKSEL)) { glGetFloatv(GL_CURRENT_COLOR, view3d_camera_border_hack_col); @@ -1388,82 +1385,43 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob #endif cam= ob->data; - aspx= (float) scene->r.xsch*scene->r.xasp; - aspy= (float) scene->r.ysch*scene->r.yasp; - if(aspx < aspy) { - caspx= aspx / aspy; - caspy= 1.0; - } - else { - caspx= 1.0; - caspy= aspy / aspx; - } - - glDisable(GL_LIGHTING); - glDisable(GL_CULL_FACE); - - if(cam->type==CAM_ORTHO) { - facx= 0.5f * cam->ortho_scale * caspx * scax; - facy= 0.5f * cam->ortho_scale * caspy * scay; - shx= cam->shiftx * cam->ortho_scale * scax; - shy= cam->shifty * cam->ortho_scale * scay; - depth= is_view ? -((cam->clipsta * scaz) + 0.1f) : - cam->drawsize * cam->ortho_scale * scaz; - - drawsize= 0.5f * cam->ortho_scale; - } - else { - /* that way it's always visible - clipsta+0.1 */ - float fac; - drawsize= cam->drawsize / ((scax + scay + scaz) / 3.0f); + scale[0]= 1.0f / len_v3(ob->obmat[0]); + scale[1]= 1.0f / len_v3(ob->obmat[1]); + scale[2]= 1.0f / len_v3(ob->obmat[2]); - if(is_view) { - /* fixed depth, variable size (avoids exceeding clipping range) */ - depth = -(cam->clipsta + 0.1f); - fac = depth / (cam->lens/-16.0f * scaz); - } - else { - /* fixed size, variable depth (stays a reasonable size in the 3D view) */ - depth= drawsize * cam->lens/-16.0f * scaz; - fac= drawsize; - } + camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale, + asp, shift, &drawsize, vec); - facx= fac * caspx * scax; - facy= fac * caspy * scay; - shx= cam->shiftx*fac*2 * scax; - shy= cam->shifty*fac*2 * scay; - } - - vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.0; - vec[1][0]= shx + facx; vec[1][1]= shy + facy; vec[1][2]= depth; - vec[2][0]= shx + facx; vec[2][1]= shy - facy; vec[2][2]= depth; - vec[3][0]= shx - facx; vec[3][1]= shy - facy; vec[3][2]= depth; - vec[4][0]= shx - facx; vec[4][1]= shy + facy; vec[4][2]= depth; + glDisable(GL_LIGHTING); + glDisable(GL_CULL_FACE); /* camera frame */ glBegin(GL_LINE_LOOP); - glVertex3fv(vec[1]); - glVertex3fv(vec[2]); - glVertex3fv(vec[3]); - glVertex3fv(vec[4]); + glVertex3fv(vec[0]); + glVertex3fv(vec[1]); + glVertex3fv(vec[2]); + glVertex3fv(vec[3]); glEnd(); if(is_view) return; + zero_v3(tvec); + /* center point to camera frame */ glBegin(GL_LINE_STRIP); - glVertex3fv(vec[2]); - glVertex3fv(vec[0]); - glVertex3fv(vec[1]); - glVertex3fv(vec[4]); - glVertex3fv(vec[0]); - glVertex3fv(vec[3]); + glVertex3fv(vec[1]); + glVertex3fv(tvec); + glVertex3fv(vec[0]); + glVertex3fv(vec[3]); + glVertex3fv(tvec); + glVertex3fv(vec[2]); glEnd(); /* arrow on top */ - vec[0][2]= depth; + tvec[2]= vec[1][2]; /* copy the depth */ /* draw an outline arrow for inactive cameras and filled @@ -1474,16 +1432,16 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES); else break; - vec[0][0]= shx + ((-0.7f * drawsize) * scax); - vec[0][1]= shy + ((drawsize * (caspy + 0.1f)) * scay); - glVertex3fv(vec[0]); /* left */ + tvec[0]= shift[0] + ((-0.7f * drawsize) * scale[0]); + tvec[1]= shift[1] + ((drawsize * (asp[1] + 0.1f)) * scale[1]); + glVertex3fv(tvec); /* left */ - vec[0][0]= shx + ((0.7f * drawsize) * scax); - glVertex3fv(vec[0]); /* right */ + tvec[0]= shift[0] + ((0.7f * drawsize) * scale[0]); + glVertex3fv(tvec); /* right */ - vec[0][0]= shx; - vec[0][1]= shy + ((1.1f * drawsize * (caspy + 0.7f)) * scay); - glVertex3fv(vec[0]); /* top */ + tvec[0]= shift[0]; + tvec[1]= shift[1] + ((1.1f * drawsize * (asp[1] + 0.7f)) * scale[1]); + glVertex3fv(tvec); /* top */ glEnd(); } @@ -1757,7 +1715,8 @@ static void drawSelectedVertices__mapFunc(void *userData, int index, float *co, } } -static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) { +static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) +{ glBegin(GL_POINTS); dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, me->mvert); glEnd(); @@ -1816,7 +1775,9 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *ce if (efa && efa->h==0 && efa->fgonf!=EM_FGON) { view3d_project_short_clip(data->vc.ar, cent, s, 1); - data->func(data->userData, efa, s[0], s[1], index); + if (s[0] != IS_CLIPPED) { + data->func(data->userData, efa, s[0], s[1], index); + } } } @@ -5170,8 +5131,6 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star } } else { - a= 0; - fac= (float)(CIRCLE_RESOL-1) * tot_inv; x= sinval[start] * fac; y= cosval[start] * fac; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 6c69e816b30..0ad36657196 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -126,7 +126,7 @@ typedef struct { float ob_scale[3]; // need temp space due to linked values float ob_dims[3]; short link_scale; - float ve_median[6]; + float ve_median[7]; int curdef; float *defweightp; } TransformProperties; @@ -138,11 +138,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL; MDeformVert *dvert=NULL; TransformProperties *tfp; - float median[6], ve_median[6]; + float median[7], ve_median[7]; int tot, totw, totweight, totedge, totradius; char defstr[320]; - - median[0]= median[1]= median[2]= median[3]= median[4]= median[5]= 0.0; + + median[0]= median[1]= median[2]= median[3]= median[4]= median[5]= median[6]= 0.0; tot= totw= totweight= totedge= totradius= 0; defstr[0]= 0; @@ -171,6 +171,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float if((eed->f & SELECT)) { totedge++; median[3]+= eed->crease; + median[6]+= eed->bweight; } eed= eed->next; } @@ -284,7 +285,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float median[0] /= (float)tot; median[1] /= (float)tot; median[2] /= (float)tot; - if(totedge) median[3] /= (float)totedge; + if (totedge) { + median[3] /= (float)totedge; + median[6] /= (float)totedge; + } else if(totw) median[3] /= (float)totw; if(totweight) median[4] /= (float)totweight; if(totradius) median[5] /= (float)totradius; @@ -299,78 +303,82 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiBlockBeginAlign(block); if(tot==1) { - uiDefBut(block, LABEL, 0, "Vertex:", 0, 130, 200, 20, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "Vertex:", 0, 150, 200, 20, NULL, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 110, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, ""); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 130, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, 90, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, ""); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, 110, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 70, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); if(totw==1) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 50, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 25, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 25, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); + uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); + uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); uiBlockEndAlign(block); if(totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 0, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, ""); if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); } else { uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); + uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); + uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); uiBlockEndAlign(block); if(totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, ""); if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); } } else { - uiDefBut(block, LABEL, 0, "Median:", 0, 130, 200, 20, NULL, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "Median:", 0, 150, 200, 20, NULL, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 110, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, ""); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 130, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, 90, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, ""); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, 110, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); - but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 70, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); + but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); if(totw==tot) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 50, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); uiBlockEndAlign(block); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 25, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 25, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); + uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); + uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); uiBlockEndAlign(block); if(totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 0, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal"); if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); uiBlockEndAlign(block); } else { uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); - uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); + uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); + uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); uiBlockEndAlign(block); if(totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal"); if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); uiBlockEndAlign(block); } } - - if(totedge==1) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease:", 0, 20, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, ""); - else if(totedge>1) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Crease:", 0, 20, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, ""); - + + if(totedge==1){ + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease:", 0, 40, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Bevel Weight:", 0, 20, 200, 20, &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, ""); + } + else if(totedge>1){ + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Crease:", 0, 40, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Bevel Weight:", 0, 20, 200, 20, &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, ""); + } + } else { // apply memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median)); @@ -384,6 +392,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float median[3]= ve_median[3]-median[3]; median[4]= ve_median[4]-median[4]; median[5]= ve_median[5]-median[5]; + median[6]= ve_median[6]-median[6]; if(ob->type==OB_MESH) { Mesh *me= ob->data; @@ -405,7 +414,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float if(median[3] != 0.0f) { EditEdge *eed; const float fixed_crease= (ve_median[3] <= 0.0f ? 0.0f : (ve_median[3] >= 1.0f ? 1.0f : FLT_MAX)); - + if(fixed_crease != FLT_MAX) { /* simple case */ @@ -449,6 +458,52 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float } } + if (median[6] != 0.0f) { + EditEdge *eed; + const float fixed_bweight= (ve_median[6] <= 0.0f ? 0.0f : (ve_median[6] >= 1.0f ? 1.0f : FLT_MAX)); + + if(fixed_bweight != FLT_MAX) { + /* simple case */ + + for(eed= em->edges.first; eed; eed= eed->next) { + if(eed->f & SELECT) { + eed->bweight= fixed_bweight; + } + } + } + else { + /* scale crease to target median */ + float median_new= ve_median[6]; + float median_orig= ve_median[6] - median[6]; /* previous median value */ + + /* incase of floating point error */ + CLAMP(median_orig, 0.0f, 1.0f); + CLAMP(median_new, 0.0f, 1.0f); + + if(median_new < median_orig) { + /* scale down */ + const float sca= median_new / median_orig; + + for(eed= em->edges.first; eed; eed= eed->next) { + if(eed->f & SELECT) { + eed->bweight *= sca; + CLAMP(eed->bweight, 0.0f, 1.0f); + } + } + } + else { + /* scale up */ + const float sca= (1.0f - median_new) / (1.0f - median_orig); + + for(eed= em->edges.first; eed; eed= eed->next) { + if(eed->f & SELECT) { + eed->bweight = 1.0f - ((1.0f - eed->bweight) * sca); + CLAMP(eed->bweight, 0.0f, 1.0f); + } + } + } + } + } BKE_mesh_end_editmesh(me, em); } else if(ob->type==OB_CURVE || ob->type==OB_SURF) { @@ -840,8 +895,11 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) if (ptr->type == &RNA_Object) { Object *ob = ptr->data; - if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) + /* dimensions and material support just happen to be the same checks + * later we may want to add dimensions for lattice, armature etc too */ + if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) { uiItemR(layout, ptr, "dimensions", 0, "Dimensions", ICON_NONE); + } } } @@ -986,6 +1044,7 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob) uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NONE); uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NONE); + uiItemR(col, &eboneptr, "envelope_distance", 0, "Envelope", ICON_NONE); } static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) @@ -1223,7 +1282,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) Object *ob= OBACT; // TransformProperties *tfp; // UNUSED PointerRNA obptr; - uiLayout *col, *row; + uiLayout *col /* , *row */ /* UNUSED */; float lim; if(ob==NULL) return; @@ -1251,7 +1310,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL); col= uiLayoutColumn(pa->layout, 0); - row= uiLayoutRow(col, 0); + /* row= uiLayoutRow(col, 0); */ /* UNUSED */ RNA_id_pointer_create(&ob->id, &obptr); if(ob==obedit) { diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 30d1a508888..02a6cee5140 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -35,6 +35,7 @@ #include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_camera_types.h" #include "MEM_guardedalloc.h" @@ -62,49 +63,57 @@ #include "view3d_intern.h" // own include /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ -#define FLY_MODAL_CANCEL 1 -#define FLY_MODAL_CONFIRM 2 -#define FLY_MODAL_ACCELERATE 3 -#define FLY_MODAL_DECELERATE 4 -#define FLY_MODAL_PAN_ENABLE 5 -#define FLY_MODAL_PAN_DISABLE 6 -#define FLY_MODAL_DIR_FORWARD 7 -#define FLY_MODAL_DIR_BACKWARD 8 -#define FLY_MODAL_DIR_LEFT 9 -#define FLY_MODAL_DIR_RIGHT 10 -#define FLY_MODAL_DIR_UP 11 -#define FLY_MODAL_DIR_DOWN 12 -#define FLY_MODAL_AXIS_LOCK_X 13 -#define FLY_MODAL_AXIS_LOCK_Z 14 -#define FLY_MODAL_PRECISION_ENABLE 15 -#define FLY_MODAL_PRECISION_DISABLE 16 +enum { + FLY_MODAL_CANCEL= 1, + FLY_MODAL_CONFIRM, + FLY_MODAL_ACCELERATE, + FLY_MODAL_DECELERATE, + FLY_MODAL_PAN_ENABLE, + FLY_MODAL_PAN_DISABLE, + FLY_MODAL_DIR_FORWARD, + FLY_MODAL_DIR_BACKWARD, + FLY_MODAL_DIR_LEFT, + FLY_MODAL_DIR_RIGHT, + FLY_MODAL_DIR_UP, + FLY_MODAL_DIR_DOWN, + FLY_MODAL_AXIS_LOCK_X, + FLY_MODAL_AXIS_LOCK_Z, + FLY_MODAL_PRECISION_ENABLE, + FLY_MODAL_PRECISION_DISABLE, + FLY_MODAL_FREELOOK_ENABLE, + FLY_MODAL_FREELOOK_DISABLE + +}; /* called in transform_ops.c, on each regeneration of keymaps */ void fly_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, - {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, - {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""}, - {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""}, + {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""}, + {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""}, - {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""}, - {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""}, + {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""}, + {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""}, - {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""}, - {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""}, - {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""}, - {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""}, - {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""}, - {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""}, + {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""}, + {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""}, + {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""}, + {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""}, + {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""}, + {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""}, - {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"}, - {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"}, + {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"}, + {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"}, - {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""}, - {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""}, + {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""}, + {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""}, - {0, NULL, 0, NULL, NULL}}; + {FLY_MODAL_FREELOOK_ENABLE, "FREELOOK_ENABLE", 0, "Rotation Enable", ""}, + {FLY_MODAL_FREELOOK_DISABLE, "FREELOOK_DISABLE", 0, "Rotation Disable", ""}, + + {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Fly Modal"); @@ -122,10 +131,10 @@ void fly_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, SPACEKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM); WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE); - WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE); - WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE); - WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE); + WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE); + WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE); + WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE); + WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE); /* XXX - Bug in the event system, middle mouse release doesnt work */ @@ -144,6 +153,9 @@ void fly_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_PRECISION_ENABLE); WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PRECISION_DISABLE); + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_FREELOOK_ENABLE); + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_FREELOOK_DISABLE); + /* assign map to operators */ WM_modalkeymap_assign(keymap, "VIEW3D_OT_fly"); } @@ -158,8 +170,9 @@ typedef struct FlyInfo { wmTimer *timer; /* needed for redraws */ short state; - short use_precision; short redraw; + unsigned char use_precision; + unsigned char use_freelook; /* if the user presses shift they can look about without movinf the direction there looking */ int mval[2]; /* latest 2D mouse values */ wmNDOFMotionData* ndof; /* latest 3D mouse values */ @@ -187,6 +200,10 @@ typedef struct FlyInfo { float rot_backup[4]; /* backup the views quat incase the user cancels flying in non camera mode. (quat for view, eul for camera) */ short persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */ + short is_ortho_cam; /* are we flying an ortho camera in perspective view, + * which was originall in ortho view? + * could probably figure it out but better be explicit */ + void *obtfm; /* backup the objects transform */ /* compare between last state */ @@ -289,7 +306,8 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->xlock_momentum=0.0f; fly->zlock_momentum=0.0f; fly->grid= 1.0f; - fly->use_precision= 0; + fly->use_precision= FALSE; + fly->use_freelook= FALSE; #ifdef NDOF_FLY_DRAW_TOOMUCH fly->redraw= 1; @@ -317,6 +335,17 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->persp_backup= fly->rv3d->persp; fly->dist_backup= fly->rv3d->dist; + + /* check for flying ortho camera - which we cant support well + * we _could_ also check for an ortho camera but this is easier */ + if( (fly->rv3d->persp == RV3D_CAMOB) && + (fly->v3d->camera != NULL) && + (fly->rv3d->is_persp == FALSE)) + { + ((Camera *)fly->v3d->camera->data)->type= CAM_PERSP; + fly->is_ortho_cam= TRUE; + } + if (fly->rv3d->persp==RV3D_CAMOB) { Object *ob_back; if ((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) { @@ -420,6 +449,10 @@ static int flyEnd(bContext *C, FlyInfo *fly) /*Done with correcting for the dist */ } + if(fly->is_ortho_cam) { + ((Camera *)fly->v3d->camera->data)->type= CAM_ORTHO; + } + rv3d->rflag &= ~RV3D_NAVIGATING; //XXX2.5 BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */ @@ -516,10 +549,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->speed= 0.0f; } else { - if (event->shift) - fly->speed += fly->grid*time_wheel * 0.1f; - else - fly->speed += fly->grid*time_wheel; + fly->speed += fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f); } break; } @@ -537,10 +567,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->speed=0; } else { - if (event->shift) - fly->speed-= fly->grid*time_wheel * 0.1f; - else - fly->speed-= fly->grid*time_wheel; + fly->speed-= fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f); } break; } @@ -605,6 +632,13 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) case FLY_MODAL_PRECISION_DISABLE: fly->use_precision= FALSE; break; + + case FLY_MODAL_FREELOOK_ENABLE: + fly->use_freelook= TRUE; + break; + case FLY_MODAL_FREELOOK_DISABLE: + fly->use_freelook= FALSE; + break; } } } @@ -704,8 +738,6 @@ static int flyApply(bContext *C, FlyInfo *fly) // cent_orig[2], /* view center */ //XXX- can avoid using // cent[2], /* view center modified */ xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */ - unsigned char - apply_rotation= 1; /* if the user presses shift they can look about without movinf the direction there looking*/ #ifdef NDOF_FLY_DEBUG static unsigned int iteration = 1; @@ -888,7 +920,7 @@ static int flyApply(bContext *C, FlyInfo *fly) } - if (apply_rotation) { + if (!fly->use_freelook) { /* Normal operation */ /* define dvec, view direction vector */ dvec_tmp[0]= dvec_tmp[1]= dvec_tmp[2]= 0.0f; @@ -896,9 +928,15 @@ static int flyApply(bContext *C, FlyInfo *fly) dvec_tmp[fly->axis]= 1.0f; mul_m3_v3(mat, dvec_tmp); - - mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f); } + else { + normalize_v3_v3(dvec_tmp, fly->dvec_prev); + if(fly->speed < 0.0f) { + negate_v3(dvec_tmp); + } + } + + mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f); } /* impose a directional lag */ @@ -967,11 +1005,9 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) float speed = 10.f; /* blender units per second */ /* ^^ this is ok for default cube scene, but should scale with.. something */ - float trans[3] = { - lateral_sensitivity * ndof->tvec[0], - vertical_sensitivity * ndof->tvec[1], - forward_sensitivity * ndof->tvec[2] - }; + float trans[3] = {lateral_sensitivity * ndof->tvec[0], + vertical_sensitivity * ndof->tvec[1], + forward_sensitivity * ndof->tvec[2]}; if (fly->use_precision) speed *= 0.2f; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 44d85af858c..fd27dc65a0e 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -530,7 +530,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) row= uiLayoutRow(layout, 1); uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + + /* pose/object only however we want to allow in weight paint mode too + * so dont be totally strict and just check not-editmode for now */ + if (obedit == NULL) { + uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + } /* Transform widget / manipulators */ row= uiLayoutRow(layout, 1); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 1c98397c7f6..4f5e98a24ce 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1946,7 +1946,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) /* much like facesel_face_pick()*/ /* returns 0 if not found, otherwise 1 */ -static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, short rect) +static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, int size) { ViewContext vc; view3d_set_viewcontext(C, &vc); @@ -1954,12 +1954,12 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un if (!me || me->totvert==0) return 0; - if (rect) { + if (size > 0) { /* sample rect to increase changes of selecting, so that when clicking on an face in the backbuf, we can still select a vert */ int dist; - *index = view3d_sample_backbuf_rect(&vc, mval, 3, 1, me->totvert+1, &dist,0,NULL, NULL); + *index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert+1, &dist,0,NULL, NULL); } else { /* sample only on the exact position */ @@ -1981,7 +1981,8 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor Mesh* me= obact->data; /* already checked for NULL */ unsigned int index = 0; MVert *mv; - if(vertsel_vert_pick(C, me, mval, &index, 1)) { + + if(vertsel_vert_pick(C, me, mval, &index, 50)) { mv = me->mvert+index; if(extend) { mv->flag ^= SELECT; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 1ed65f7875f..fa3007d2fb7 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -65,6 +65,7 @@ #include "ED_armature.h" #include "ED_mesh.h" +#include "ED_keyframing.h" #include "ED_screen.h" #include "ED_curve.h" /* for curve_editnurbs */ @@ -494,6 +495,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) } else { + struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location"); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if(ob->mode & OB_MODE_POSE) { @@ -522,6 +524,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) pchan->loc[0]= vecN[1]; if ((pchan->protectflag & OB_LOCK_LOCZ)==0) pchan->loc[0]= vecN[2]; + + /* auto-keyframing */ + ED_autokeyframe_pchan(C, scene, ob, pchan, ks); } /* if the bone has a parent and is connected to the parent, * don't do anything - will break chain unless we do auto-ik. @@ -531,8 +536,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) } ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); - /* auto-keyframing */ -// XXX autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { @@ -556,7 +559,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) ob->loc[2]+= vec[2]; /* auto-keyframing */ -// XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION); + ED_autokeyframe_object(C, scene, ob, ks); } } CTX_DATA_END; @@ -622,6 +625,8 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) } else { + struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location"); + CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if(ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; @@ -648,6 +653,9 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) pchan->loc[1]= curspn[1]; if ((pchan->protectflag & OB_LOCK_LOCZ)==0) pchan->loc[2]= curspn[2]; + + /* auto-keyframing */ + ED_autokeyframe_pchan(C, scene, ob, pchan, ks); } /* if the bone has a parent and is connected to the parent, * don't do anything - will break chain unless we do auto-ik. @@ -657,8 +665,6 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) } ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); - /* auto-keyframing */ -// XXX autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { @@ -680,9 +686,9 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) ob->loc[1]+= vec[1]; if ((ob->protectflag & OB_LOCK_LOCZ)==0) ob->loc[2]+= vec[2]; - + /* auto-keyframing */ -// XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION); + ED_autokeyframe_object(C, scene, ob, ks); } } CTX_DATA_END; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index df4f615e5f1..bec1206a983 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1789,7 +1789,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) { #ifdef WITH_GAMEENGINE Scene *startscene = CTX_data_scene(C); - ScrArea *sa, *prevsa= CTX_wm_area(C); + ScrArea /* *sa, */ /* UNUSED */ *prevsa= CTX_wm_area(C); ARegion *ar, *prevar= CTX_wm_region(C); wmWindow *prevwin= CTX_wm_window(C); RegionView3D *rv3d; @@ -1802,7 +1802,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; rv3d= CTX_wm_region_view3d(C); - sa= CTX_wm_area(C); + /* sa= CTX_wm_area(C); */ /* UNUSED */ ar= CTX_wm_region(C); view3d_operator_needs_opengl(C); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c6381f4b311..992c047ecd3 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1355,6 +1355,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) int proportional = 0; PropertyRNA *prop; + // Save back mode in case we're in the generic operator + if ((prop= RNA_struct_find_property(op->ptr, "mode"))) { + RNA_property_enum_set(op->ptr, prop, t->mode); + } + if ((prop= RNA_struct_find_property(op->ptr, "value"))) { float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; if (RNA_property_array_check(prop)) { @@ -2601,27 +2606,18 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { } /* local constraint shouldn't alter center */ - if (t->around == V3D_LOCAL) { - if (t->flag & T_OBJECT) { - copy_v3_v3(center, td->center); - } - else if (t->flag & T_EDIT) { - - if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { - copy_v3_v3(center, td->center); - } - else { - copy_v3_v3(center, t->center); - } - } - else { - copy_v3_v3(center, t->center); - } + if ((t->around == V3D_LOCAL) && + ( (t->flag & (T_OBJECT|T_POSE)) || + ((t->flag & T_EDIT) && (t->settings->selectmode & SCE_SELECT_FACE)) || + (t->obedit && t->obedit->type == OB_ARMATURE)) + ) + { + copy_v3_v3(center, td->center); } else { copy_v3_v3(center, t->center); } - + if (td->ext) { float fsize[3]; @@ -2894,19 +2890,17 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short float vec[3], totmat[3][3], smat[3][3]; float eul[3], fmat[3][3], quat[4]; float *center = t->center; - + /* local constraint shouldn't alter center */ if (around == V3D_LOCAL) { - if (t->flag & (T_OBJECT|T_POSE)) { + if ( (t->flag & (T_OBJECT|T_POSE)) || + (t->settings->selectmode & SCE_SELECT_FACE) || + (t->obedit && t->obedit->type == OB_ARMATURE)) + { center = td->center; } - else { - if(around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { - center = td->center; - } - } } - + if (t->flag & T_POINTS) { mul_m3_m3m3(totmat, mat, td->mtx); mul_m3_m3m3(smat, td->smtx, totmat); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 485344875d4..2f177239f44 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -425,8 +425,8 @@ typedef struct TransInfo { #define TD_BEZTRIPLE (1 << 12) /* if this is a bez triple, we need to restore the handles, if this is set transdata->misc.hdata needs freeing */ #define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */ #define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */ -#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */ -#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */ +#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */ +#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */ #define TD_MOVEHANDLE1 (1 << 17) /* For fcurve handles, move them along with their keyframes */ #define TD_MOVEHANDLE2 (1 << 18) #define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 83f79eae4f2..c4295b15858 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1194,7 +1194,7 @@ static void createTransArmatureVerts(TransInfo *t) if (ebo->flag & BONE_TIPSEL) { copy_v3_v3(td->iloc, ebo->tail); - copy_v3_v3(td->center, td->iloc); + copy_v3_v3(td->center, (t->around==V3D_LOCAL) ? ebo->head : td->iloc); td->loc= ebo->tail; td->flag= TD_SELECTED; if (ebo->flag & BONE_EDITMODE_LOCKED) @@ -2193,6 +2193,12 @@ void flushTransNodes(TransInfo *t) } /* *** SEQUENCE EDITOR *** */ + +/* commented _only_ because the meta may have animaion data which + * needs moving too [#28158] */ + +#define SEQ_TX_NESTED_METAS + void flushTransSeq(TransInfo *t) { ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check already done */ @@ -2218,9 +2224,13 @@ void flushTransSeq(TransInfo *t) switch (tdsq->sel_flag) { case SELECT: +#ifdef SEQ_TX_NESTED_METAS + if ((seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ + seq->start= new_frame - tdsq->start_offset; +#else if (seq->type != SEQ_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ seq->start= new_frame - tdsq->start_offset; - +#endif if (seq->depth==0) { seq->machine= (int)floor(td2d->loc[1] + 0.5f); CLAMP(seq->machine, 1, MAXSEQ); @@ -2275,7 +2285,7 @@ void flushTransSeq(TransInfo *t) seq_prev= seq; } - if (t->mode == TFM_TIME_TRANSLATE) { /* originally TFM_TIME_EXTEND, transform changes */ + if (t->mode == TFM_SEQ_SLIDE) { /* originally TFM_TIME_EXTEND, transform changes */ /* Special annoying case here, need to calc metas with TFM_TIME_EXTEND only */ seq= seqbasep->first; @@ -2775,7 +2785,7 @@ static void posttrans_gpd_clean (bGPdata *gpd) /* Called during special_aftertrans_update to make sure selected keyframes replace * any other keyframes which may reside on that frame (that is not selected). */ -static void posttrans_fcurve_clean (FCurve *fcu) +static void posttrans_fcurve_clean (FCurve *fcu, const short use_handle) { float *selcache; /* cache for frame numbers of selected frames (fcu->totvert*sizeof(float)) */ int len, index, i; /* number of frames in cache, item index */ @@ -2824,7 +2834,7 @@ static void posttrans_fcurve_clean (FCurve *fcu) } } - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* free cache */ @@ -2855,11 +2865,11 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act) if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); - posttrans_fcurve_clean(ale->key_data); + posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */ ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else - posttrans_fcurve_clean(ale->key_data); + posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */ } /* free temp data */ @@ -2880,12 +2890,11 @@ static int count_fcurve_keys(FCurve *fcu, char side, float cfra) /* only include points that occur on the right side of cfra */ for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { if (bezt->f2 & SELECT) { - /* fully select the other two keys */ - bezt->f1 |= SELECT; - bezt->f3 |= SELECT; - - if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) + /* no need to adjust the handle selection since they are assumed + * selected (like graph editor with SIPO_NOHANDLES) */ + if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) { count += 1; + } } } @@ -3310,9 +3319,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */ for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { - const char sel1= use_handle ? bezt->f1 & SELECT : 0; const char sel2= bezt->f2 & SELECT; - const char sel3= use_handle ? bezt->f3 & SELECT : 0; + const char sel1= use_handle ? bezt->f1 & SELECT : sel2; + const char sel3= use_handle ? bezt->f3 & SELECT : sel2; if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) { /* for 'normal' pivots - just include anything that is selected. @@ -3403,9 +3412,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */ for (i=0, bezt= fcu->bezt; i < fcu->totvert; i++, bezt++) { if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { - const char sel1= use_handle ? bezt->f1 & SELECT : 0; const char sel2= bezt->f2 & SELECT; - const char sel3= use_handle ? bezt->f3 & SELECT : 0; + const char sel1= use_handle ? bezt->f1 & SELECT : sel2; + const char sel3= use_handle ? bezt->f3 & SELECT : sel2; TransDataCurveHandleFlags *hdata = NULL; /* short h1=1, h2=1; */ /* UNUSED */ @@ -3465,7 +3474,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } /* Sets handles based on the selection */ - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* cleanup temp list */ @@ -3669,7 +3678,7 @@ void remake_graph_transdata (TransInfo *t, ListBase *anim_data) sort_time_fcurve(fcu); /* make sure handles are all set correctly */ - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } } } @@ -3827,6 +3836,11 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count else { /* Nested, different rules apply */ +#ifdef SEQ_TX_NESTED_METAS + *flag= (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL); + *count= 1; /* ignore the selection for nested */ + *recursive = (seq->type == SEQ_META ); +#else if (seq->type == SEQ_META) { /* Meta's can only directly be moved between channels since they * dont have their start and length set directly (children affect that) @@ -3841,6 +3855,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count *count= 1; /* ignore the selection for nested */ *recursive = 0; } +#endif } } } @@ -4765,10 +4780,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if(t->mode == TFM_SEQ_SLIDE) { if(t->frame_side == 'B') - ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_TRANSLATE, t->vec[0], t->frame_side); + ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_TRANSLATE, t->values[0], t->frame_side); } else if (ELEM(t->frame_side, 'L', 'R')) { - ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_EXTEND, t->vec[0], t->frame_side); + ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_EXTEND, t->values[0], t->frame_side); } } @@ -4816,11 +4831,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t) { if (adt) { ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1); - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */ ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1); } else - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */ } } @@ -4877,16 +4892,16 @@ void special_aftertrans_update(bContext *C, TransInfo *t) #if 0 if (ELEM(t->frame_side, 'L', 'R')) { /* TFM_TIME_EXTEND */ /* same as below */ - ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->vec[0], t->frame_side); + ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->values[0], t->frame_side); } else /* TFM_TIME_TRANSLATE */ #endif { - ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->vec[0], t->frame_side); + ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->values[0], t->frame_side); } } else if (t->mode == TFM_TIME_SCALE) { - ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->vec[0], t->frame_side); + ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->values[0], t->frame_side); } } @@ -4900,6 +4915,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) else if (t->spacetype == SPACE_IPO) { SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; bAnimContext ac; + const short use_handle = !(sipo->flag & SIPO_NOHANDLES); /* initialise relevant anim-context 'context' data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -4928,11 +4944,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t) { if (adt) { ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0); - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, use_handle); ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0); } else - posttrans_fcurve_clean(fcu); + posttrans_fcurve_clean(fcu, use_handle); } } @@ -5227,6 +5243,11 @@ static void createTransNodeData(bContext *C, TransInfo *t) SpaceNode *snode= t->sa->spacedata.first; bNode *node; + if(!snode->edittree) { + t->total= 0; + return; + } + /* set transform flags on nodes */ for (node=snode->edittree->nodes.first; node; node=node->next) { if ((node->flag & NODE_SELECT) || (node->parent && (node->parent->flag & NODE_TRANSFORM))) @@ -5314,7 +5335,7 @@ void createTransData(bContext *C, TransInfo *t) t->ext = NULL; if (t->obedit->type == OB_MESH) { createTransEditVerts(C, t); - } + } else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) { createTransCurveVerts(C, t); } @@ -5327,7 +5348,7 @@ void createTransData(bContext *C, TransInfo *t) else if (t->obedit->type==OB_ARMATURE) { t->flag &= ~T_PROP_EDIT; createTransArmatureVerts(t); - } + } else { printf("edit type not implemented!\n"); } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 38776b51c62..b5f622b747b 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1187,6 +1187,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->options |= CTX_NO_PET; } + // Mirror is not supported with PET, turn it off. + if (t->flag & T_PROP_EDIT) + { + t->flag &= ~T_MIRROR; + } + setTransformViewMatrices(t); initNumInput(&t->num); @@ -1270,7 +1276,8 @@ void applyTransObjects(TransInfo *t) recalcData(t); } -static void restoreElement(TransData *td) { +static void restoreElement(TransData *td) +{ /* TransData for crease has no loc */ if (td->loc) { copy_v3_v3(td->loc, td->iloc); diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index b3608305a7a..a1e1c0e0b1d 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -118,7 +118,8 @@ static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const int mval[ output[1] *= mi->factor; } -static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float x, pad; pad = t->ar->winx / 10; @@ -135,7 +136,8 @@ static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2] output[0] = (x - pad) / (t->ar->winx - 2 * pad); } -static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float vec[3]; InputVector(t, mi, mval, vec); @@ -144,7 +146,8 @@ static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval output[0] = dot_v3v3(t->viewinv[0], vec) * 2.0f; } -static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float y, pad; pad = t->ar->winy / 10; @@ -160,7 +163,8 @@ static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], output[0] = (y - pad) / (t->ar->winy - 2 * pad); } -static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { +static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) +{ float vec[3]; InputVector(t, mi, mval, vec); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 17fd7517d71..4342d0de751 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1584,7 +1584,8 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo return retval; } -static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mval[2], int *dist, float *loc, float *no, SnapMode mode) { +static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mval[2], int *dist, float *loc, float *no, SnapMode mode) +{ Base *base; float depth = FLT_MAX; int retval = 0; @@ -1914,7 +1915,8 @@ int peelObjectsContext(bContext *C, ListBase *depth_peels, float mval[2]) static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action); -void snapGridAction(TransInfo *t, float *val, GearsType action) { +void snapGridAction(TransInfo *t, float *val, GearsType action) +{ float fac[3]; fac[NO_GEARS] = t->snap[0]; @@ -1925,7 +1927,8 @@ void snapGridAction(TransInfo *t, float *val, GearsType action) { } -void snapGrid(TransInfo *t, float *val) { +void snapGrid(TransInfo *t, float *val) +{ GearsType action; // Only do something if using Snap to Grid diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 3dd7514429e..d46f4b0ed30 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -171,7 +171,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha pup= uiPupMenuBegin(C, "Unpack file", ICON_NONE); layout= uiPupMenuLayout(pup); - sprintf(line, "Remove Pack"); + strcpy(line, "Remove Pack"); props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_REMOVE); RNA_string_set(&props_ptr, "id", id_name); diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index bcbc134d06d..f38ae136f71 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -142,7 +142,7 @@ void undo_editmode_push(bContext *C, const char *name, /* make new */ curundo= uel= MEM_callocN(sizeof(UndoElem), "undo editmode"); - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); BLI_addtail(&undobase, uel); uel->getdata= getdata; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index c1aca61f795..55fda84874d 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -471,7 +471,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even if(totitem > 0) { uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); uiLayout *layout= uiPupMenuLayout(pup); - uiLayout *split= uiLayoutSplit(layout, 0, 0), *column; + uiLayout *split= uiLayoutSplit(layout, 0, 0), *column = NULL; int i, c; for(c=0, i=totitem-1; i >= 0; i--, c++) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 846b05c1287..1b117a15516 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2624,7 +2624,7 @@ static PBool p_chart_abf_solve(PChart *chart) PEdge *e, *e1, *e2, *e3; PAbfSystem sys; int i; - float lastnorm, limit = (chart->nfaces > 100)? 1.0f: 0.001f; + float /* lastnorm, */ /* UNUSED */ limit = (chart->nfaces > 100)? 1.0f: 0.001f; /* setup id's */ sys.ninterior = sys.nfaces = sys.nangles = 0; @@ -2703,12 +2703,12 @@ static PBool p_chart_abf_solve(PChart *chart) p_abf_compute_sines(&sys); /* iteration */ - lastnorm = 1e10; + /* lastnorm = 1e10; */ /* UNUSED */ for (i = 0; i < ABF_MAX_ITER; i++) { float norm = p_abf_compute_gradient(&sys, chart); - lastnorm = norm; + /* lastnorm = norm; */ /* UNUSED */ if (norm < limit) break; @@ -3609,7 +3609,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f { SmoothNode *node = BLI_memarena_alloc(arena, sizeof *node); int axis, i, t1size = 0, t2size = 0; - float split, mi, mx; + float split, /* mi, */ /* UNUSED */ mx; SmoothTriangle **t1, **t2, *t; node->tri = tri; @@ -3650,7 +3650,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f node->axis = axis; node->split = split; - mi = bmin[axis]; + /* mi = bmin[axis]; */ /* UNUSED */ mx = bmax[axis]; bmax[axis] = split; node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth+1); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index ce3a378ea00..2bf62b73424 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -629,7 +629,7 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i if(smoothnormal) { /* copy vertex normal */ normal_short_to_float_v3(&varray[start], mvert[f->v1].no); - normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no); + normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no); normal_short_to_float_v3(&varray[start+6], mvert[f->v3].no); if(f->v4) { @@ -1058,7 +1058,8 @@ void GPU_uvedge_setup(DerivedMesh *dm) GLStates |= GPU_BUFFER_VERTEX_STATE; } -static int GPU_typesize(int type) { +static int GPU_typesize(int type) +{ switch(type) { case GL_FLOAT: return sizeof(float); @@ -1075,7 +1076,8 @@ static int GPU_typesize(int type) { } } -int GPU_attrib_element_size(GPUAttrib data[], int numdata) { +int GPU_attrib_element_size(GPUAttrib data[], int numdata) +{ int i, elementsize = 0; for(i = 0; i < numdata; i++) { @@ -1086,7 +1088,8 @@ int GPU_attrib_element_size(GPUAttrib data[], int numdata) { return elementsize; } -void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numdata) { +void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numdata) +{ int i; int elementsize; intptr_t offset = 0; diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 4f79d577ae5..c5d62559056 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -717,7 +717,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap) } 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"); + 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, @@ -1136,6 +1136,9 @@ int GPU_enable_material(int nr, void *attribs) GMS.lastretval = !GMS.lastretval; if(GMS.lastretval) { + /* for alpha pass, use alpha blend */ + alphablend = (GMS.alphapass)? GPU_BLEND_ALPHA: GPU_BLEND_SOLID; + if(gattribs && GMS.gmatbuf[nr]) { /* bind glsl material and get attributes */ Material *mat = GMS.gmatbuf[nr]; @@ -1145,7 +1148,11 @@ int GPU_enable_material(int nr, void *attribs) GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT)); GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col); GMS.gboundmat= mat; - alphablend= mat->game.alpha_blend; + + /* for glsl use alpha blend mode, unless it's set to solid and + we are already drawing in an alpha pass */ + if(mat->game.alpha_blend != GPU_BLEND_SOLID) + alphablend= mat->game.alpha_blend; if(GMS.alphapass) glDepthMask(1); } @@ -1154,11 +1161,9 @@ int GPU_enable_material(int nr, void *attribs) glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, GMS.matbuf[nr].diff); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, GMS.matbuf[nr].spec); glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, GMS.matbuf[nr].hard); - alphablend= GPU_BLEND_SOLID; } /* set (alpha) blending mode */ - if(!GMS.alphapass) alphablend= GPU_BLEND_SOLID; GPU_set_material_alpha_blend(alphablend); } diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index c3cbcb61622..a792b51e1cf 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -903,7 +903,7 @@ static void do_material_tex(GPUShadeInput *shi) /*char *lastuvname = NULL;*/ /*UNUSED*/ float one = 1.0f, norfac, ofs[3]; int tex_nr, rgbnor, talpha; - int init_done = 0, iBumpSpacePrev; + int init_done = 0, iBumpSpacePrev = 0; /* Not necessary, quiting gcc warning. */ GPUNodeLink *vNorg, *vNacc, *fPrevMagnitude; int iFirstTimeNMap=1; int found_deriv_map = 0; @@ -1101,7 +1101,12 @@ static void do_material_tex(GPUShadeInput *shi) if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) hScale = hScaleTex; - norfac = hScale * mtex->norfac; + + // The negate on norfac is done because the + // normal in the renderer points inward which corresponds + // to inverting the bump map. Should this ever change + // this negate must be removed. + norfac = -hScale * mtex->norfac; tnorfac = GPU_uniform(&norfac); if(GPU_link_changed(stencil)) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 3c3cecc0e96..b9500c2f798 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -900,8 +900,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, long long st_time; struct anim_index * tc_index = 0; AVStream * v_st; - int new_frame_index; - int old_frame_index; + int new_frame_index = 0; /* To quite gcc barking... */ + int old_frame_index = 0; /* To quite gcc barking... */ if (anim == 0) return (0); diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index d79acc88a80..bfec60245b8 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -101,8 +101,8 @@ static int checkbmp(unsigned char *mem) return(ret_val); } -int imb_is_a_bmp(unsigned char *buf) { - +int imb_is_a_bmp(unsigned char *buf) +{ return checkbmp(buf); } @@ -200,8 +200,8 @@ static int putShortLSB(unsigned short us,FILE *ofile) { } /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ -int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) { - +int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) +{ BMPINFOHEADER infoheader; int bytesize, extrabytes, x, y, t, ptr; uchar *data; diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 1ac4e4e06cb..49f81edd4b2 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -111,7 +111,8 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float ** */ /* function assumes out to be zero'ed, only does RGBA */ -static float P(float k){ +static float P(float k) +{ float p1, p2, p3, p4; p1 = MAX2(k+2.0f,0); p2 = MAX2(k+1.0f,0); @@ -123,7 +124,8 @@ static float P(float k){ #if 0 /* older, slower function, works the same as above */ -static float P(float k){ +static float P(float k) +{ return (float)(1.0f/6.0f)*( pow( MAX2(k+2.0f,0) , 3.0f ) - 4.0f * pow( MAX2(k+1.0f,0) , 3.0f ) + 6.0f * pow( MAX2(k,0) , 3.0f ) - 4.0f * pow( MAX2(k-1.0f,0) , 3.0f)); } #endif diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 2e45c0eb07a..d79e881e5a2 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -183,9 +183,9 @@ struct anim_index * IMB_indexer_open(const char * name) BLI_strncpy(idx->name, name, sizeof(idx->name)); - fseek(fp, 0, SEEK_END); + fseek(fp, 0, SEEK_END); - idx->num_entries = (ftell(fp) - 12) + idx->num_entries = (ftell(fp) - 12) / (sizeof(int) // framepos + sizeof(unsigned long long) // seek_pos + sizeof(unsigned long long) // seek_pos_dts diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c index d1202136d56..aa258a6b9ee 100644 --- a/source/blender/imbuf/intern/indexer_dv.c +++ b/source/blender/imbuf/intern/indexer_dv.c @@ -56,7 +56,8 @@ static unsigned long bitstream_get_bits(indexer_dv_bitstream * This, int num) return rval; } -static int parse_num(indexer_dv_bitstream * b, int numbits) { +static int parse_num(indexer_dv_bitstream * b, int numbits) +{ return bitstream_get_bits(b, numbits); } diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index b87b46ca464..53d4a403190 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -84,8 +84,8 @@ type 3 is unsupported as of jul 05 2000 Frank. static int jpeg_default_quality; static int ibuf_ftype; -int imb_is_a_jpeg(unsigned char *mem) { - +int imb_is_a_jpeg(unsigned char *mem) +{ if ((mem[0]== 0xFF) && (mem[1] == 0xD8))return 1; return 0; } diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 88f6508d356..e064d7f760d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -98,7 +98,7 @@ class Mem_IStream: public IStream public: Mem_IStream (unsigned char *exrbuf, size_t exrsize): - IStream("dummy"), _exrpos (0), _exrsize(exrsize) { _exrbuf = exrbuf; } + IStream("dummy"), _exrpos (0), _exrsize(exrsize) { _exrbuf = exrbuf; } virtual bool read (char c[], int n); virtual Int64 tellg (); @@ -107,8 +107,8 @@ public: //virtual ~Mem_IStream() {}; // unused private: - - Int64 _exrpos; + + Int64 _exrpos; Int64 _exrsize; unsigned char *_exrbuf; }; @@ -116,11 +116,11 @@ private: bool Mem_IStream::read (char c[], int n) { if (n + _exrpos <= _exrsize) - { + { memcpy(c, (void *)(&_exrbuf[_exrpos]), n); _exrpos += n; return true; - } + } else return false; } @@ -308,7 +308,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags delete [] pixels; } catch (const std::exception &exc) - { + { printf("OpenEXR-save: ERROR: %s\n", exc.what()); if (ibuf) IMB_freeImBuf(ibuf); @@ -365,7 +365,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag delete file; } catch (const std::exception &exc) - { + { printf("OpenEXR-save: ERROR: %s\n", exc.what()); if (ibuf) IMB_freeImBuf(ibuf); diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index ec00b15c079..c757b435d90 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -338,7 +338,8 @@ static int checktarga(TARGA *tga, unsigned char *mem) return(1); } -int imb_is_a_targa(unsigned char *buf) { +int imb_is_a_targa(unsigned char *buf) +{ TARGA tga; return checktarga(&tga, buf); diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 0fdb84617ad..93d942756c5 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -125,7 +125,7 @@ typedef struct Library { enum eIconSizes { ICON_SIZE_ICON, - ICON_SIZE_PREVIEW, + ICON_SIZE_PREVIEW }; #define NUM_ICON_SIZES (ICON_SIZE_PREVIEW + 1) @@ -205,6 +205,10 @@ typedef struct PreviewImage { #define ID_REAL_USERS(id) (((ID *)id)->us - ((((ID *)id)->flag & LIB_FAKEUSER) ? 1:0)) +#define ID_CHECK_UNDO(id) ((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM)) + +#define ID_BLEND_PATH(_bmain, _id) ((_id)->lib ? (_id)->lib->filepath : (_bmain)->name) + #ifdef GS #undef GS #endif diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index b7a8f21d724..128f19b504b 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -93,7 +93,7 @@ typedef struct ClothCollSettings { struct LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */ float epsilon; /* min distance for collisions. */ - float self_friction; /* Fiction/damping with self contact. */ + float self_friction; /* Fiction/damping with self contact. */ float friction; /* Friction/damping applied on contact with other object.*/ float selfepsilon; /* for selfcollision */ float repel_force, distance_repel; diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 1be2c811a1b..e04bdd4ec45 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -344,7 +344,7 @@ typedef struct bPivotConstraint { * Either target object + offset, or just offset is used */ struct Object *tar; /* target object (optional) */ - char subtarget[32]; /* subtarget name (optional) */ + char subtarget[32]; /* subtarget name (optional) */ float offset[3]; /* offset from the target to use, regardless of whether it exists */ /* Rotation-driven activation: diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 43a4b99bc33..8fe8b3bcf70 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -56,7 +56,7 @@ typedef struct IpoDriver { short blocktype, adrcode; /* sub-channel to use */ short type, flag; /* driver settings */ - char name[128]; /* bone, or python expression here */ + char name[128]; /* bone, or python expression here */ } IpoDriver; /* --- IPO Curve --- */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index e9e78ab25d3..0344e6da0ff 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -74,7 +74,7 @@ typedef enum ModifierType { eModifierType_WeightVGEdit, eModifierType_WeightVGMix, eModifierType_WeightVGProximity, - eModifierType_NavMesh, + eModifierType_EmptySlot, /* keep so DynamicPaint keep loading, can re-use later */ eModifierType_DynamicPaint, /* reserve slot */ NUM_MODIFIER_TYPES } ModifierType; @@ -751,10 +751,6 @@ typedef struct ScrewModifierData { #define MOD_SCREW_OBJECT_OFFSET (1<<2) // #define MOD_SCREW_OBJECT_ANGLE (1<<4) -typedef struct NavMeshModifierData { - ModifierData modifier; -} NavMeshModifierData; - typedef struct WarpModifierData { ModifierData modifier; @@ -808,7 +804,7 @@ typedef struct WeightVGEditModifierData { /* Mapping stuff. */ struct CurveMapping *cmap_curve; /* The custom mapping curve! */ - /* The add/remove vertices weight thresholds. */ + /* The add/remove vertices weight thresholds. */ float add_threshold, rem_threshold; /* Masking options. */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index f32f8d626de..f0c7cf8cc45 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -321,6 +321,9 @@ typedef struct DupliObject { /* 23 and 24 are for life and sector (old file compat.) */ #define OB_ARMATURE 25 +/* check if the object type supports materials */ +#define OB_TYPE_SUPPORT_MATERIAL(_type) ((_type) >= OB_MESH && (_type) <= OB_MBALL) + /* partype: first 4 bits: type */ #define PARTYPE 15 #define PAROBJECT 0 diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 69ee530c0b6..9fec5207dbb 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -179,10 +179,12 @@ typedef struct ParticleSettings { float simplify_rate, simplify_transition; float simplify_viewport; - /* general values */ + /* time and emission */ float sta, end, lifetime, randlife; - float timetweak, jitfac, eff_hair, grid_rand; + float timetweak, courant_target; + float jitfac, eff_hair, grid_rand, ps_offset[1]; int totpart, userjit, grid_res, effector_amount; + short time_flag, time_pad[3]; /* initial velocity factors */ float normfac, obfac, randfac, partfac, tanfac, tanphase, reactfac; @@ -288,6 +290,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in struct ParticleDrawData *pdd; float *frand; /* array of 1024 random floats for fast lookups */ + + float dt_frac; /* current time step, as a fraction of a frame */ + float _pad; /* spare capacity */ }ParticleSystem; /* part->type */ @@ -402,6 +407,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_SIMPLIFY_ENABLE 1 #define PART_SIMPLIFY_VIEWPORT 2 +/* part->time_flag */ +#define PART_TIME_AUTOSF 1 /* Automatic subframes */ + /* part->bb_align */ #define PART_BB_X 0 #define PART_BB_Y 1 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 790f1bf542f..916c3eb9582 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -241,8 +241,8 @@ typedef struct RenderData { short stereomode; /* standalone player stereo settings */ // XXX deprecated since 2.5 short dimensionspreset; /* for the dimensions presets menu */ - - short filtertype; /* filter is box, tent, gauss, mitch, etc */ + + short filtertype; /* filter is box, tent, gauss, mitch, etc */ short size, maximsize; /* size in %, max in Kb */ /* from buttons: */ @@ -431,8 +431,7 @@ typedef struct GameFraming { #define SCE_GAMEFRAMING_EXTEND 1 #define SCE_GAMEFRAMING_SCALE 2 -typedef struct RecastData -{ +typedef struct RecastData { float cellsize; float cellheight; float agentmaxslope; @@ -446,6 +445,7 @@ typedef struct RecastData int vertsperpoly; float detailsampledist; float detailsamplemaxerror; + short pad1, pad2; } RecastData; typedef struct GameData { @@ -458,8 +458,7 @@ typedef struct GameData { /* stereo/dome mode */ struct GameDome dome; short stereoflag, stereomode; - short pad2, pad3; - float eyeseparation, pad1; + float eyeseparation; RecastData recastData; @@ -475,17 +474,19 @@ typedef struct GameData { * bit 3: (gameengine): Activity culling is enabled. * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling */ - short mode, flag, matmode, pad[2]; + int flag; + short mode, matmode; short occlusionRes; /* resolution of occlusion Z buffer in pixel */ short physicsEngine; + short pad[2]; short ticrate, maxlogicstep, physubstep, maxphystep; - short obstacleSimulation; + short obstacleSimulation, pad1; float levelHeight; } GameData; #define STEREO_NOSTEREO 1 -#define STEREO_ENABLED 2 -#define STEREO_DOME 3 +#define STEREO_ENABLED 2 +#define STEREO_DOME 3 //#define STEREO_NOSTEREO 1 #define STEREO_QUADBUFFERED 2 @@ -525,9 +526,9 @@ typedef struct GameData { #define GAME_IGNORE_DEPRECATION_WARNINGS (1 << 12) #define GAME_ENABLE_ANIMATION_RECORD (1 << 13) #define GAME_SHOW_MOUSE (1 << 14) -#define GAME_SHOW_OBSTACLE_SIMULATION (1 << 15) #define GAME_GLSL_NO_COLOR_MANAGEMENT (1 << 15) -/* Note: GameData.flag is a short (max 16 flags). To add more flags, GameData.flag needs to be an int */ +#define GAME_SHOW_OBSTACLE_SIMULATION (1 << 16) +/* Note: GameData.flag is now an int (max 32 flags). A short could only take 16 flags */ /* GameData.matmode */ #define GAME_MAT_TEXFACE 0 @@ -843,7 +844,7 @@ typedef struct Scene { void *sound_scrub_handle; void *speaker_handles; - void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ + void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ /* none of the dependancy graph vars is mean to be saved */ struct DagForest *theDag; diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 6e850a07d94..d878a759d22 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -466,6 +466,7 @@ typedef struct TexMapping { #define MTEX_5TAP_BUMP 512 #define MTEX_BUMP_OBJECTSPACE 1024 #define MTEX_BUMP_TEXTURESPACE 2048 +#define MTEX_BUMP_FLIPPED 4096 /* temp flag for 2.59/2.60 */ /* blendtype */ #define MTEX_BLEND 0 diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 47ebf111eba..9e94ebfb6e8 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -295,6 +295,7 @@ typedef struct wmKeyConfig { /* wmKeyConfig.flag */ #define KEYCONF_USER (1 << 1) +#define KEYCONF_INIT_DEFAULT (1 << 2) /* this one is the operator itself, stored in files for macros etc */ /* operator + operatortype should be able to redo entirely, but for different contextes */ diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 5edebfe3903..e9fd2b2baa2 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -27,7 +27,7 @@ # message(STATUS "Configuring makesdna") -# add_definitions(-DWITH_DNA_GHASH) +add_definitions(-DWITH_DNA_GHASH) blender_include_dirs( ../../../../intern/guardedalloc diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index b56c536c0c3..3975c56d0eb 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -380,7 +380,7 @@ extern StructRNA RNA_OperatorFileListElement; extern StructRNA RNA_OperatorMousePath; extern StructRNA RNA_OperatorProperties; extern StructRNA RNA_OperatorStrokeElement; -extern StructRNA RNA_OperatorTypeMacro; +extern StructRNA RNA_OperatorMacro; extern StructRNA RNA_OrController; extern StructRNA RNA_OutflowFluidSettings; extern StructRNA RNA_PackedFile; @@ -808,6 +808,7 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop); int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *t_ptr); int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr); int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr); +int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr); int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr); /* efficient functions to set properties for arrays */ diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index e003b7198b8..9b87bbc2f4e 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -173,7 +173,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item); void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set); 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_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, const char *assignint); void RNA_def_property_srna(PropertyRNA *prop, const char *type); void RNA_def_py_data(PropertyRNA *prop, void *py_data); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 8e8a2133b89..4e1177996ef 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -230,8 +230,8 @@ typedef struct CollectionPropertyIterator { int level; /* external */ - int valid; PointerRNA ptr; + int valid; } CollectionPropertyIterator; typedef struct CollectionPointerLink { @@ -274,13 +274,13 @@ typedef struct ParameterList { /* storage for parameters */ void *data; + /* function passed at creation time */ + struct FunctionRNA *func; + /* store the parameter size */ int alloc_size; int arg_count, ret_count; - - /* function passed at creation time */ - struct FunctionRNA *func; } ParameterList; typedef struct ParameterIterator { diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index c80150d558b..9f248f973a1 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -64,6 +64,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core','player'], priority = [165,20] ) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 79d4dfd72ca..c59841ede64 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -96,6 +96,7 @@ set(APISRC rna_actuator_api.c rna_animation_api.c rna_armature_api.c + rna_camera_api.c rna_controller_api.c rna_fcurve_api.c rna_image_api.c @@ -221,7 +222,7 @@ if(WITH_OPENCOLLADA) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() # Build makesrna executable diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index ef05875fe86..d710dd06a17 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -99,7 +99,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') makesrna_tool.Append(CPPDEFINES=defs) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 4216b6a5ff0..c5b3a7aff59 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2279,7 +2279,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring)); + fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring), rna_function_string(cprop->assignint)); if(cprop->item_type) fprintf(f, "&RNA_%s\n", (char*)cprop->item_type); else fprintf(f, "NULL\n"); break; @@ -2432,7 +2432,7 @@ static RNAProcessItem PROCESS_ITEMS[]= { {"rna_armature.c", "rna_armature_api.c", RNA_def_armature}, {"rna_boid.c", NULL, RNA_def_boid}, {"rna_brush.c", NULL, RNA_def_brush}, - {"rna_camera.c", NULL, RNA_def_camera}, + {"rna_camera.c", "rna_camera_api.c", RNA_def_camera}, {"rna_cloth.c", NULL, RNA_def_cloth}, {"rna_color.c", NULL, RNA_def_color}, {"rna_constraint.c", NULL, RNA_def_constraint}, diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 951988864d2..cb1137fbe57 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -317,6 +317,14 @@ static int rna_IDPArray_length(PointerRNA *ptr) return prop->len; } +int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr) +{ + ID *id= ptr->id.data; + Material *mat_id= assign_ptr->id.data; + assign_material_id(id, mat_id, key + 1); + return 1; +} + #else static void rna_def_ID_properties(BlenderRNA *brna) @@ -370,7 +378,7 @@ static void rna_def_ID_properties(BlenderRNA *brna) prop= RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "PropertyGroup"); - RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL, NULL); RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY); // never tested, maybe its useful to have this? diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b7709416a75..8047b2df226 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -470,7 +470,7 @@ static const char *rna_ensure_property_description(PropertyRNA *prop) description= ((IDProperty*)prop)->name; /* XXX - not correct */ } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS)) description= BLF_gettext(description); #endif @@ -487,7 +487,7 @@ static const char *rna_ensure_property_name(PropertyRNA *prop) else name= ((IDProperty*)prop)->name; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) name= BLF_gettext(name); #endif @@ -1095,6 +1095,7 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop) if(cprop->item_type) return cprop->item_type; } + /* ignore other types, RNA_struct_find_nested calls with unchecked props */ return &RNA_UnknownType; } @@ -1111,7 +1112,7 @@ int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *va return 1; } - printf("RNA_property_pointer_poll %s: is not a pointer property.\n", prop->identifier); + printf("%s %s: is not a pointer property.\n", __func__, prop->identifier); return 0; } @@ -1160,7 +1161,7 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA { RNA_property_enum_items(C, ptr, prop, item, totitem, free); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) { int i; EnumPropertyItem *nitem; @@ -2511,7 +2512,7 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, (char*)prop->identifier)); } else - printf("RNA_property_pointer_add %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); + printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); } void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) @@ -2530,7 +2531,7 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) } } else - printf("RNA_property_pointer_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); + printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); } static void rna_property_collection_get_idp(CollectionPropertyIterator *iter) @@ -2663,7 +2664,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA } } /*else - printf("RNA_property_collection_add %s.%s: not implemented for this property.\n", ptr->type->identifier, prop->identifier);*/ + printf("%s %s.%s: not implemented for this property.\n", __func__, ptr->type->identifier, prop->identifier);*/ #endif if(r_ptr) { @@ -2722,7 +2723,7 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) return 0; } /*else - printf("RNA_property_collection_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier);*/ + printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);*/ #endif return 0; } @@ -2864,6 +2865,21 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co } } +/* zero return is an assignment error */ +int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr) +{ + CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop); + + BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); + + if(cprop->assignint) { + /* we have a callback defined, use it */ + return cprop->assignint(ptr, key, assign_ptr); + } + + return 0; +} + int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr) { BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); @@ -3999,7 +4015,7 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name) return RNA_property_boolean_get(ptr, prop); } else { - printf("RNA_boolean_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4011,7 +4027,7 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value) if(prop) RNA_property_boolean_set(ptr, prop, value); else - printf("RNA_boolean_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) @@ -4021,7 +4037,7 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) if(prop) RNA_property_boolean_get_array(ptr, prop, values); else - printf("RNA_boolean_get_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values) @@ -4031,7 +4047,7 @@ void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values) if(prop) RNA_property_boolean_set_array(ptr, prop, values); else - printf("RNA_boolean_set_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } int RNA_int_get(PointerRNA *ptr, const char *name) @@ -4042,7 +4058,7 @@ int RNA_int_get(PointerRNA *ptr, const char *name) return RNA_property_int_get(ptr, prop); } else { - printf("RNA_int_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4054,7 +4070,7 @@ void RNA_int_set(PointerRNA *ptr, const char *name, int value) if(prop) RNA_property_int_set(ptr, prop, value); else - printf("RNA_int_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values) @@ -4064,7 +4080,7 @@ void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values) if(prop) RNA_property_int_get_array(ptr, prop, values); else - printf("RNA_int_get_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values) @@ -4074,7 +4090,7 @@ void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values) if(prop) RNA_property_int_set_array(ptr, prop, values); else - printf("RNA_int_set_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } float RNA_float_get(PointerRNA *ptr, const char *name) @@ -4085,7 +4101,7 @@ float RNA_float_get(PointerRNA *ptr, const char *name) return RNA_property_float_get(ptr, prop); } else { - printf("RNA_float_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4097,7 +4113,7 @@ void RNA_float_set(PointerRNA *ptr, const char *name, float value) if(prop) RNA_property_float_set(ptr, prop, value); else - printf("RNA_float_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values) @@ -4107,7 +4123,7 @@ void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values) if(prop) RNA_property_float_get_array(ptr, prop, values); else - printf("RNA_float_get_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values) @@ -4117,7 +4133,7 @@ void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values) if(prop) RNA_property_float_set_array(ptr, prop, values); else - printf("RNA_float_set_array: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } int RNA_enum_get(PointerRNA *ptr, const char *name) @@ -4128,7 +4144,7 @@ int RNA_enum_get(PointerRNA *ptr, const char *name) return RNA_property_enum_get(ptr, prop); } else { - printf("RNA_enum_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4140,7 +4156,7 @@ void RNA_enum_set(PointerRNA *ptr, const char *name, int value) if(prop) RNA_property_enum_set(ptr, prop, value); else - printf("RNA_enum_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id) @@ -4152,9 +4168,11 @@ void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id) if(RNA_property_enum_value(NULL, ptr, prop, id, &value)) RNA_property_enum_set(ptr, prop, value); else - printf("RNA_enum_set_identifier: %s.%s has no enum id '%s'.\n", ptr->type->identifier, name, id); - } else - printf("RNA_enum_set_identifier: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s has no enum id '%s'.\n", __func__, ptr->type->identifier, name, id); + } + else { + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname) @@ -4173,11 +4191,11 @@ int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char if(free) MEM_freeN(item); - printf("RNA_enum_is_equal: %s.%s item %s not found.\n", ptr->type->identifier, name, enumname); + printf("%s: %s.%s item %s not found.\n", __func__, ptr->type->identifier, name, enumname); return 0; } else { - printf("RNA_enum_is_equal: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4226,7 +4244,7 @@ void RNA_string_get(PointerRNA *ptr, const char *name, char *value) RNA_property_string_get(ptr, prop, value); } else { - printf("RNA_string_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); value[0]= '\0'; } } @@ -4239,7 +4257,7 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen); } else { - printf("RNA_string_get_alloc: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return NULL; } } @@ -4252,7 +4270,7 @@ int RNA_string_length(PointerRNA *ptr, const char *name) return RNA_property_string_length(ptr, prop); } else { - printf("RNA_string_length: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4264,7 +4282,7 @@ void RNA_string_set(PointerRNA *ptr, const char *name, const char *value) if(prop) RNA_property_string_set(ptr, prop, value); else - printf("RNA_string_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name) @@ -4275,7 +4293,7 @@ PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name) return RNA_property_pointer_get(ptr, prop); } else { - printf("RNA_pointer_get: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return PointerRNA_NULL; } @@ -4289,7 +4307,7 @@ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value) RNA_property_pointer_set(ptr, prop, ptr_value); } else { - printf("RNA_pointer_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } } @@ -4300,7 +4318,7 @@ void RNA_pointer_add(PointerRNA *ptr, const char *name) if(prop) RNA_property_pointer_add(ptr, prop); else - printf("RNA_pointer_set: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter) @@ -4310,7 +4328,7 @@ void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyI if(prop) RNA_property_collection_begin(ptr, prop, iter); else - printf("RNA_collection_begin: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value) @@ -4320,7 +4338,7 @@ void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value) if(prop) RNA_property_collection_add(ptr, prop, r_value); else - printf("RNA_collection_add: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } void RNA_collection_clear(PointerRNA *ptr, const char *name) @@ -4330,7 +4348,7 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name) if(prop) RNA_property_collection_clear(ptr, prop); else - printf("RNA_collection_clear: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } int RNA_collection_length(PointerRNA *ptr, const char *name) @@ -4341,7 +4359,7 @@ int RNA_collection_length(PointerRNA *ptr, const char *name) return RNA_property_collection_length(ptr, prop); } else { - printf("RNA_collection_length: %s.%s not found.\n", ptr->type->identifier, name); + printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); return 0; } } @@ -4358,7 +4376,7 @@ int RNA_property_is_set(PointerRNA *ptr, const char *name) } else { /* python raises an error */ - /* printf("RNA_property_is_set: %s.%s not found.\n", ptr->type->identifier, name); */ + /* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */ return 0; } } diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 2700fa713fb..02249b54049 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -457,7 +457,7 @@ static void rna_def_action_group(BlenderRNA *brna) prop= RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "channels", NULL); RNA_def_property_struct_type(prop, "FCurve"); - RNA_def_property_collection_funcs(prop, 0, "rna_ActionGroup_channels_next", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, 0, "rna_ActionGroup_channels_next", NULL, NULL, NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Channels", "F-Curves in this group"); prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 0a47c98aebb..ebf8990adf3 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -272,7 +272,7 @@ static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value) if (ksp->rna_path) MEM_freeN(ksp->rna_path); - if (strlen(value)) + if (value[0]) ksp->rna_path= BLI_strdup(value); else ksp->rna_path= NULL; diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index ec928415876..e67ab012dc9 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -448,7 +448,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED); if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Connected", "When bone has a parent, bone's head is struck to the parent's tail"); + RNA_def_property_ui_text(prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail"); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); prop= RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE); @@ -458,7 +458,8 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) prop= RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_MULT_VG_ENV); - RNA_def_property_ui_text(prop, "Multiply Vertex Group with Envelope", "When deforming bone, multiply effects of Vertex Group weights with Envelope influence"); + RNA_def_property_ui_text(prop, "Multiply Vertex Group with Envelope", + "When deforming bone, multiply effects of Vertex Group weights with Envelope influence"); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); prop= RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE); @@ -478,7 +479,9 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE); - RNA_def_property_ui_text(prop, "Draw Wire", "Bone is always drawn as Wireframe regardless of viewport draw mode. Useful for non-obstructive custom bone shapes"); + RNA_def_property_ui_text(prop, "Draw Wire", + "Bone is always drawn as Wireframe regardless of viewport draw mode " + "(useful for non-obstructive custom bone shapes)"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); prop= RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE); @@ -752,7 +755,7 @@ static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_struct_type(prop, "Bone"); RNA_def_property_pointer_sdna(prop, NULL, "act_bone"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Active Bone", "Armatures active bone"); + RNA_def_property_ui_text(prop, "Active Bone", "Armature's active bone"); RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL, NULL); /* todo, redraw */ @@ -821,7 +824,8 @@ static void rna_def_armature(BlenderRNA *brna) {ARM_VDEF_BGE_CPU, "BGE_CPU", 0, "BGE", "Uses vertex deformation code optimized for the BGE"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_ghost_type_items[] = { - {ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame", "Display Ghosts of poses within a fixed number of frames around the current frame"}, + {ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame", + "Display Ghosts of poses within a fixed number of frames around the current frame"}, {ARM_GHOST_RANGE, "RANGE", 0, "In Range", "Display Ghosts of poses within specified range"}, {ARM_GHOST_KEYS, "KEYS", 0, "On Keyframes", "Display Ghosts of poses on Keyframes"}, {0, NULL, 0, NULL, NULL}}; @@ -831,7 +835,8 @@ static void rna_def_armature(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Armature", "ID"); - RNA_def_struct_ui_text(srna, "Armature", "Armature datablock containing a hierarchy of bones, usually used for rigging characters"); + RNA_def_struct_ui_text(srna, "Armature", + "Armature datablock containing a hierarchy of bones, usually used for rigging characters"); RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA); RNA_def_struct_sdna(srna, "bArmature"); @@ -841,7 +846,7 @@ static void rna_def_armature(BlenderRNA *brna) /* Collections */ prop= RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL); - RNA_def_property_collection_funcs(prop, 0, "rna_Armature_bones_next", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, 0, "rna_Armature_bones_next", NULL, NULL, NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "Bone"); RNA_def_property_ui_text(prop, "Bones", ""); rna_def_armature_bones(brna, prop); @@ -867,7 +872,7 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - prop= RNA_def_property(srna, "vert_deformer", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer"); RNA_def_property_enum_items(prop, prop_vdeformer); RNA_def_property_ui_text(prop, "Vertex Deformer", ""); @@ -897,7 +902,8 @@ static void rna_def_armature(BlenderRNA *brna) prop= RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER); RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1); RNA_def_property_array(prop, 32); - RNA_def_property_ui_text(prop, "Layer Proxy Protection", "Protected layers in Proxy Instances are restored to Proxy settings on file reload and undo"); + RNA_def_property_ui_text(prop, "Layer Proxy Protection", + "Protected layers in Proxy Instances are restored to Proxy settings on file reload and undo"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); /* flag */ @@ -975,28 +981,34 @@ static void rna_def_armature(BlenderRNA *brna) prop= RNA_def_property(srna, "ghost_step", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ghostep"); RNA_def_property_range(prop, 0, 30); - RNA_def_property_ui_text(prop, "Ghosting Step", "Number of frame steps on either side of current frame to show as ghosts (only for 'Around Current Frame' Onion-skinning method)"); + RNA_def_property_ui_text(prop, "Ghosting Step", + "Number of frame steps on either side of current frame to show as ghosts " + "(only for 'Around Current Frame' Onion-skinning method)"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); prop= RNA_def_property(srna, "ghost_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ghostsize"); RNA_def_property_range(prop, 1, 20); - RNA_def_property_ui_text(prop, "Ghosting Frame Step", "Frame step for Ghosts (not for 'On Keyframes' Onion-skinning method)"); + RNA_def_property_ui_text(prop, "Ghosting Frame Step", + "Frame step for Ghosts (not for 'On Keyframes' Onion-skinning method)"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); prop= RNA_def_property(srna, "ghost_frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "ghostsf"); RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_start_frame_set", NULL); - RNA_def_property_ui_text(prop, "Ghosting Start Frame", "Starting frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)"); + RNA_def_property_ui_text(prop, "Ghosting Start Frame", + "Starting frame of range of Ghosts to display (not for " + "'Around Current Frame' Onion-skinning method)"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); prop= RNA_def_property(srna, "ghost_frame_end", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "ghostef"); RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_end_frame_set", NULL); - RNA_def_property_ui_text(prop, "Ghosting End Frame", "End frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)"); + RNA_def_property_ui_text(prop, "Ghosting End Frame", + "End frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); // XXX depreceated ....... old animviz for armatures only diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index c9d261e8143..357f613f65f 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -554,7 +554,7 @@ static void rna_def_boid_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 100.0); - RNA_def_property_ui_text(prop, "Range", "The maximum distance from which a boid can attack"); + RNA_def_property_ui_text(prop, "Range", "Maximum distance from which a boid can attack"); RNA_def_property_update(prop, 0, "rna_Boids_reset"); /* physical properties */ diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 37912f810fc..9954fdfd88d 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -209,6 +209,9 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + + /* Camera API */ + RNA_api_camera(srna); } #endif diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c new file mode 100644 index 00000000000..39478713663 --- /dev/null +++ b/source/blender/makesrna/intern/rna_camera_api.c @@ -0,0 +1,88 @@ +/* + * $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 blender/makesrna/intern/rna_camera_api.c + * \ingroup RNA + */ + + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + + +#include "RNA_define.h" +#include "BKE_utildefines.h" + +#ifdef RNA_RUNTIME + +#include "DNA_scene_types.h" +#include "BKE_context.h" +#include "BKE_object.h" + +void rna_camera_view_frame(struct Camera *camera, struct Scene *scene, + float vec1_r[3], float vec2_r[3], float vec3_r[3], float vec4_r[3]) +{ + float vec[4][3]; + + camera_view_frame(scene, camera, vec); + + copy_v3_v3(vec1_r, vec[0]); + copy_v3_v3(vec2_r, vec[1]); + copy_v3_v3(vec3_r, vec[2]); + copy_v3_v3(vec4_r, vec[3]); +} + +#else + +void RNA_api_camera(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + func= RNA_def_function(srna, "view_frame", "rna_camera_view_frame"); + RNA_def_function_ui_description(func, "Return 4 points for the cameras frame (before object transformation)"); + + RNA_def_pointer(func, "scene", "Scene", "", "Scene to use for aspect calculation, when omitted 1:1 aspect is used"); + + /* return location and normal */ + parm= RNA_def_float_vector(func, "result_1", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4); + RNA_def_property_flag(parm, PROP_THICK_WRAP); + RNA_def_function_output(func, parm); + + parm= RNA_def_float_vector(func, "result_2", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4); + RNA_def_property_flag(parm, PROP_THICK_WRAP); + RNA_def_function_output(func, parm); + + parm= RNA_def_float_vector(func, "result_3", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4); + RNA_def_property_flag(parm, PROP_THICK_WRAP); + RNA_def_function_output(func, parm); + + parm= RNA_def_float_vector(func, "result_4", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4); + RNA_def_property_flag(parm, PROP_THICK_WRAP); + RNA_def_function_output(func, parm); +} + +#endif + diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 1b2396a4215..934a42cfcef 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -271,7 +271,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", "rna_ClothSettings_mass_vgroup_set"); + RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", + "rna_ClothSettings_mass_vgroup_set"); RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices"); RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed"); @@ -305,21 +306,23 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "quality", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "stepsPerFrame"); RNA_def_property_range(prop, 4, 80); - RNA_def_property_ui_text(prop, "Quality", "Quality of the simulation in steps per frame. (higher is better quality but slower)"); + RNA_def_property_ui_text(prop, "Quality", + "Quality of the simulation in steps per frame (higher is better quality but slower)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); /* springs */ prop= RNA_def_property(srna, "use_stiffness_scale", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SCALING); - RNA_def_property_ui_text(prop, "Stiffness Scaling", "If enabled, stiffness can be scaled along a weight painted vertex group"); + RNA_def_property_ui_text(prop, "Stiffness Scaling", + "If enabled, stiffness can be scaled along a weight painted vertex group"); RNA_def_property_update(prop, 0, "rna_cloth_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop= RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "Cdis"); RNA_def_property_range(prop, 0.0f, 50.0f); - RNA_def_property_ui_text(prop, "Spring Damping", "Damping of cloth velocity. (higher = more smooth, less jiggling)"); + RNA_def_property_ui_text(prop, "Spring Damping", "Damping of cloth velocity (higher = more smooth, less jiggling)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "structural_stiffness", PROP_FLOAT, PROP_NONE); @@ -336,14 +339,16 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length", "rna_ClothSettings_struct_vgroup_set"); - RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group", "Vertex group for fine control over structural stiffness"); + RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length", + "rna_ClothSettings_struct_vgroup_set"); + RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group", + "Vertex group for fine control over structural stiffness"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bending"); RNA_def_property_range(prop, 0.0f, 10000.0f); - RNA_def_property_ui_text(prop, "Bending Stiffness", "Wrinkle coefficient. (higher = less smaller but more big wrinkles)"); + RNA_def_property_ui_text(prop, "Bending Stiffness", "Wrinkle coefficient (higher = less smaller but more big wrinkles)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE); @@ -354,7 +359,8 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length", "rna_ClothSettings_bend_vgroup_set"); + RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length", + "rna_ClothSettings_bend_vgroup_set"); RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness"); RNA_def_property_update(prop, 0, "rna_cloth_update"); @@ -372,8 +378,9 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "ShapeKey"); - RNA_def_property_pointer_funcs(prop, "rna_ClothSettings_rest_shape_key_get", "rna_ClothSettings_rest_shape_key_set", NULL, NULL); - RNA_def_property_ui_text(prop, "Rest Shade Key", "Shape key to use the rest spring lengths from"); + RNA_def_property_pointer_funcs(prop, "rna_ClothSettings_rest_shape_key_get", + "rna_ClothSettings_rest_shape_key_set", NULL, NULL); + RNA_def_property_ui_text(prop, "Rest Shape Key", "Shape key to use the rest spring lengths from"); RNA_def_property_update(prop, 0, "rna_cloth_update"); /* unused */ @@ -420,7 +427,8 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL); - RNA_def_struct_ui_text(srna, "Cloth Collision Settings", "Cloth simulation settings for self collision and collision with other objects"); + RNA_def_struct_ui_text(srna, "Cloth Collision Settings", + "Cloth simulation settings for self collision and collision with other objects"); RNA_def_struct_sdna(srna, "ClothCollSettings"); RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path"); @@ -442,24 +450,27 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "distance_repel"); RNA_def_property_range(prop, 0.001f, 10.0f); RNA_def_property_float_default(prop, 0.005f); - RNA_def_property_ui_text(prop, "Repulsion Distance", "Maximum distance to apply repulsion force, must be greater then minimum distance"); + RNA_def_property_ui_text(prop, "Repulsion Distance", + "Maximum distance to apply repulsion force, must be greater than minimum distance"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "epsilon"); RNA_def_property_range(prop, 0.001f, 1.0f); - RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance between collision objects before collision response takes in"); + RNA_def_property_ui_text(prop, "Minimum Distance", + "Minimum distance between collision objects before collision response takes in"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 80.0f); - RNA_def_property_ui_text(prop, "Friction", "Friction force if a collision happened. (higher = less movement)"); + RNA_def_property_ui_text(prop, "Friction", "Friction force if a collision happened (higher = less movement)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "loop_count"); RNA_def_property_range(prop, 1, 20); - RNA_def_property_ui_text(prop, "Collision Quality", "How many collision iterations should be done. (higher is better quality but slower)"); + RNA_def_property_ui_text(prop, "Collision Quality", + "How many collision iterations should be done. (higher is better quality but slower)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); /* self collision */ @@ -483,7 +494,8 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "self_collision_quality", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "self_loop_count"); RNA_def_property_range(prop, 1, 10); - RNA_def_property_ui_text(prop, "Self Collision Quality", "How many self collision iterations should be done. (higher is better quality but slower)"); + RNA_def_property_ui_text(prop, "Self Collision Quality", + "How many self collision iterations should be done (higher is better quality but slower)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 338c93bb96a..f41ebd43b79 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -428,7 +428,7 @@ static void rna_def_curvemapping(BlenderRNA *brna) RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range"); prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "CurveMap"); RNA_def_property_ui_text(prop, "Curves", ""); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 5d0c1db572d..edae977f3f6 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -1262,7 +1262,7 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL); #else /* this way we get editmode nurbs too, keyframe in editmode */ - RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); #endif RNA_def_property_struct_type(prop, "Spline"); RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object"); @@ -1428,7 +1428,8 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_struct_type(prop, "Material"); RNA_def_property_ui_text(prop, "Materials", ""); - RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ + RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ + RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); } static void rna_def_curve_nurb(BlenderRNA *brna) @@ -1450,7 +1451,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); RNA_def_property_struct_type(prop, "SplinePoint"); - RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline"); rna_def_curve_spline_points(brna, prop); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 63b3aed4a3b..ab469c19e15 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -134,7 +134,7 @@ StructDefRNA *rna_find_struct_def(StructRNA *srna) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_struct_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -153,7 +153,7 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_struct_property_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -181,7 +181,7 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_property_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -204,7 +204,7 @@ FunctionDefRNA *rna_find_function_def(FunctionRNA *func) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_function_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -233,7 +233,7 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_parameter_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -267,7 +267,7 @@ static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont) if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_container_def: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return NULL; } @@ -513,7 +513,7 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) /* if(srna->flag & STRUCT_RUNTIME) { if(RNA_struct_py_type_get(srna)) { - fprintf(stderr, "RNA_struct_free '%s' freed while holding a python reference\n", srna->identifier); + fprintf(stderr, "%s '%s' freed while holding a python reference\n", __func__, srna->identifier); } } */ @@ -617,7 +617,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * char error[512]; if (rna_validate_identifier(identifier, error, 0) == 0) { - fprintf(stderr, "RNA_def_struct: struct identifier \"%s\" error - %s\n", identifier, error); + fprintf(stderr, "%s: struct identifier \"%s\" error - %s\n", __func__, identifier, error); DefRNA.error= 1; } } @@ -629,7 +629,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * break; if(!srnafrom) { - fprintf(stderr, "RNA_def_struct: struct %s not found to define %s.\n", from, identifier); + fprintf(stderr, "%s: struct %s not found to define %s.\n", __func__, from, identifier); DefRNA.error= 1; } } @@ -689,7 +689,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * if(DefRNA.preprocess) { RNA_def_property_struct_type(prop, "Property"); - RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL, "rna_builtin_properties_lookup_string"); + RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL, "rna_builtin_properties_lookup_string", NULL); } else { #ifdef RNA_RUNTIME @@ -726,7 +726,7 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname) StructDefRNA *ds; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -734,7 +734,7 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname) if(!DNA_struct_find_nr(DefRNA.sdna, structname)) { if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_struct_sdna: %s not found.\n", structname); + fprintf(stderr, "%s: %s not found.\n", __func__, structname); DefRNA.error= 1; } return; @@ -748,20 +748,20 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha StructDefRNA *ds; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_sdna_from: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } ds= rna_find_def_struct(srna); if(!ds->dnaname) { - fprintf(stderr, "RNA_def_struct_sdna_from: %s base struct must know DNA already.\n", structname); + fprintf(stderr, "%s: %s base struct must know DNA already.\n", __func__, structname); return; } if(!DNA_struct_find_nr(DefRNA.sdna, structname)) { if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_struct_sdna_from: %s not found.\n", structname); + fprintf(stderr, "%s: %s not found.\n", __func__, structname); DefRNA.error= 1; } return; @@ -774,7 +774,7 @@ void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const cha void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop) { if(prop->type != PROP_STRING) { - fprintf(stderr, "RNA_def_struct_name_property: \"%s.%s\", must be a string property.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", must be a string property.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; } else @@ -791,7 +791,7 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct break; if(!srnafrom) { - fprintf(stderr, "RNA_def_struct_nested: struct %s not found for %s.\n", structname, srna->identifier); + fprintf(stderr, "%s: struct %s not found for %s.\n", __func__, structname, srna->identifier); DefRNA.error= 1; } @@ -811,7 +811,7 @@ void RNA_def_struct_clear_flag(StructRNA *srna, int flag) void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_refine_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -821,7 +821,7 @@ void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_idprops_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -831,7 +831,7 @@ void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties) void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_register_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -843,7 +843,7 @@ void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char void RNA_def_struct_path_func(StructRNA *srna, const char *path) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_path_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -853,7 +853,7 @@ void RNA_def_struct_path_func(StructRNA *srna, const char *path) void RNA_def_struct_identifier(StructRNA *srna, const char *identifier) { if(DefRNA.preprocess) { - fprintf(stderr, "RNA_def_struct_name_runtime: only at runtime.\n"); + fprintf(stderr, "%s: only at runtime.\n", __func__); return; } @@ -887,7 +887,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier char error[512]; if (rna_validate_identifier(identifier, error, 1) == 0) { - fprintf(stderr, "RNA_def_property: property identifier \"%s.%s\" - %s\n", CONTAINER_RNA_ID(cont), identifier, error); + fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__, CONTAINER_RNA_ID(cont), identifier, error); DefRNA.error= 1; } @@ -895,7 +895,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier /* XXX - toto, detect supertype collisions */ if(rna_findlink(&dcont->properties, identifier)) { - fprintf(stderr, "RNA_def_property: duplicate identifier \"%s.%s\"\n", CONTAINER_RNA_ID(cont), identifier); + fprintf(stderr, "%s: duplicate identifier \"%s.%s\"\n", __func__, CONTAINER_RNA_ID(cont), identifier); DefRNA.error= 1; } @@ -953,7 +953,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier case PROP_COLLECTION: break; default: - fprintf(stderr, "RNA_def_property: \"%s.%s\", invalid property type.\n", CONTAINER_RNA_ID(cont), identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid property type.\n", __func__, CONTAINER_RNA_ID(cont), identifier); DefRNA.error= 1; return NULL; } @@ -1054,19 +1054,19 @@ void RNA_def_property_array(PropertyRNA *prop, int length) StructRNA *srna= DefRNA.laststruct; if(length<0) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array length must be zero of greater.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", array length must be zero of greater.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } if(length>RNA_MAX_ARRAY_LENGTH) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array length must be smaller than %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH); + fprintf(stderr, "%s: \"%s.%s\", array length must be smaller than %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH); DefRNA.error= 1; return; } if(prop->arraydimension > 1) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n", srna->identifier, prop->identifier, prop->arraydimension); + fprintf(stderr, "%s: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n", __func__, srna->identifier, prop->identifier, prop->arraydimension); DefRNA.error= 1; return; } @@ -1080,7 +1080,7 @@ void RNA_def_property_array(PropertyRNA *prop, int length) prop->arraydimension= 1; break; default: - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", only boolean/int/float can be array.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1092,7 +1092,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le int i; if (dimension < 1 || dimension > RNA_MAX_ARRAY_DIMENSION) { - fprintf(stderr, "RNA_def_property_multi_array: \"%s.%s\", array dimension must be between 1 and %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION); + fprintf(stderr, "%s: \"%s.%s\", array dimension must be between 1 and %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION); DefRNA.error= 1; return; } @@ -1103,7 +1103,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le case PROP_FLOAT: break; default: - fprintf(stderr, "RNA_def_property_multi_array: \"%s.%s\", only boolean/int/float can be array.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1160,7 +1160,7 @@ void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double break; } default: - fprintf(stderr, "RNA_def_property_ui_range: \"%s.%s\", invalid type for ui range.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for ui range.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1188,7 +1188,7 @@ void RNA_def_property_range(PropertyRNA *prop, double min, double max) break; } default: - fprintf(stderr, "RNA_def_property_range: \"%s.%s\", invalid type for range.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for range.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1199,7 +1199,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type) StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_struct_type \"%s.%s\": only during preprocessing.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s \"%s.%s\": only during preprocessing.\n", __func__, srna->identifier, prop->identifier); return; } @@ -1215,7 +1215,7 @@ void RNA_def_property_struct_type(PropertyRNA *prop, const char *type) break; } default: - fprintf(stderr, "RNA_def_property_struct_type: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1226,7 +1226,7 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) StructRNA *srna= DefRNA.laststruct; if(DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_struct_runtime: only at runtime.\n"); + fprintf(stderr, "%s: only at runtime.\n", __func__); return; } @@ -1246,7 +1246,7 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) break; } default: - fprintf(stderr, "RNA_def_property_struct_runtime: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1281,7 +1281,7 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item break; } default: - fprintf(stderr, "RNA_def_property_enum_items: \"%s.%s\", invalid type for struct type.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1298,7 +1298,7 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength) break; } default: - fprintf(stderr, "RNA_def_property_string_maxlength: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1315,7 +1315,7 @@ void RNA_def_property_boolean_default(PropertyRNA *prop, int value) break; } default: - fprintf(stderr, "RNA_def_property_boolean_default: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1332,7 +1332,7 @@ void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array) break; } default: - fprintf(stderr, "RNA_def_property_boolean_default: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1349,7 +1349,7 @@ void RNA_def_property_int_default(PropertyRNA *prop, int value) break; } default: - fprintf(stderr, "RNA_def_property_int_default: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1366,7 +1366,7 @@ void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array) break; } default: - fprintf(stderr, "RNA_def_property_int_default: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1383,7 +1383,7 @@ void RNA_def_property_float_default(PropertyRNA *prop, float value) break; } default: - fprintf(stderr, "RNA_def_property_float_default: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1400,7 +1400,7 @@ void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array) break; } default: - fprintf(stderr, "RNA_def_property_float_default: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1417,7 +1417,7 @@ void RNA_def_property_string_default(PropertyRNA *prop, const char *value) break; } default: - fprintf(stderr, "RNA_def_property_string_default: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1443,7 +1443,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value) } if(eprop->defaultvalue & ~totflag) { - fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", default includes unused bits (%d).\n", srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag); + fprintf(stderr, "%s: \"%s.%s\", default includes unused bits (%d).\n", __func__, srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag); DefRNA.error= 1; } } @@ -1458,7 +1458,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value) eprop->defaultvalue= eprop->item[0].value; } else { - fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", default is not in items.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", default is not in items.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; } } @@ -1467,7 +1467,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value) break; } default: - fprintf(stderr, "RNA_def_property_enum_default: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1506,7 +1506,7 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *stru return dp; } else { - fprintf(stderr, "rna_def_property_sdna: \"%s.%s\" not found.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\" not found.\n", __func__, structname, propname); DefRNA.error= 1; return NULL; } @@ -1539,12 +1539,12 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_BOOLEAN) { - fprintf(stderr, "RNA_def_property_boolean_sdna: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1554,7 +1554,7 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, co if(DefRNA.silent == 0) { /* error check to ensure floats are not wrapped as ints/bools */ if(dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) { - fprintf(stderr, "RNA_def_property_boolean_sdna: %s.%s is a '%s' but wrapped as type '%s'.\n", srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); + fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); DefRNA.error= 1; return; } @@ -1583,12 +1583,12 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_INT) { - fprintf(stderr, "RNA_def_property_int_sdna: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1598,7 +1598,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const /* error check to ensure floats are not wrapped as ints/bools */ if(DefRNA.silent == 0) { if(dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) { - fprintf(stderr, "RNA_def_property_int_sdna: %s.%s is a '%s' but wrapped as type '%s'.\n", srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); + fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); DefRNA.error= 1; return; } @@ -1632,12 +1632,12 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_FLOAT) { - fprintf(stderr, "RNA_def_property_float_sdna: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1647,7 +1647,7 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons if(DefRNA.silent == 0) { if(dp->dnatype && *dp->dnatype && IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) { if(prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */ - fprintf(stderr, "RNA_def_property_float_sdna: %s.%s is a '%s' but wrapped as type '%s'.\n", srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); + fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type)); DefRNA.error= 1; return; } @@ -1664,12 +1664,12 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_ENUM) { - fprintf(stderr, "RNA_def_property_enum_sdna: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1680,7 +1680,7 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const prop->totarraylength= 0; if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_enum_sdna: \"%s.%s\", array not supported for enum type.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\", array not supported for enum type.\n", __func__, structname, propname); DefRNA.error= 1; } } @@ -1706,12 +1706,12 @@ void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, con StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_STRING) { - fprintf(stderr, "RNA_def_property_string_sdna: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1731,12 +1731,12 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_POINTER) { - fprintf(stderr, "RNA_def_property_pointer_sdna: \"%s.%s\", type is not pointer.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1747,7 +1747,7 @@ void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, co prop->totarraylength= 0; if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_pointer_sdna: \"%s.%s\", array not supported for pointer type.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\", array not supported for pointer type.\n", __func__, structname, propname); DefRNA.error= 1; } } @@ -1761,12 +1761,12 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_sdna: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if(prop->type != PROP_COLLECTION) { - fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\", type is not collection.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; return; } @@ -1777,7 +1777,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, prop->totarraylength= 0; if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\", array of collections not supported.\n", structname, propname); + fprintf(stderr, "%s: \"%s.%s\", array of collections not supported.\n", __func__, structname, propname); DefRNA.error= 1; } } @@ -1818,7 +1818,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, } else { if(!DefRNA.silent) { - fprintf(stderr, "RNA_def_property_collection_sdna: \"%s.%s\" not found.\n", structname, lengthpropname); + fprintf(stderr, "%s: \"%s.%s\" not found.\n", __func__, structname, lengthpropname); DefRNA.error= 1; } } @@ -1830,7 +1830,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_editable_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1840,7 +1840,7 @@ void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable) void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_editable_array_func: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1850,7 +1850,7 @@ void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editabl void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_update: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1866,12 +1866,12 @@ void RNA_def_property_update_runtime(PropertyRNA *prop, void *func) void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength) { if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } if (!(prop->flag & PROP_DYNAMIC)) { - fprintf(stderr, "RNA_def_property_dynamic_array_funcs: property is a not dynamic array.\n"); + fprintf(stderr, "%s: property is a not dynamic array.\n", __func__); DefRNA.error= 1; return; } @@ -1884,7 +1884,7 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1903,7 +1903,7 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch break; } default: - fprintf(stderr, "RNA_def_property_boolean_funcs: \"%s.%s\", type is not boolean.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1914,7 +1914,7 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char * StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1934,7 +1934,7 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char * break; } default: - fprintf(stderr, "RNA_def_property_int_funcs: \"%s.%s\", type is not int.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1945,7 +1945,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1965,7 +1965,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char break; } default: - fprintf(stderr, "RNA_def_property_float_funcs: \"%s.%s\", type is not float.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -1976,7 +1976,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -1990,7 +1990,7 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char break; } default: - fprintf(stderr, "RNA_def_property_enum_funcs: \"%s.%s\", type is not enum.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -2001,7 +2001,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -2015,7 +2015,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha break; } default: - fprintf(stderr, "RNA_def_property_string_funcs: \"%s.%s\", type is not string.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -2026,7 +2026,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -2041,18 +2041,18 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch break; } default: - fprintf(stderr, "RNA_def_property_pointer_funcs: \"%s.%s\", type is not pointer.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } } -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_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, const char *assignint) { StructRNA *srna= DefRNA.laststruct; if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_property_*_funcs: only during preprocessing.\n"); + fprintf(stderr, "%s: only during preprocessing.\n", __func__); return; } @@ -2067,10 +2067,11 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con if(length) cprop->length= (PropCollectionLengthFunc)length; if(lookupint) cprop->lookupint= (PropCollectionLookupIntFunc)lookupint; if(lookupstring) cprop->lookupstring= (PropCollectionLookupStringFunc)lookupstring; + if(assignint) cprop->assignint= (PropCollectionAssignIntFunc)assignint; break; } default: - fprintf(stderr, "RNA_def_property_collection_funcs: \"%s.%s\", type is not collection.\n", srna->identifier, prop->identifier); + fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier); DefRNA.error= 1; break; } @@ -2280,7 +2281,7 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, co PropertyRNA *prop; if(!items) { - printf("RNA_def_enum: items not allowed to be NULL.\n"); + printf("%s: items not allowed to be NULL.\n", __func__); return NULL; } @@ -2300,7 +2301,7 @@ PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifie PropertyRNA *prop; if(!items) { - printf("RNA_def_enum_flag: items not allowed to be NULL.\n"); + printf("%s: items not allowed to be NULL.\n", __func__); return NULL; } @@ -2530,7 +2531,7 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier) char error[512]; if (rna_validate_identifier(identifier, error, 0) == 0) { - fprintf(stderr, "RNA_def_function: function identifier \"%s\" - %s\n", identifier, error); + fprintf(stderr, "%s: function identifier \"%s\" - %s\n", __func__, identifier, error); DefRNA.error= 1; } } @@ -2561,7 +2562,7 @@ FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const cha func= rna_def_function(srna, identifier); if(!DefRNA.preprocess) { - fprintf(stderr, "RNA_def_function: only at preprocess time.\n"); + fprintf(stderr, "%s: only at preprocess time.\n", __func__); return func; } @@ -2578,7 +2579,7 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C func= rna_def_function(srna, identifier); if(DefRNA.preprocess) { - fprintf(stderr, "RNA_def_function_call_runtime: only at runtime.\n"); + fprintf(stderr, "%s: only at runtime.\n", __func__); return func; } @@ -2592,11 +2593,11 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret) { if (ret->flag & PROP_DYNAMIC) { - fprintf(stderr, "RNA_def_function_return: \"%s.%s\", dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier); + fprintf(stderr, "%s: \"%s.%s\", dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier); return; } else if (ret->arraydimension) { - fprintf(stderr, "RNA_def_function_return: \"%s.%s\", arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", func->identifier, ret->identifier); + fprintf(stderr, "%s: \"%s.%s\", arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier); return; } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 11eec6a0a47..43812ad4a01 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -236,7 +236,7 @@ static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value) if (dtar->rna_path) MEM_freeN(dtar->rna_path); - if (strlen(value)) + if (value[0]) dtar->rna_path= BLI_strdup(value); else dtar->rna_path= NULL; @@ -329,7 +329,7 @@ static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value) if (fcu->rna_path) MEM_freeN(fcu->rna_path); - if (strlen(value)) { + if (value[0]) { fcu->rna_path= BLI_strdup(value); fcu->flag &= ~FCURVE_DISABLED; } @@ -643,7 +643,9 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) /* define common props */ prop= RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE); - RNA_def_property_ui_text(prop, "Additive", "Values generated by this modifier are applied on top of the existing values instead of overwriting them"); + RNA_def_property_ui_text(prop, "Additive", + "Values generated by this modifier are applied on top of " + "the existing values instead of overwriting them"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); // XXX this has a special validation func @@ -656,7 +658,8 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) /* order of the polynomial */ // XXX this has a special validation func prop= RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Polynomial Order", "The highest power of 'x' for this polynomial. (number of coefficients - 1)"); + RNA_def_property_ui_text(prop, "Polynomial Order", + "The highest power of 'x' for this polynomial. (number of coefficients - 1)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); /* coefficients array */ @@ -664,7 +667,8 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) RNA_def_property_array(prop, 32); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_FModifierGenerator_coefficients_get_length"); - RNA_def_property_float_funcs(prop, "rna_FModifierGenerator_coefficients_get", "rna_FModifierGenerator_coefficients_set", NULL); + RNA_def_property_float_funcs(prop, "rna_FModifierGenerator_coefficients_get", + "rna_FModifierGenerator_coefficients_set", NULL); RNA_def_property_ui_text(prop, "Coefficients", "Coefficients for 'x' (starting from lowest power of x^0)"); } @@ -708,7 +712,9 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna) /* flags */ prop= RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE); - RNA_def_property_ui_text(prop, "Additive", "Values generated by this modifier are applied on top of the existing values instead of overwriting them"); + RNA_def_property_ui_text(prop, "Additive", + "Values generated by this modifier are applied on top of " + "the existing values instead of overwriting them"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); prop= RNA_def_property(srna, "function_type", PROP_ENUM, PROP_NONE); @@ -795,8 +801,10 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"}, {FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"}, - {FCM_EXTRAPOLATE_CYCLIC_OFFSET, "REPEAT_OFFSET", 0, "Repeat with Offset", "Repeat keyframe range, but with offset based on gradient between values"}, - {FCM_EXTRAPOLATE_MIRROR, "MIRROR", 0, "Repeat Mirrored", "Alternate between forward and reverse playback of keyframe range"}, + {FCM_EXTRAPOLATE_CYCLIC_OFFSET, "REPEAT_OFFSET", 0, "Repeat with Offset", + "Repeat keyframe range, but with offset based on gradient between values"}, + {FCM_EXTRAPOLATE_MIRROR, "MIRROR", 0, "Repeat Mirrored", + "Alternate between forward and reverse playback of keyframe range"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "FModifierCycles", "FModifier"); @@ -950,7 +958,8 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "FModifierStepped", "FModifier"); - RNA_def_struct_ui_text(srna, "Stepped Interpolation F-Modifier", "Holds each interpolated value from the F-Curve for several frames without changing the timing"); + RNA_def_struct_ui_text(srna, "Stepped Interpolation F-Modifier", + "Hold each interpolated value from the F-Curve for several frames without changing the timing"); RNA_def_struct_sdna_from(srna, "FMod_Stepped", "data"); /* properties */ @@ -961,7 +970,9 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna) prop= RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "offset"); - RNA_def_property_ui_text(prop, "Offset", "Reference number of frames before frames get held. Use to get hold for '1-3' vs '5-7' holding patterns"); + RNA_def_property_ui_text(prop, "Offset", + "Reference number of frames before frames get held " + "(use to get hold for '1-3' vs '5-7' holding patterns)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); prop= RNA_def_property(srna, "use_frame_start", PROP_BOOLEAN, PROP_NONE); @@ -1042,7 +1053,9 @@ static void rna_def_fmodifier(BlenderRNA *brna) /* restricted range */ prop= RNA_def_property(srna, "use_restricted_range", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_RANGERESTRICT); - RNA_def_property_ui_text(prop, "Restrict Frame Range", "F-Curve Modifier is only applied for the specified frame range to help mask off effects in order to chain them"); + RNA_def_property_ui_text(prop, "Restrict Frame Range", + "F-Curve Modifier is only applied for the specified frame range to help " + "mask off effects in order to chain them"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); // XXX: depends on UI implementation @@ -1106,8 +1119,10 @@ static void rna_def_drivertarget(BlenderRNA *brna) static EnumPropertyItem prop_local_space_items[] = { {0, "WORLD_SPACE", 0, "World Space", "Transforms include effects of parenting/restpose and constraints"}, - {DTAR_FLAG_LOCALSPACE, "TRANSFORM_SPACE", 0, "Transform Space", "Transforms don't include parenting/restpose or constraints"}, - {DTAR_FLAG_LOCALSPACE|DTAR_FLAG_LOCAL_CONSTS, "LOCAL_SPACE", 0, "Local Space", "Transforms include effects of constraints but not parenting/restpose"}, + {DTAR_FLAG_LOCALSPACE, "TRANSFORM_SPACE", 0, "Transform Space", + "Transforms don't include parenting/restpose or constraints"}, + {DTAR_FLAG_LOCALSPACE|DTAR_FLAG_LOCAL_CONSTS, "LOCAL_SPACE", 0, "Local Space", + "Transforms include effects of constraints but not parenting/restpose"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "DriverTarget", NULL); @@ -1120,7 +1135,8 @@ static void rna_def_drivertarget(BlenderRNA *brna) RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable"); /* note: custom set function is ONLY to avoid rna setting a user for this. */ RNA_def_property_pointer_funcs(prop, NULL, "rna_DriverTarget_id_set", "rna_DriverTarget_id_typef", NULL); - RNA_def_property_ui_text(prop, "ID", "ID-block that the specific property used can be found from (id_type property must be set first)"); + RNA_def_property_ui_text(prop, "ID", + "ID-block that the specific property used can be found from (id_type property must be set first)"); RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data"); prop= RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE); @@ -1134,7 +1150,8 @@ static void rna_def_drivertarget(BlenderRNA *brna) /* Target Properties - Property to Drive */ prop= RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length", "rna_DriverTarget_RnaPath_set"); + RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length", + "rna_DriverTarget_RnaPath_set"); RNA_def_property_ui_text(prop, "Data Path", "RNA Path (from ID-block) to property used"); RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data"); @@ -1176,7 +1193,9 @@ static void rna_def_drivervar(BlenderRNA *brna) /* Variable Name */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); - RNA_def_property_ui_text(prop, "Name", "Name to use in scripted expressions/functions. (No spaces or dots are allowed. Also, must not start with a symbol or digit)"); + RNA_def_property_ui_text(prop, "Name", + "Name to use in scripted expressions/functions (no spaces or dots are allowed, " + "and must start with a letter)"); RNA_def_property_update(prop, 0, "rna_DriverTarget_update_name"); // XXX /* Enums */ @@ -1265,7 +1284,8 @@ static void rna_def_channeldriver(BlenderRNA *brna) /* Settings */ prop= RNA_def_property(srna, "show_debug_info", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", DRIVER_FLAG_SHOWDEBUG); - RNA_def_property_ui_text(prop, "Show Debug Info", "Show intermediate values for the driver calculations to allow debugging of drivers"); + RNA_def_property_ui_text(prop, "Show Debug Info", + "Show intermediate values for the driver calculations to allow debugging of drivers"); /* State Info (for Debugging) */ prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE); @@ -1347,7 +1367,8 @@ static void rna_def_fkeyframe(BlenderRNA *brna) prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ipo"); RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items); - RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method to use for segment of the curve from this Keyframe until the next Keyframe"); + RNA_def_property_ui_text(prop, "Interpolation", + "Interpolation method to use for segment of the curve from this Keyframe until the next Keyframe"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); @@ -1547,7 +1568,8 @@ static void rna_def_fcurve(BlenderRNA *brna) /* State Info (for Debugging) */ prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_DISABLED); - RNA_def_property_ui_text(prop, "Valid", "False when F-Curve could not be evaluated in past, so should be skipped when evaluating"); + RNA_def_property_ui_text(prop, "Valid", + "False when F-Curve could not be evaluated in past, so should be skipped when evaluating"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); /* Collections */ diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index ccb24d7dd9b..ba90aca47a3 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -141,12 +141,12 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA psys->part= part; psys->pointcache= BKE_ptcache_add(&psys->ptcaches); psys->flag |= PSYS_ENABLED; - sprintf(psys->name, "FluidParticles"); + BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name)); BLI_addtail(&ob->particlesystem,psys); /* add modifier */ psmd= (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem); - sprintf(psmd->modifier.name, "FluidParticleSystem" ); + BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name)); psmd->psys= psys; BLI_addtail(&ob->modifiers, psmd); modifier_unique_name(&ob->modifiers, (ModifierData *)psmd); @@ -412,7 +412,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) prop= RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "FluidMeshVertex"); RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); - RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", NULL, NULL, NULL); rna_def_fluid_mesh_vertices(brna); } diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index 597f05ed9f6..0a66ff9fa99 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -132,7 +132,7 @@ void RNA_def_group(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects"); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_Group_objects_get", NULL, NULL, NULL, NULL); rna_def_group_objects(brna, prop); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index b7827989a94..50ce816d7a1 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -142,7 +142,7 @@ static void rna_Image_pack(Image *image, ReportList *reports, int as_png) BKE_image_memorypack(image); } else { - image->packedfile= newPackedFile(reports, image->name); + image->packedfile= newPackedFile(reports, image->name, ID_BLEND_PATH(G.main, &image->id)); } } } diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 4c1bc027524..5b307b6cffb 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -235,6 +235,7 @@ char *rna_TextureSlot_path(struct PointerRNA *ptr); void RNA_api_action(StructRNA *srna); void RNA_api_armature_edit_bone(StructRNA *srna); void RNA_api_bone(StructRNA *srna); +void RNA_api_camera(StructRNA *srna); void RNA_api_drivers(StructRNA *srna); void RNA_api_image(struct StructRNA *srna); void RNA_api_operator(struct StructRNA *srna); @@ -383,6 +384,9 @@ struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, str struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct bContext *C, struct ReportList *reports, int index); void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct ReportList *reports, int index); + +int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); + #endif /* RNA_INTERNAL_H */ diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 249833ae94b..50790a0077f 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -102,6 +102,7 @@ typedef PointerRNA (*PropCollectionGetFunc)(struct CollectionPropertyIterator *i typedef int (*PropCollectionLengthFunc)(struct PointerRNA *ptr); typedef int (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key, struct PointerRNA *r_ptr); typedef int (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr); +typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); /* Container - generic abstracted container of RNA properties */ typedef struct ContainerRNA { @@ -285,6 +286,7 @@ typedef struct CollectionPropertyRNA { PropCollectionLengthFunc length; /* optional */ PropCollectionLookupIntFunc lookupint; /* optional */ PropCollectionLookupStringFunc lookupstring; /* optional */ + PropCollectionAssignIntFunc assignint; /* optional */ struct StructRNA *item_type; /* the type of this item */ } CollectionPropertyRNA; diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index ad6f67cddaf..353da196e89 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -581,7 +581,7 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "data", "totelem"); RNA_def_property_struct_type(prop, "UnknownType"); RNA_def_property_ui_text(prop, "Data", ""); - RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", 0, 0, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", NULL, NULL, NULL); } static void rna_def_key(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 8387b3286d6..2a81c4f0a2c 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -237,7 +237,7 @@ static void rna_def_latticepoint(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Lattice_update_data"); prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "VertexGroupElement"); RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of"); } @@ -317,7 +317,7 @@ static void rna_def_lattice(BlenderRNA *brna) prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "LatticePoint"); - RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Points", "Points of the lattice"); /* pointers */ diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 04ad1fa0eef..2c1089a9ad6 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -344,7 +344,7 @@ void RNA_def_main(BlenderRNA *brna) { prop= RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, lists[i].type); - RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, lists[i].name, lists[i].description); /* collection functions */ diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index c0613310b60..12175090a8b 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -345,12 +345,12 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall mb->id.name+2, ID_REAL_USERS(mb)); } -VFont *rna_Main_fonts_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath) +VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath) { VFont *font; errno= 0; - font= load_vfont(filepath); + font= load_vfont(bmain, filepath); if(!font) BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath, @@ -688,7 +688,7 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataMaterials"); srna= RNA_def_struct(brna, "BlendDataMaterials", NULL); RNA_def_struct_sdna(srna, "Main"); - RNA_def_struct_ui_text(srna, "Main Material", "Collection of materials"); + RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials"); func= RNA_def_function(srna, "new", "rna_Main_materials_new"); RNA_def_function_ui_description(func, "Add a new material to the main database"); @@ -967,7 +967,7 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "BlendDataMetaBalls"); srna= RNA_def_struct(brna, "BlendDataMetaBalls", NULL); RNA_def_struct_sdna(srna, "Main"); - RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs"); + RNA_def_struct_ui_text(srna, "Main MetaBalls", "Collection of metaballs"); func= RNA_def_function(srna, "new", "rna_Main_metaballs_new"); RNA_def_function_ui_description(func, "Add a new metaball to the main database"); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 6ed2147ce1b..a9878ab2bf2 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -767,9 +767,9 @@ static void rna_def_material_gamesettings(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "Material"); RNA_def_struct_ui_text(srna, "Material Game Settings", "Game Engine settings for a Material datablock"); - prop= RNA_def_property(srna, "back_culling", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_BACKCULL); /* use bitflags */ - RNA_def_property_ui_text(prop, "Back Culling", "Hide Back of the face in Game Engine "); + RNA_def_property_ui_text(prop, "Backface Culling", "Hide Back of the face in Game Engine "); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); @@ -2040,8 +2040,7 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, /* mtex */ prop= RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, structname); - RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", - "rna_iterator_array_dereference_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures"); rna_def_texture_slots(brna, prop, structname, structname_slots); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 45094e3cf7a..c8a49ec8824 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -166,7 +166,8 @@ static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values) MFace *mface= (MFace*)ptr->data; if(mface->v4) - normal_quad_v3( values,me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, me->mvert[mface->v4].co); + normal_quad_v3(values,me->mvert[mface->v1].co, me->mvert[mface->v2].co, + me->mvert[mface->v3].co, me->mvert[mface->v4].co); else normal_tri_v3( values,me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co); } @@ -1227,7 +1228,7 @@ static void rna_def_mvert(BlenderRNA *brna) prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", - "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); + "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "VertexGroupElement"); RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of"); @@ -1359,12 +1360,12 @@ static void rna_def_mface(BlenderRNA *brna) RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_MeshFace_normal_get", NULL, NULL); - RNA_def_property_ui_text(prop, "face normal", "local space unit length normal vector for this face"); + RNA_def_property_ui_text(prop, "Face normal", "Local space unit length normal vector for this face"); prop= RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_MeshFace_area_get", NULL, NULL); - RNA_def_property_ui_text(prop, "face area", "read only area of the face"); + RNA_def_property_ui_text(prop, "Face area", "Read only area of the face"); prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1376,12 +1377,6 @@ static void rna_def_mtface(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem transp_items[]= { - {TF_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"}, - {TF_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"}, - {TF_ALPHA, "ALPHA", 0, "Alpha", "Render polygon transparent, depending on alpha channel of the texture"}, - {TF_CLIP, "CLIPALPHA", 0, "Clip Alpha", "Use the images alpha values clipped with no blending (binary alpha)"}, - {0, NULL, 0, NULL, NULL}}; const int uv_dim[]= {4, 2}; srna= RNA_def_struct(brna, "MeshTextureFaceLayer", NULL); @@ -1418,8 +1413,8 @@ static void rna_def_mtface(BlenderRNA *brna) RNA_def_property_struct_type(prop, "MeshTextureFace"); RNA_def_property_ui_text(prop, "Data", ""); RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", - "rna_iterator_array_end", "rna_iterator_array_get", - "rna_MeshTextureFaceLayer_data_length", 0, 0); + "rna_iterator_array_end", "rna_iterator_array_get", + "rna_MeshTextureFaceLayer_data_length", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshTextureFace", NULL); RNA_def_struct_sdna(srna, "MTFace"); @@ -1434,79 +1429,6 @@ static void rna_def_mtface(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - //XXX to be deleted soon -- left for now in case we need it for debug - //XXX it should be out before Blender 2.6 (after texface to material patch) - - prop= RNA_def_property(srna, "use_image", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TEX); - RNA_def_property_ui_text(prop, "Tex", "Render face with texture"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_light", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_LIGHT); - RNA_def_property_ui_text(prop, "Light", "Use light for face"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_INVISIBLE); - RNA_def_property_ui_text(prop, "Invisible", "Make face invisible"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_DYNAMIC); - RNA_def_property_ui_text(prop, "Collision", "Use face for collision and ray-sensor detection"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_blend_shared", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_SHAREDCOL); - RNA_def_property_ui_text(prop, "Shared", "Blend vertex colors across face when vertices are shared"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_twoside", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TWOSIDE); - RNA_def_property_ui_text(prop, "Two-side", "Render face two-sided"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_object_color", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_OBCOL); - RNA_def_property_ui_text(prop, "Object Color", "Use ObColor instead of vertex colors"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BILLBOARD); - RNA_def_property_ui_text(prop, "Halo", "Screen aligned billboard"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_billboard", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BILLBOARD2); - RNA_def_property_ui_text(prop, "Billboard", "Billboard with Z-axis constraint"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_shadow_cast", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_SHADOW); - RNA_def_property_ui_text(prop, "Shadow", "Face is used for shadow"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_bitmap_text", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BMFONT); - RNA_def_property_ui_text(prop, "Text", "Enable bitmap text on face"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_alpha_sort", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_ALPHASORT); - RNA_def_property_ui_text(prop, "Alpha Sort", - "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "transp"); - RNA_def_property_enum_items(prop, transp_items); - RNA_def_property_ui_text(prop, "Transparency", "Transparency blending mode"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - //XXX to be deleted soon -- left for now in case we need it for debug - //XXX it should be out before Blender 2.6 (after texface to material patch) - prop= RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1); RNA_def_property_array(prop, 4); @@ -1606,7 +1528,7 @@ static void rna_def_mcol(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Data", ""); RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", - "rna_MeshColorLayer_data_length", 0, 0); + "rna_MeshColorLayer_data_length", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshColor", NULL); RNA_def_struct_sdna(srna, "MCol"); @@ -1663,7 +1585,7 @@ static void rna_def_mproperties(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Data", ""); RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", - "rna_MeshFloatPropertyLayer_data_length", 0, 0); + "rna_MeshFloatPropertyLayer_data_length", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshFloatProperty", NULL); RNA_def_struct_sdna(srna, "MFloatProperty"); @@ -1691,7 +1613,7 @@ static void rna_def_mproperties(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Data", ""); RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", - "rna_MeshIntPropertyLayer_data_length", 0, 0); + "rna_MeshIntPropertyLayer_data_length", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshIntProperty", NULL); RNA_def_struct_sdna(srna, "MIntProperty"); @@ -1719,7 +1641,7 @@ static void rna_def_mproperties(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Data", ""); RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", - "rna_MeshStringPropertyLayer_data_length", 0, 0); + "rna_MeshStringPropertyLayer_data_length", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshStringProperty", NULL); RNA_def_struct_sdna(srna, "MStringProperty"); @@ -1923,7 +1845,7 @@ static void rna_def_mesh(BlenderRNA *brna) /* UV textures */ prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", 0, 0, 0, "rna_Mesh_uv_textures_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, "rna_Mesh_uv_textures_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_ui_text(prop, "UV Textures", ""); rna_def_uv_textures(brna, prop); @@ -1953,26 +1875,26 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", 0, 0, 0, "rna_Mesh_vertex_colors_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL, "rna_Mesh_vertex_colors_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshColorLayer"); RNA_def_property_ui_text(prop, "Vertex Colors", ""); rna_def_vertex_colors(brna, prop); prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", 0, 0, 0, "rna_Mesh_float_layers_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL, "rna_Mesh_float_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer"); RNA_def_property_ui_text(prop, "Float Property Layers", ""); prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", 0, 0, 0, "rna_Mesh_int_layers_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL, "rna_Mesh_int_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshIntPropertyLayer"); RNA_def_property_ui_text(prop, "Int Property Layers", ""); prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", 0, 0, 0, "rna_Mesh_string_layers_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL, "rna_Mesh_string_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshStringPropertyLayer"); RNA_def_property_ui_text(prop, "String Property Layers", ""); @@ -2042,6 +1964,7 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Material"); RNA_def_property_ui_text(prop, "Materials", ""); RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ + RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); /* Mesh Draw Options for Edit Mode*/ diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 5e5cf0be0ae..1c7359cc195 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -330,7 +330,8 @@ static void rna_def_metaball(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_struct_type(prop, "Material"); RNA_def_property_ui_text(prop, "Materials", ""); - RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ + RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ + RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); /* anim */ rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 00ac371f929..fbf54a76cd9 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -91,7 +91,6 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""}, {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""}, {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""}, - {eModifierType_NavMesh, "NAVMESH", ICON_MOD_PHYSICS, "Navigation mesh", ""}, {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLES, "Particle Instance", ""}, {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""}, {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""}, @@ -189,8 +188,6 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_ScrewModifier; case eModifierType_Warp: return &RNA_WarpModifier; - case eModifierType_NavMesh: - return &RNA_NavMeshModifier; case eModifierType_WeightVGEdit: return &RNA_VertexWeightEditModifier; case eModifierType_WeightVGMix: @@ -275,7 +272,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) part->end = 250.0f; part->ren_as = PART_DRAW_NOT; part->draw_as = PART_DRAW_DOT; - sprintf(psys->name, "SmokeParticles"); + BLI_strncpy(psys->name, "SmokeParticles", sizeof(psys->name)); psys->recalc |= (PSYS_RECALC_RESET|PSYS_RECALC_PHYS); DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); } @@ -1564,7 +1561,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna) prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "UVProjector"); - RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Projectors", ""); prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); @@ -2490,17 +2487,6 @@ static void rna_def_modifier_screw(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update");*/ } -static void rna_def_modifier_navmesh(BlenderRNA *brna) -{ - StructRNA *srna; - /* PropertyRNA *prop; */ /* UNUSED */ - - srna= RNA_def_struct(brna, "NavMeshModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "NavMesh Modifier", "NavMesh modifier"); - RNA_def_struct_sdna(srna, "NavMeshModifierData"); - RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM); -} - static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna) { static EnumPropertyItem weightvg_mask_tex_map_items[] = { @@ -2893,7 +2879,6 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_smoke(brna); rna_def_modifier_solidify(brna); rna_def_modifier_screw(brna); - rna_def_modifier_navmesh(brna); rna_def_modifier_weightvgedit(brna); rna_def_modifier_weightvgmix(brna); rna_def_modifier_weightvgproximity(brna); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 1b113620663..813375a3549 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1874,6 +1874,11 @@ static void def_cmp_id_mask(StructRNA *srna) RNA_def_property_range(prop, 0, 10000); RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "use_smooth_mask", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0); + RNA_def_property_ui_text(prop, "Smooth Mask", "Apply an anti-aliasing filter to the mask"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); } static void def_cmp_map_uv(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 6c273ff9f2e..428599af977 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -250,16 +250,20 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_tag_update(ptr->id.data, OB_RECALC_OB); - DAG_scene_sort(bmain, scene); + if (scene) { + DAG_scene_sort(bmain, scene); + } WM_main_add_notifier(NC_OBJECT|ND_PARENT, ptr->id.data); } /* when changing the selection flag the scene needs updating */ static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { - Object *ob= (Object*)ptr->id.data; - short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT; - ED_base_object_select(object_in_scene(ob, scene), mode); + if (scene) { + Object *ob= (Object*)ptr->id.data; + short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT; + ED_base_object_select(object_in_scene(ob, scene), mode); + } } static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -387,7 +391,8 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value) ED_object_parent(ob, ob->parent, value, ob->parsubstr); } -static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { Object *ob= (Object*)ptr->data; EnumPropertyItem *item= NULL; @@ -418,7 +423,8 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point return item; } -static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { Object *ob= (Object*)ptr->data; EnumPropertyItem *item= NULL; @@ -884,12 +890,14 @@ static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr) static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) { Object *ob= (Object*)ptr->id.data; + const int was_navmesh= (ob->gameflag & OB_NAVMESH); ob->body_type= value; switch (ob->body_type) { case OB_BODY_TYPE_SENSOR: ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST; - ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH); + ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION + |OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH); break; case OB_BODY_TYPE_OCCLUDER: ob->gameflag |= OB_OCCLUDER; @@ -898,6 +906,12 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) case OB_BODY_TYPE_NAVMESH: ob->gameflag |= OB_NAVMESH; ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_OCCLUDER); + + if (ob->type == OB_MESH) { + /* could be moved into mesh UI but for now ensure mesh data layer */ + BKE_mesh_ensure_navmesh(ob->data); + } + break; case OB_BODY_TYPE_NO_COLLISION: ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_OCCLUDER|OB_DYNAMIC|OB_NAVMESH); @@ -929,6 +943,15 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) ob->bsoft = bsbNew(); break; } + + if (was_navmesh != (ob->gameflag & OB_NAVMESH)) { + if (ob->type == OB_MESH) { + /* this is needed to refresh the derived meshes draw func */ + DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data); + } + } + } static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr) @@ -1172,7 +1195,8 @@ static void rna_Object_vgroup_remove(Object *ob, bDeformGroup *defgroup) WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } -static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, int *index, float weight, int assignmode) +static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, + int *index, float weight, int assignmode) { Object *ob = (Object *)id; @@ -1353,7 +1377,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"}, {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"}, {OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"}, - {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"}, + {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", + "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"}, {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"}, {0, NULL, 0, NULL, NULL}}; @@ -1371,7 +1396,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Controller"); - RNA_def_property_ui_text(prop, "Controllers", "Game engine controllers to process events, connecting sensor to actuators"); + RNA_def_property_ui_text(prop, "Controllers", + "Game engine controllers to process events, connecting sensor to actuators"); prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Actuator"); @@ -1475,7 +1501,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) /* is this used anywhere ? */ prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); @@ -1484,7 +1510,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH); - RNA_def_property_ui_text(prop, "Rotate From Normal", "Use face normal to rotate object, so that it points away from the surface"); + RNA_def_property_ui_text(prop, "Rotate From Normal", + "Use face normal to rotate object, so that it points away from the surface"); prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "formfactor"); @@ -1498,7 +1525,9 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Friction Coefficients", "Relative friction coefficient in the in the X, Y and Z directions, when anisotropic friction is enabled"); + RNA_def_property_ui_text(prop, "Friction Coefficients", + "Relative friction coefficient in the in the X, Y and Z directions, " + "when anisotropic friction is enabled"); prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS); @@ -1518,13 +1547,14 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "margin"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability"); + RNA_def_property_ui_text(prop, "Collision Margin", + "Extra margin around object for collision detection, small amount required for stability"); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "bsoft"); RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation"); - prop= RNA_def_property(srna, "create_obstacle", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE); RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation"); @@ -1678,7 +1708,9 @@ static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", + "rna_Object_active_particle_system_index_set", + "rna_Object_active_particle_system_index_range"); RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update"); } @@ -1701,14 +1733,16 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "VertexGroup"); - RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", + "rna_Object_active_vertex_group_set", NULL, NULL); RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object"); RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "actdef"); - RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", + "rna_Object_active_vertex_group_index_range"); RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array"); RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data"); @@ -1791,7 +1825,8 @@ static void rna_def_object(BlenderRNA *brna) {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"}, {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"}, {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"}, - {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, + {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", + "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, {0, NULL, 0, NULL, NULL}}; static float default_quat[4] = {1,0,0,0}; /* default quaternion values */ @@ -1875,13 +1910,17 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "trackflag"); RNA_def_property_enum_items(prop, track_items); - RNA_def_property_ui_text(prop, "Track Axis", "Axis that points in 'forward' direction (applies to DupliFrame when parent 'Follow' is enabled)"); + RNA_def_property_ui_text(prop, "Track Axis", + "Axis that points in 'forward' direction (applies to DupliFrame when " + "parent 'Follow' is enabled)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "upflag"); RNA_def_property_enum_items(prop, up_items); - RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction (applies to DupliFrame when parent 'Follow' is enabled)"); + RNA_def_property_ui_text(prop, "Up Axis", + "Axis that points in the upward direction (applies to DupliFrame when " + "parent 'Follow' is enabled)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); /* proxy */ @@ -1895,7 +1934,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_struct_type(prop, "MaterialSlot"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL); /* don't dereference pointer! */ + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL); /* don't dereference pointer! */ RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object"); prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); @@ -1908,7 +1947,8 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "actcol"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", + "rna_Object_active_material_index_range"); RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot"); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); @@ -1975,20 +2015,23 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "drot"); - RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", "Extra rotation added to the rotation of the object (when using Euler rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", + "Extra rotation added to the rotation of the object (when using Euler rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); prop= RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION); RNA_def_property_float_sdna(prop, NULL, "dquat"); RNA_def_property_float_array_default(prop, default_quat); - RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", "Extra rotation added to the rotation of the object (when using Quaternion rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", + "Extra rotation added to the rotation of the object (when using Quaternion rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); #if 0 // XXX not supported well yet... prop= RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE); RNA_def_property_float_sdna(prop, NULL, "dquat"); // FIXME: this is not a single field any more! (drotAxis and drotAngle) RNA_def_property_float_array_default(prop, default_axisAngle); - RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", + "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); #endif @@ -2016,11 +2059,13 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW); RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); - RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface"); + RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", + "Lock editing of 'angle' component of four-component rotations in the interface"); // XXX this needs a better name prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D); - RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)"); + RNA_def_property_ui_text(prop, "Lock Rotations (4D)", + "Lock editing of four component rotations by components (instead of as Eulers)"); prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX); @@ -2252,11 +2297,12 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_time_offset_edit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB); - RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for F-Curve and action views"); + RNA_def_property_ui_text(prop, "Time Offset Edit", + "Use time offset when inserting keys and display time offset for F-Curve and action views"); prop= RNA_def_property(srna, "use_time_offset_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT); - RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this objects parent relationship"); + RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this object's parent relationship"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); prop= RNA_def_property(srna, "use_time_offset_particle", PROP_BOOLEAN, PROP_NONE); @@ -2266,7 +2312,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_time_offset_add_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENTADD); - RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value"); + RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parent's time offset value"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); /* drawing */ @@ -2278,7 +2324,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX); - RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds"); + RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE); @@ -2289,32 +2335,33 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME); - RNA_def_property_ui_text(prop, "Draw Name", "Displays the object's name"); + RNA_def_property_ui_text(prop, "Draw Name", "Display the object's name"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS); - RNA_def_property_ui_text(prop, "Draw Axis", "Displays the object's origin and axis"); + RNA_def_property_ui_text(prop, "Draw Axes", "Display the object's origin and axes"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE); - RNA_def_property_ui_text(prop, "Draw Texture Space", "Displays the object's texture space"); + RNA_def_property_ui_text(prop, "Draw Texture Space", "Display the object's texture space"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE); - RNA_def_property_ui_text(prop, "Draw Wire", "Adds the object's wireframe over solid drawing"); + RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP); - RNA_def_property_ui_text(prop, "Draw Transparent", "Displays material transparency in the object (unsupported for duplicator drawing)"); + RNA_def_property_ui_text(prop, "Draw Transparent", + "Display material transparency in the object (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY); - RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others (unsupported for duplicator drawing)"); + RNA_def_property_ui_text(prop, "X-Ray", "Make the object draw in front of others (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* Grease Pencil */ diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index cc086bca6d8..a6e0e9f3331 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -827,8 +827,7 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); prop= RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", - "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list"); rna_def_ptcache_point_caches(brna, prop); @@ -1049,18 +1048,21 @@ static void rna_def_field(BlenderRNA *brna) static EnumPropertyItem field_type_items[] = { {0, "NONE", 0, "None", ""}, - {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Gives a radial field toward the center of object"}, - {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force objects local Z axis"}, - {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force objects local Z axis"}, + {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"}, + {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"}, + {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Spiraling force that twists the force object's local Z axis"}, {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"}, - {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", "The source of this force field is the zero point of a harmonic oscillator"}, - {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, - {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", "Forcefield based on the Lennard-Jones potential"}, + {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", + "The source of this force field is the zero point of a harmonic oscillator"}, + {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", + "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, + {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", + "Forcefield based on the Lennard-Jones potential"}, {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"}, - {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Creates a force along a curve object"}, + {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Create a force along a curve object"}, {PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""}, - {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Creates turbulence with a noise field"}, - {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Creates a force that dampens motion"}, + {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Create turbulence with a noise field"}, + {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem falloff_items[] = { @@ -1677,7 +1679,7 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "use_estimate_matrix", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_ESTIMATEIPO); - RNA_def_property_ui_text(prop, "Estimate matrix", "estimate matrix .. split to COM , ROT ,SCALE "); + RNA_def_property_ui_text(prop, "Estimate matrix", "Estimate matrix... split to COM, ROT, SCALE"); /***********************************************************************************/ @@ -1719,7 +1721,7 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Stiff Quads", "Adds diagonal springs on 4-gons"); + RNA_def_property_ui_text(prop, "Stiff Quads", "Add diagonal springs on 4-gons"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 77fa975761f..f0f782fede2 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -19,6 +19,9 @@ * * Contributor(s): Blender Foundation (2008). * + * Adaptive time step + * Copyright 2011 AutoCRC + * * ***** END GPL LICENSE BLOCK ***** */ @@ -145,33 +148,38 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSy *psmd_pt= NULL; *pa_pt= NULL; - /* weak, what about multiple particle systems? */ - for (md = ob->modifiers.first; md; md=md->next) { - if (md->type == eModifierType_ParticleSystem) - psmd= (ParticleSystemModifierData*) md; - } - - if (!psmd || !psmd->dm || !psmd->psys) { - return; - } - - psys= psmd->psys; - - /* not a very efficient way of getting hair key location data, - * but it's the best we've got at the present */ - - /* find the particle that corresponds with this HairKey */ - for(i=0, pa=psys->particles; i<psys->totpart; i++, pa++) { - - /* hairkeys are stored sequentially in memory, so we can find if - * it's the same particle by comparing pointers, without having - * to iterate over them all */ - if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) - break; + /* given the pointer HairKey *hkey, we iterate over all particles in all + * particle systems in the object "ob" in order to find + *- the ParticleSystemData to which the HairKey (and hence the particle) + * belongs (will be stored in psmd_pt) + *- the ParticleData to which the HairKey belongs (will be stored in pa_pt) + * + * not a very efficient way of getting hair key location data, + * but it's the best we've got at the present + * + * IDEAS: include additional information in pointerRNA beforehand, + * for example a pointer to the ParticleStstemModifierData to which the + * hairkey belongs. + */ + + for (md= ob->modifiers.first; md; md=md->next) { + if (md->type == eModifierType_ParticleSystem) { + psmd= (ParticleSystemModifierData *) md; + if (psmd && psmd->dm && psmd->psys) { + psys = psmd->psys; + for(i= 0, pa= psys->particles; i < psys->totpart; i++, pa++) { + /* hairkeys are stored sequentially in memory, so we can + * find if it's the same particle by comparing pointers, + * without having to iterate over them all */ + if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) { + *psmd_pt = psmd; + *pa_pt = pa; + return; + } + } + } + } } - - *psmd_pt= psmd; - *pa_pt= pa; } static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values) @@ -683,14 +691,13 @@ static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int } } +static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str); + static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr) { - ParticleDupliWeight *dw= ptr->data; - - if(dw->ob) - return strlen(dw->ob->id.name+2) + 7; - else - return 9 + 7; + char tstr[32]; + rna_ParticleDupliWeight_name_get(ptr, tstr); + return strlen(tstr); } static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str) @@ -2044,12 +2051,23 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL); RNA_def_property_range(prop, 0.0001, 100.0); RNA_def_property_ui_range(prop, 0.01, 10, 1, 3); - RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (in seconds)"); + RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - + + prop= RNA_def_property(srna, "adaptive_subframes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF); + RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations"); + RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations (dt = timestep / (subframes + 1))"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.01, 10); + RNA_def_property_float_default(prop, 0.2); + RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold", "The relative distance a particle can move before requiring more subframes (target Courant number); 0.1-0.3 is the recommended range"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE); @@ -2857,6 +2875,13 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode"); + /* Read-only: this is calculated internally. Changing it would only affect + * the next time-step. The user should change ParticlSettings.subframes or + * ParticleSettings.courant_target instead. */ + prop= RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 1.0f/101.0f, 1.0f); + RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_struct_path_func(srna, "rna_ParticleSystem_path"); } @@ -2877,4 +2902,3 @@ void RNA_def_particle(BlenderRNA *brna) } #endif - diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 338073fde00..b61495edc94 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -1240,7 +1240,7 @@ static void rna_def_pose(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL); RNA_def_property_struct_type(prop, "PoseBone"); RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string"); /* can be removed, only for fast lookup */ + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL); /* can be removed, only for fast lookup */ /* bone groups */ prop= RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 1003c9bfba2..f5fab9d2f33 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -329,8 +329,7 @@ static void rna_def_render_result(BlenderRNA *brna) parm= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(parm, "RenderLayer"); - RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", - "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_define_verify_sdna(1); } @@ -361,8 +360,7 @@ static void rna_def_render_layer(BlenderRNA *brna) prop= RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "RenderPass"); - RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", - "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); prop= RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 95c6b066510..376b0c529d0 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -506,6 +506,13 @@ static int rna_Property_readonly_get(PointerRNA *ptr) return prop->flag & PROP_EDITABLE ? 0:1; } +static int rna_Property_animatable_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + + return (prop->flag & PROP_ANIMATABLE) != 0; +} + static int rna_Property_use_output_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -979,13 +986,13 @@ static void rna_def_struct(BlenderRNA *brna) prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Property"); - RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Properties", "Properties in the struct"); prop= RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Function"); - RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Functions", ""); } @@ -1066,6 +1073,11 @@ static void rna_def_property(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL); RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA"); + prop= RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", NULL); + RNA_def_property_ui_text(prop, "Animatable", "Property is animatable through RNA"); + prop= RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL); @@ -1135,7 +1147,7 @@ static void rna_def_function(BlenderRNA *brna) prop= RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE); /*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/ RNA_def_property_struct_type(prop, "Property"); - RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function"); prop= RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE); @@ -1286,7 +1298,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna) prop= RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "EnumPropertyItem"); - RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Items", "Possible values for the property"); srna= RNA_def_struct(brna, "EnumPropertyItem", NULL); @@ -1389,9 +1401,9 @@ void RNA_def_rna(BlenderRNA *brna) RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", /* included for speed, can be removed */ #if 0 - 0,0,0); + 0,0,0,0); #else - "rna_BlenderRNA_structs_length", "rna_BlenderRNA_structs_lookup_int", "rna_BlenderRNA_structs_lookup_string"); + "rna_BlenderRNA_structs_length", "rna_BlenderRNA_structs_lookup_int", "rna_BlenderRNA_structs_lookup_string", NULL); #endif RNA_def_property_ui_text(prop, "Structs", ""); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 6e413f26206..fa2b2eae8db 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -631,7 +631,8 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in rd->qtcodecsettings.codecType = quicktime_videocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item= NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -672,7 +673,8 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt rd->qtcodecsettings.audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item= NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -743,7 +745,8 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); } -static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *free) { RenderEngineType *type; EnumPropertyItem *item= NULL; @@ -1158,7 +1161,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) static EnumPropertyItem sketch_convert_items[] = { {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"}, {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"}, - {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive", "Subdivide stroke adaptively, with more subdivision in curvier parts"}, + {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive", + "Subdivide stroke adaptively, with more subdivision in curvier parts"}, {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"}, {0, NULL, 0, NULL, NULL}}; @@ -1212,7 +1216,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "proportional"); RNA_def_property_enum_items(prop, proportional_editing_items); - RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional Editing mode, allows transforms with distance fall-off"); + RNA_def_property_ui_text(prop, "Proportional Editing", + "Proportional Editing mode, allows transforms with distance fall-off"); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ prop= RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE); @@ -1275,13 +1280,14 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT); - RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects"); + RNA_def_property_ui_text(prop, "Project Individual Elements", + "Project individual elements on the surface of other objects"); RNA_def_property_ui_icon(prop, ICON_RETOPO, 0); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ prop= RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF); - RNA_def_property_ui_text(prop, "Project to Self", "Snap onto its self (editmode)"); + RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)"); RNA_def_property_ui_icon(prop, ICON_ORTHO, 0); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ @@ -1304,11 +1310,14 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA); - RNA_def_property_ui_text(prop, "Layered", "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking"); + RNA_def_property_ui_text(prop, "Layered", + "Add a new NLA Track + Strip for every loop/pass made over the animation " + "to allow non-destructive tweaking"); prop= RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET); - RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set only"); + RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", + "Automatic keyframe insertion using active Keying Set only"); RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0); /* UV */ @@ -1419,11 +1428,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "sculpt_paint_use_unified_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_SIZE); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius", "Instead of per brush radius, the radius is shared across brushes"); + RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius", + "Instead of per brush radius, the radius is shared across brushes"); prop= RNA_def_property(srna, "sculpt_paint_use_unified_strength", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_ALPHA); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength", "Instead of per brush strength, the strength is shared across brushes"); + RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength", + "Instead of per brush strength, the strength is shared across brushes"); } @@ -1439,7 +1450,7 @@ static void rna_def_unit_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem rotation_units[] = { - {0, "DEGREES", 0, "Degrees", "Use degrees for measuring rotation"}, + {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"}, {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1553,7 +1564,7 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) prop= RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA); - RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (On top of Solid and Halos)"); + RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)"); if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -2095,13 +2106,13 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent"); RNA_def_property_update(prop, NC_SCENE, NULL); - prop= RNA_def_property(srna, "max_climb", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb"); RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb"); RNA_def_property_update(prop, NC_SCENE, NULL); - prop= RNA_def_property(srna, "max_slope", PROP_FLOAT, PROP_ANGLE); + prop= RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "agentmaxslope"); RNA_def_property_range(prop, 0, M_PI/2); RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees"); @@ -2157,8 +2168,10 @@ static void rna_def_scene_game_data(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem framing_types_items[] ={ - {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", "Show the entire viewport in the display window, using bar horizontally or vertically"}, - {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", "Show the entire viewport in the display window, viewing more horizontally or vertically"}, + {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", + "Show the entire viewport in the display window, using bar horizontally or vertically"}, + {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", + "Show the entire viewport in the display window, viewing more horizontally or vertically"}, {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"}, {0, NULL, 0, NULL, NULL}}; @@ -2226,19 +2239,19 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "depth"); RNA_def_property_range(prop, 8, 32); - RNA_def_property_ui_text(prop, "Bits", "Displays bit depth of full screen display"); + RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display"); RNA_def_property_update(prop, NC_SCENE, NULL); // Do we need it here ? (since we already have it in World prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "freqplay"); RNA_def_property_range(prop, 4, 2000); - RNA_def_property_ui_text(prop, "Freq", "Displays clock frequency of fullscreen display"); + RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "fullscreen", 1.0); - RNA_def_property_ui_text(prop, "Fullscreen", "Starts player in a new fullscreen display"); + RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Framing */ @@ -2271,7 +2284,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "eyeseparation"); RNA_def_property_range(prop, 0.01, 5.0); - RNA_def_property_ui_text(prop, "Eye Separation", "Set the distance between the eyes - the camera focal length/30 should be fine"); + RNA_def_property_ui_text(prop, "Eye Separation", + "Set the distance between the eyes - the camera focal length/30 should be fine"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Dome */ @@ -2329,35 +2343,44 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); - RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); + RNA_def_property_ui_text(prop, "Occlusion Resolution", + "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ticrate"); RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 250); - RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate"); + RNA_def_property_ui_text(prop, "Frames Per Second", + "The nominal number of game frames per second " + "(physics fixed timestep = 1/fps, independently of actual frame rate)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Logic Steps", "Sets the maximum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics"); + RNA_def_property_ui_text(prop, "Max Logic Steps", + "Sets the maximum number of logic frame per game frame if graphics slows down the game, " + "higher value allows better synchronization with physics"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxphystep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Physics Steps", "Sets the maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime"); + RNA_def_property_ui_text(prop, "Max Physics Steps", + "Sets the maximum number of physics step per game frame if graphics slows down the game, " + "higher value allows physics to keep up with realtime"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "physubstep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Physics Sub Steps", "Sets the number of simulation substep per physic timestep, higher value give better physics precision"); + RNA_def_property_ui_text(prop, "Physics Sub Steps", + "Sets the number of simulation substep per physic timestep, " + "higher value give better physics precision"); RNA_def_property_update(prop, NC_SCENE, NULL); /* mode */ @@ -2374,7 +2397,9 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled"); + RNA_def_property_ui_text(prop, "box radius", + "Radius of the activity bubble, in Manhattan length " + "(objects outside the box are activity-culled)"); /* booleans */ prop= RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE); @@ -2383,7 +2408,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE); - RNA_def_property_ui_text(prop, "Show Framerate and Profile", "Show framerate and profiling information while the game runs"); + RNA_def_property_ui_text(prop, "Show Framerate and Profile", + "Show framerate and profiling information while the game runs"); prop= RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS); @@ -2527,13 +2553,15 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "actlay"); - RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", "rna_RenderSettings_active_layer_index_range"); + RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", + "rna_RenderSettings_active_layer_index_range"); RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED); RNA_def_property_struct_type(prop, "SceneRenderLayer"); - RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", "rna_RenderSettings_active_layer_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", + "rna_RenderSettings_active_layer_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); @@ -2758,7 +2786,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes"); RNA_def_property_enum_items(prop, image_color_mode_items); - RNA_def_property_ui_text(prop, "Color Mode", "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, AND RGBA for saving red, green, blue + alpha channels"); + RNA_def_property_ui_text(prop, "Color Mode", + "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, " + "and RGBA for saving red, green, blue and alpha channels"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); @@ -2809,7 +2839,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "quality"); RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */ - RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, Compression for PNG's"); + RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, compression for PNG's"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Tiff */ @@ -2968,19 +2998,19 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "ffmpeg_video_bitrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.video_bitrate"); RNA_def_property_range(prop, 1, 14000); - RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate(kb/s)"); + RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_minrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.rc_min_rate"); RNA_def_property_range(prop, 0, 9000); - RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate(kb/s)"); + RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_maxrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.rc_max_rate"); RNA_def_property_range(prop, 1, 14000); - RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate(kb/s)"); + RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_muxrate", PROP_INT, PROP_NONE); @@ -3024,7 +3054,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_bitrate"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 32, 384); - RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate(kb/s)"); + RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_audio_volume", PROP_FLOAT, PROP_NONE); @@ -3047,7 +3077,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "ffcodecdata.audio_channels"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, audio_channel_items); - RNA_def_property_ui_text(prop, "Audio Channels", "Sets the audio channel count"); + RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count"); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frs_sec"); @@ -3068,21 +3098,22 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "framapto"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); - RNA_def_property_ui_text(prop, "Frame Map Old", "Specify old mapping value in frames"); + RNA_def_property_ui_text(prop, "Frame Map Old", "Old mapping value in frames"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "images"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); - RNA_def_property_ui_text(prop, "Frame Map New", "Specify how many frames the Map Old will last"); + RNA_def_property_ui_text(prop, "Frame Map New", "How many frames the Map Old will last"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dither_intensity"); RNA_def_property_range(prop, 0.0f, 2.0f); - RNA_def_property_ui_text(prop, "Dither Intensity", "Amount of dithering noise added to the rendered image to break up banding"); + RNA_def_property_ui_text(prop, "Dither Intensity", + "Amount of dithering noise added to the rendered image to break up banding"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "pixel_filter_type", PROP_ENUM, PROP_NONE); @@ -3106,7 +3137,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "octree_resolution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ocres"); RNA_def_property_enum_items(prop, octree_resolution_items); - RNA_def_property_ui_text(prop, "Octree Resolution", "Resolution of raytrace accelerator. Use higher resolutions for larger scenes"); + RNA_def_property_ui_text(prop, "Octree Resolution", + "Resolution of raytrace accelerator, use higher resolutions for larger scenes"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "raytrace_method", PROP_ENUM, PROP_NONE); @@ -3117,12 +3149,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_instances", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_INSTANCES); - RNA_def_property_ui_text(prop, "Use Instances", "Instance support leads to effective memory reduction when using duplicates"); + RNA_def_property_ui_text(prop, "Use Instances", + "Instance support leads to effective memory reduction when using duplicates"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_LOCAL_COORDS); - RNA_def_property_ui_text(prop, "Use Local Coords", "Vertex coordinates are stored localy on each primitive. Increases memory usage, but may have impact on speed"); + RNA_def_property_ui_text(prop, "Use Local Coords", + "Vertex coordinates are stored localy on each primitive " + "(increases memory usage, but may have impact on speed)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); @@ -3144,7 +3179,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, field_order_items); - RNA_def_property_ui_text(prop, "Field Order", "Order of video fields. Select which lines get rendered first, to create smooth motion for TV output"); + RNA_def_property_ui_text(prop, "Field Order", + "Order of video fields (select which lines get rendered first, " + "to create smooth motion for TV output)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_fields_still", PROP_BOOLEAN, PROP_NONE); @@ -3210,7 +3247,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "threads"); RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS); RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Threads", "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)"); + RNA_def_property_ui_text(prop, "Threads", + "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE); @@ -3241,31 +3279,33 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* border */ prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER); - RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size. Note, this disables save_buffers and full_sample"); + RNA_def_property_ui_text(prop, "Border", + "Render a user-defined border region, within the frame size " + "(note that this disables save_buffers and full_sample)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.xmin"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Minimum X", "Sets minimum X value to for the render border"); + RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value to for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.ymin"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Minimum Y", "Sets minimum Y value for the render border"); + RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.xmax"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Maximum X", "Sets maximum X value for the render border"); + RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.ymax"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Maximum Y", "Sets maximum Y value for the render border"); + RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE); @@ -3275,7 +3315,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_TOUCH); - RNA_def_property_ui_text(prop, "Placeholders", "Create empty placeholder files while rendering frames (similar to Unix 'touch')"); + RNA_def_property_ui_text(prop, "Placeholders", + "Create empty placeholder files while rendering frames (similar to Unix 'touch')"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE); @@ -3285,12 +3326,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP); - RNA_def_property_ui_text(prop, "Compositing", "Process the render result through the compositing pipeline, if compositing nodes are enabled"); + RNA_def_property_ui_text(prop, "Compositing", + "Process the render result through the compositing pipeline, if compositing nodes are enabled"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOSEQ); - RNA_def_property_ui_text(prop, "Sequencer", "Process the render (and composited) result through the video sequence editor pipeline, if sequencer strips exist"); + RNA_def_property_ui_text(prop, "Sequencer", + "Process the render (and composited) result through the video sequence " + "editor pipeline, if sequencer strips exist"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_color_management", PROP_BOOLEAN, PROP_NONE); @@ -3301,7 +3345,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION); - RNA_def_property_ui_text(prop, "File Extensions", "Add the file format extensions to the rendered file name (eg: filename + .jpg)"); + RNA_def_property_ui_text(prop, "File Extensions", + "Add the file format extensions to the rendered file name (eg: filename + .jpg)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); @@ -3323,7 +3368,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_free_image_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FREE_IMAGE); - RNA_def_property_ui_text(prop, "Free Image Textures", "Free all image texture from memory after render, to save memory before compositing"); + RNA_def_property_ui_text(prop, "Free Image Textures", + "Free all image texture from memory after render, to save memory before compositing"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_free_unused_nodes", PROP_BOOLEAN, PROP_NONE); @@ -3334,13 +3380,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_TILE_FILE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_save_buffers_get", NULL); - RNA_def_property_ui_text(prop, "Save Buffers","Save tiles for all RenderLayers and SceneNodes to files in the temp directory (saves memory, required for Full Sample)"); + RNA_def_property_ui_text(prop, "Save Buffers", + "Save tiles for all RenderLayers and SceneNodes to files in the temp directory " + "(saves memory, required for Full Sample)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_full_sample_get", NULL); - RNA_def_property_ui_text(prop, "Full Sample","Save for every anti-aliasing sample the entire RenderLayer results. This solves anti-aliasing issues with compositing"); + RNA_def_property_ui_text(prop, "Full Sample", + "Save for every anti-aliasing sample the entire RenderLayer results " + "(this solves anti-aliasing issues with compositing)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); @@ -3351,7 +3401,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "pic"); - RNA_def_property_ui_text(prop, "Output Path", "Directory/name to save animations, # characters defines the position and length of frame numbers"); + RNA_def_property_ui_text(prop, "Output Path", + "Directory/name to save animations, # characters defines the position " + "and length of frame numbers"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Bake */ @@ -3377,11 +3429,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_TO_ACTIVE); - RNA_def_property_ui_text(prop, "Selected to Active", "Bake shading on the surface of selected objects to the active object"); + RNA_def_property_ui_text(prop, "Selected to Active", + "Bake shading on the surface of selected objects to the active object"); prop= RNA_def_property(srna, "use_bake_normalize", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_NORMALIZE); - RNA_def_property_ui_text(prop, "Normalized", "With displacement normalize to the distance, with ambient occlusion normalize without using material settings"); + RNA_def_property_ui_text(prop, "Normalized", + "With displacement normalize to the distance, with ambient occlusion " + "normalize without using material settings"); prop= RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_CLEAR); @@ -3399,7 +3454,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "bake_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bake_maxdist"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units"); + RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units)"); prop= RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bake_biasdist"); @@ -3418,7 +3473,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME); - RNA_def_property_ui_text(prop, "Stamp Time", "Include the render frame as HH:MM:SS.FF in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Time", "Include the rendered frame timecode as HH:MM:SS.FF in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE); @@ -3438,7 +3493,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS); - RNA_def_property_ui_text(prop, "Stamp Lens", "Include the name of the active cameras lens in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Lens", "Include the active camera's lens in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE); @@ -3458,17 +3513,18 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FILENAME); - RNA_def_property_ui_text(prop, "Stamp Filename", "Include the filename of the .blend file in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Filename", "Include the .blend filename in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP); - RNA_def_property_ui_text(prop, "Stamp Sequence Strip", "Include the name of the foreground sequence strip in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Sequence Strip", + "Include the name of the foreground sequence strip in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME); - RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in the stamp image"); + RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE); @@ -3523,14 +3579,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view"); /* layers */ - prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "layers", NULL); RNA_def_property_struct_type(prop, "SceneRenderLayer"); RNA_def_property_ui_text(prop, "Render Layers", ""); rna_def_render_layers(brna, prop); - + prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); @@ -3540,7 +3595,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* engine */ prop= RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, engine_items); - RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", "rna_RenderSettings_engine_itemf"); + RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", + "rna_RenderSettings_engine_itemf"); RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); RNA_def_property_update(prop, NC_WINDOW, NULL); @@ -3579,7 +3635,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "simplify_ao_sss", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "simplify_aosss"); - RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AA and SSS quality factor"); + RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AO and SSS quality factor"); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); prop= RNA_def_property(srna, "use_simplify_triangulate", PROP_BOOLEAN, PROP_NONE); @@ -3715,7 +3771,8 @@ static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL); - RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); + RNA_def_property_ui_text(prop, "Active Keying Set Index", + "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); } @@ -3741,7 +3798,8 @@ static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL); - RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); + RNA_def_property_ui_text(prop, "Active Keying Set Index", + "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); } @@ -3769,7 +3827,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Struct definition */ srna= RNA_def_struct(brna, "Scene", "ID"); - RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings"); + RNA_def_struct_ui_text(srna, "Scene", + "Scene data block, consisting in objects and defining time and render related settings"); RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA); RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); @@ -3777,7 +3836,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll"); - RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene"); + RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene"); RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_view3d_update"); prop= RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE); @@ -3804,14 +3863,14 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_struct_type(prop, "ObjectBase"); RNA_def_property_ui_text(prop, "Bases", ""); - RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, "rna_Scene_object_bases_lookup_string"); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_Scene_object_bases_lookup_string", NULL); rna_def_scene_bases(brna, prop); prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Objects", ""); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_Scene_objects_get", NULL, NULL, NULL, NULL); rna_def_scene_objects(brna, prop); /* Layers */ @@ -3866,7 +3925,8 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE); RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set"); - RNA_def_property_ui_text(prop, "Use Preview Range", "Use an alternative start/end frame for UI playback, rather than the scene start/end frame"); + RNA_def_property_ui_text(prop, "Use Preview Range", + "Use an alternative start/end frame for UI playback, rather than the scene start/end frame"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL); RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0); @@ -3887,7 +3947,7 @@ void RNA_def_scene(BlenderRNA *brna) /* Stamp */ prop= RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata"); - RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping"); + RNA_def_property_ui_text(prop, "Stamp Note", "User defined note for the render stamping"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Animation Data (for Scene) */ @@ -3897,7 +3957,8 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */ - RNA_def_property_ui_text(prop, "NLA TweakMode", "Indicates whether there is any action referenced by NLA being edited. Strictly read-only"); + RNA_def_property_ui_text(prop, "NLA TweakMode", + "Whether there is any action referenced by NLA being edited (strictly read-only)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); /* Frame dropping flag for playback and sync enum */ @@ -3939,9 +4000,10 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_scene_keying_sets(brna, prop); prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "KeyingSet"); - RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)"); + RNA_def_property_ui_text(prop, "All Keying Sets", + "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); rna_def_scene_keying_sets_all(brna, prop); @@ -3994,7 +4056,8 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC); - RNA_def_property_ui_text(prop, "Audio Sync", "Play back and sync with audio clock, dropping frames if frame display is too slow"); + RNA_def_property_ui_text(prop, "Audio Sync", + "Play back and sync with audio clock, dropping frames if frame display is too slow"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 686c8dffcd1..840a24c23f4 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -148,9 +148,9 @@ static void rna_def_area(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL); RNA_def_property_struct_type(prop, "Space"); RNA_def_property_ui_text(prop, "Spaces", - "Spaces contained in this area, the first being the active space. " - "NOTE: Useful for example to restore a previously used 3d view space " - "in a certain area to get the old view orientation"); + "Spaces contained in this area, the first being the active space " + "(NOTE: Useful for example to restore a previously used 3D view space " + "in a certain area to get the old view orientation)"); rna_def_area_spaces(brna, prop); prop= RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 86682af189c..a75166c3e99 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -463,10 +463,8 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) { Sequence *seq= (Sequence*)(ptr->data); - char path[FILE_MAX]; - BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); - BLI_strncpy(value, path, strlen(path)+1); + BLI_join_dirfile(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name); } static int rna_Sequence_filepath_length(PointerRNA *ptr) @@ -475,7 +473,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) char path[FILE_MAX]; BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); - return strlen(path)+1; + return strlen(path); } static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) @@ -491,10 +489,8 @@ static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) { StripProxy *proxy= (StripProxy*)(ptr->data); - char path[FILE_MAX]; - BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file); - BLI_strncpy(value, path, strlen(path)+1); + BLI_join_dirfile(value, FILE_MAX, proxy->dir, proxy->file); } static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) @@ -503,7 +499,7 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) char path[FILE_MAX]; BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file); - return strlen(path)+1; + return strlen(path); } static void rna_Sequence_volume_set(PointerRNA *ptr, float value) @@ -563,7 +559,8 @@ static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *p { Editing *ed= seq_give_editing(scene, FALSE); - free_imbuf_seq(scene, &ed->seqbase, FALSE, TRUE); + if(ed) + free_imbuf_seq(scene, &ed->seqbase, FALSE, TRUE); } static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) @@ -824,16 +821,14 @@ static void rna_def_strip_proxy(BlenderRNA *brna) PropertyRNA *prop; static const EnumPropertyItem seq_tc_items[]= { - {SEQ_PROXY_TC_NONE, "NONE", 0, "No TC in use", ""}, + {SEQ_PROXY_TC_NONE, "NONE", 0, "No TC in use", ""}, {SEQ_PROXY_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", - "use images in the order as they are recorded"}, - {SEQ_PROXY_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", - "use global timestamp written by recording device"}, - {SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", - 0, "Free Run (rec date)", - "interpolate a global timestamp using the " - "record date and time written by recording " - "device"}, + "Use images in the order as they are recorded"}, + {SEQ_PROXY_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", + "Use global timestamp written by recording device"}, + {SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)", + "Interpolate a global timestamp using the " + "record date and time written by recording device"}, {0, NULL, 0, NULL, NULL}}; srna = RNA_def_struct(brna, "SequenceProxy", NULL); @@ -1179,13 +1174,13 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL); RNA_def_property_struct_type(prop, "Sequence"); RNA_def_property_ui_text(prop, "Sequences", ""); - RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin", "rna_SequenceEditor_sequences_all_next", 0, 0, 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin", "rna_SequenceEditor_sequences_all_next", NULL, NULL, NULL, NULL, NULL, NULL); prop= RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL); RNA_def_property_struct_type(prop, "Sequence"); RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip"); - RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEditor_meta_stack_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get", NULL, NULL, NULL, NULL); prop= RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act_seq"); @@ -1355,7 +1350,7 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL); RNA_def_property_struct_type(prop, "SequenceElement"); RNA_def_property_ui_text(prop, "Elements", ""); - RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", NULL, NULL, NULL); rna_def_filter_video(srna); rna_def_proxy(srna); @@ -1421,7 +1416,7 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "streamindex", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "streamindex"); RNA_def_property_range(prop, 0, 20); RNA_def_property_ui_text(prop, "Streamindex", "For files with several movie streams, use the stream with the given index"); @@ -1431,7 +1426,7 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL); RNA_def_property_struct_type(prop, "SequenceElement"); RNA_def_property_ui_text(prop, "Elements", ""); - RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", 0, 0); + RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", NULL, NULL, NULL); prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_ui_text(prop, "File", ""); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 8ea00530c2f..217d68860f2 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -255,7 +255,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "smooth_emitter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGH_SMOOTH); - RNA_def_property_ui_text(prop, "Smooth Emitter", "Smoothens emitted smoke to avoid blockiness"); + RNA_def_property_ui_text(prop, "Smooth Emitter", "Smoothen emitted smoke to avoid blockiness"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE); @@ -305,11 +305,11 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW); - RNA_def_property_ui_text(prop, "Outflow", "Deletes smoke from simulation"); + RNA_def_property_ui_text(prop, "Outflow", "Delete smoke from simulation"); prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE); - RNA_def_property_ui_text(prop, "Absolute Density", "Only allows given density value in emitter area"); + RNA_def_property_ui_text(prop, "Absolute Density", "Only allow given density value in emitter area"); prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index a6c1f400ade..a656e6d56df 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -94,7 +94,7 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM"); RNA_def_property_update(prop, 0, "rna_Sound_caching_update"); - prop= RNA_def_property(srna, "mono", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO); RNA_def_property_ui_text(prop, "Mono", "If the file contains multiple audio channels they are rendered to a single one"); RNA_def_property_update(prop, 0, "rna_Sound_update"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 36c45cfa59e..8afcd61b9c8 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -78,14 +78,16 @@ static EnumPropertyItem draw_channels_items[] = { {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, - {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer", "Draw Z-buffer associated with image (mapped from camera clip start to end)"}, + {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer", + "Draw Z-buffer associated with image (mapped from camera clip start to end)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem transform_orientation_items[] = { {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, {V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"}, - {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"}, + {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", + "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"}, {V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"}, {V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"}, {0, NULL, 0, NULL, NULL}}; @@ -219,7 +221,8 @@ static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr) if (v3d->twmode < V3D_MANIP_CUSTOM) return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, NULL); else - return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM)); + return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, + BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM)); } EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) @@ -472,7 +475,8 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value) ED_space_image_set(NULL, sima, sc->scene, sc->scene->obedit, (Image*)value.data); } -static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { SpaceImage *sima= (SpaceImage*)ptr->data; EnumPropertyItem *item= NULL; @@ -726,14 +730,16 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA valu if (act->idroot == ID_OB) saction->action = act; else - printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n", act->id.name+2); + printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n", + act->id.name+2); } else if (saction->mode == SACTCONT_SHAPEKEY) { /* as the name says, "shapekey-level" only... */ if (act->idroot == ID_KE) saction->action = act; else - printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n", act->id.name+2); + printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n", + act->id.name+2); } else { printf("ACK: who's trying to set an action while not in a mode displaying a single Action only?\n"); @@ -861,7 +867,8 @@ static void rna_SpaceNodeEditor_node_tree_update(Main *bmain, Scene *scene, Poin ED_node_tree_update(snode, scene); } -static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *free) { Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); @@ -940,8 +947,10 @@ static void rna_def_space_image_uv(BlenderRNA *brna) static EnumPropertyItem sticky_mode_items[] = { {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"}, - {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", "Select UVs that are at the same location and share a mesh vertex"}, - {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex", "Select UVs that share mesh vertex, irrespective if they are in the same location"}, + {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", + "Select UVs that are at the same location and share a mesh vertex"}, + {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex", + "Select UVs that share mesh vertex, irrespective if they are in the same location"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem dt_uv_items[] = { @@ -971,7 +980,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "sticky"); RNA_def_property_enum_items(prop, sticky_mode_items); - RNA_def_property_ui_text(prop, "Sticky Selection Mode", "Automatically select also UVs sharing the same vertex as the ones being selected"); + RNA_def_property_ui_text(prop, "Sticky Selection Mode", + "Automatically select also UVs sharing the same vertex as the ones being selected"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); /* drawing */ @@ -988,7 +998,9 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH); - RNA_def_property_ui_text(prop, "Draw Stretch", "Draw faces colored according to the difference in shape between UVs and their 3D coordinates (blue for low distortion, red for high distortion)"); + RNA_def_property_ui_text(prop, "Draw Stretch", + "Draw faces colored according to the difference in shape between UVs and " + "their 3D coordinates (blue for low distortion, red for high distortion)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); prop= RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE); @@ -1019,7 +1031,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(prop, 2); - RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get", "rna_SpaceImageEditor_cursor_location_set", NULL); + RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get", + "rna_SpaceImageEditor_cursor_location_set", NULL); RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); @@ -1037,7 +1050,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) prop= RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP); - RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices"); + RNA_def_property_ui_text(prop, "Live Unwrap", + "Continuously unwrap the selected UV island while transforming pinned vertices"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE); @@ -1140,12 +1154,12 @@ static void rna_def_background_image(BlenderRNA *brna) prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xof"); - RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the world origin"); + RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the world origin"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yof"); - RNA_def_property_ui_text(prop, "Y Offset", "Offsets image vertically from the world origin"); + RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); @@ -1181,7 +1195,8 @@ static void rna_def_space_view3d(BlenderRNA *brna) const int matrix_dimsize[]= {4, 4}; static EnumPropertyItem pivot_items[] = { - {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, + {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", + "Pivot around bounding box center of selected object(s)"}, {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", "Pivot around each object's own origin"}, {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", "Pivot around the median point of selected objects"}, @@ -1257,19 +1272,19 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "grid"); - RNA_def_property_ui_text(prop, "Grid Scale", "The distance between 3D View grid lines"); + RNA_def_property_ui_text(prop, "Grid Scale", "Distance between 3D View grid lines"); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gridlines"); - RNA_def_property_ui_text(prop, "Grid Lines", "The number of grid lines to display in perspective view"); + RNA_def_property_ui_text(prop, "Grid Lines", "Number of grid lines to display in perspective view"); RNA_def_property_range(prop, 0, 1024); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gridsubdiv"); - RNA_def_property_ui_text(prop, "Grid Subdivisions", "The number of subdivisions between grid lines"); + RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions between grid lines"); RNA_def_property_range(prop, 1, 1024); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); @@ -1295,12 +1310,14 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE); - RNA_def_property_ui_text(prop, "Outline Selected", "Show an outline highlight around selected objects in non-wireframe views"); + RNA_def_property_ui_text(prop, "Outline Selected", + "Show an outline highlight around selected objects in non-wireframe views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "show_all_objects_origin", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS); - RNA_def_property_ui_text(prop, "All Object Origins", "Show the object origin center dot for all (selected and unselected) objects"); + RNA_def_property_ui_text(prop, "All Object Origins", + "Show the object origin center dot for all (selected and unselected) objects"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); prop= RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE); @@ -1348,7 +1365,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ALIGN); - RNA_def_property_ui_text(prop, "Align", "Manipulate object centers only"); + RNA_def_property_ui_text(prop, "Align", "Manipulate center points (object and pose mode only)"); RNA_def_property_ui_icon(prop, ICON_ALIGN, 0); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update"); @@ -1386,12 +1403,13 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "TransformOrientation"); RNA_def_property_pointer_funcs(prop, "rna_CurrentOrientation_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current Transformation orientation"); + RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current transformation orientation"); prop= RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1); RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set"); - RNA_def_property_ui_text(prop, "Lock Camera and Layers", "Use the scene's active camera and layers in this view, rather than local layers"); + RNA_def_property_ui_text(prop, "Lock Camera and Layers", + "Use the scene's active camera and layers in this view, rather than local layers"); RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); @@ -1651,7 +1669,9 @@ static void rna_def_space_image(BlenderRNA *brna) /* update */ prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "lock", 0); - RNA_def_property_ui_text(prop, "Update Automatically", "Update other affected window spaces automatically to reflect changes during interactive operations such as transform"); + RNA_def_property_ui_text(prop, "Update Automatically", + "Update other affected window spaces automatically to reflect changes " + "during interactive operations such as transform"); /* state */ prop= RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE); @@ -1708,14 +1728,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop= RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "view"); RNA_def_property_enum_items(prop, view_type_items); - RNA_def_property_ui_text(prop, "View Type", "The type of the Sequencer view (sequencer, preview or both)"); + RNA_def_property_ui_text(prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)"); RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update"); /* display type, fairly important */ prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mainb"); RNA_def_property_enum_items(prop, display_mode_items); - RNA_def_property_ui_text(prop, "Display Mode", "The view mode to use for displaying sequencer output"); + RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); /* flag's */ @@ -1731,7 +1751,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS); - RNA_def_property_ui_text(prop, "Transform Markers", "Transform markers as well as strips"); + RNA_def_property_ui_text(prop, "Sync Markers", "Transform markers as well as strips"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); prop= RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE); @@ -1746,7 +1766,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL); - RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay"); + RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); /* grease pencil */ @@ -1758,7 +1778,8 @@ static void rna_def_space_sequencer(BlenderRNA *brna) prop= RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "chanshown"); - RNA_def_property_ui_text(prop, "Display Channel", "The channel number shown in the image preview. 0 is the result of all strips combined"); + RNA_def_property_ui_text(prop, "Display Channel", + "The channel number shown in the image preview. 0 is the result of all strips combined"); RNA_def_property_range(prop, -5, MAXSEQ); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); @@ -1778,12 +1799,12 @@ static void rna_def_space_sequencer(BlenderRNA *brna) /* not sure we need rna access to these but adding anyway */ prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xof"); - RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the view center"); + RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the view center"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yof"); - RNA_def_property_ui_text(prop, "Y Offset", "Offsets image horizontally from the view center"); + RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the view center"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE); @@ -1945,7 +1966,9 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) prop= RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW); - RNA_def_property_ui_text(prop, "Show Pose Markers", "Show markers belonging to the active action instead of Scene markers (Action and Shape Key Editors only)"); + RNA_def_property_ui_text(prop, "Show Pose Markers", + "Show markers belonging to the active action instead of Scene markers " + "(Action and Shape Key Editors only)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL); /* editing */ @@ -1956,7 +1979,8 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOREALTIMEUPDATES); - RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming keyframes, changes to the animation data are flushed to other views"); + RNA_def_property_ui_text(prop, "Realtime Updates", + "When transforming keyframes, changes to the animation data are flushed to other views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL); prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE); @@ -2032,7 +2056,8 @@ static void rna_def_space_graph(BlenderRNA *brna) prop= RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY); - RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes", "Only keyframes of selected F-Curves are visible and editable"); + RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes", + "Only keyframes of selected F-Curves are visible and editable"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); prop= RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE); @@ -2042,7 +2067,8 @@ static void rna_def_space_graph(BlenderRNA *brna) prop= RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF); - RNA_def_property_ui_text(prop, "Use High Quality Drawing", "Draw F-Curves using Anti-Aliasing and other fancy effects. Disable for better performance"); + RNA_def_property_ui_text(prop, "Use High Quality Drawing", + "Draw F-Curves using Anti-Aliasing and other fancy effects (disable for better performance)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); /* editing */ @@ -2053,7 +2079,8 @@ static void rna_def_space_graph(BlenderRNA *brna) prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOREALTIMEUPDATES); - RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming keyframes, changes to the animation data are flushed to other views"); + RNA_def_property_ui_text(prop, "Realtime Updates", + "When transforming keyframes, changes to the animation data are flushed to other views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); /* cursor */ @@ -2117,13 +2144,14 @@ static void rna_def_space_nla(BlenderRNA *brna) prop= RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES); - RNA_def_property_ui_text(prop, "Show Control Curves", "Show influence curves on strips"); + RNA_def_property_ui_text(prop, "Show Control F-Curves", "Show influence F-Curves on strips"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL); /* editing */ prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES); - RNA_def_property_ui_text(prop, "Realtime Updates", "When transforming strips, changes to the animation data are flushed to other views"); + RNA_def_property_ui_text(prop, "Realtime Updates", + "When transforming strips, changes to the animation data are flushed to other views"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL); /* dopesheet */ @@ -2152,7 +2180,7 @@ static void rna_def_space_time(BlenderRNA *brna) /* view settings */ prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL); - RNA_def_property_ui_text(prop, "Only Selected Channels", "Show keyframes for active Object and/or its selected bones only"); + RNA_def_property_ui_text(prop, "Only Selected Channels", "Show keyframes for active Object and/or its selected bones only"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL); prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE); @@ -2444,7 +2472,8 @@ static void rna_def_space_node(BlenderRNA *brna) static EnumPropertyItem backdrop_channels_items[] = { {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, - {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, + {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", + "Draw image with RGB colors and alpha transparency"}, {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, {0, NULL, 0, NULL, NULL}}; @@ -2487,7 +2516,7 @@ static void rna_def_space_node(BlenderRNA *brna) prop= RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_AUTO_RENDER); - RNA_def_property_ui_text(prop, "Auto Render", "Re-render and composite changed layer on 3D edits"); + RNA_def_property_ui_text(prop, "Auto Render", "Re-render and composite changed layers on 3D edits"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL); prop= RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 6a1e93fce41..4e23fb6b095 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -69,7 +69,7 @@ static void rna_Text_filename_set(PointerRNA *ptr, const char *value) if(text->name) MEM_freeN(text->name); - if(strlen(value)) + if(value[0]) text->name= BLI_strdup(value); else text->name= NULL; diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index e2beabf789d..b5e8acb76e5 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -57,20 +57,23 @@ EnumPropertyItem texture_filter_items[] = { EnumPropertyItem texture_type_items[] = { {0, "NONE", 0, "None", ""}, - {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - Creates a ramp texture"}, - {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", "Procedural - Creates a cloud-like fractal noise texture"}, - {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, "Distorted Noise", "Procedural - Noise texture distorted by two noise algorithms"}, - {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA, "Environment Map", "Creates a render of the environment mapped to a texture"}, - {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", "Allows for images or movies to be used as textures"}, + {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - create a ramp texture"}, + {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", "Procedural - create a cloud-like fractal noise texture"}, + {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, + "Distorted Noise", "Procedural - Noise texture distorted by two noise algorithms"}, + {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA, + "Environment Map", "Create a render of the environment mapped to a texture"}, + {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", "Allow for images or movies to be used as textures"}, {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", "Procedural - Color texture based on trigonometric functions"}, {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", "Procedural - Marble-like noise texture with wave generated bands"}, {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - Highly flexible fractal noise texture"}, - {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", "Procedural - Random noise, gives a different result every time, for every frame, for every pixel"}, + {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", + "Procedural - Random noise, gives a different result every time, for every frame, for every pixel"}, //{TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""}, /* Nothing yet */ {TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""}, - {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - Creates a fractal noise texture"}, - {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - Creates cell-like patterns based on Worley noise"}, - {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", "Creates a 3d texture based on volumetric data"}, + {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - Create a fractal noise texture"}, + {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - Create cell-like patterns based on Worley noise"}, + {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", "Create a 3d texture based on volumetric data"}, {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - Wave generated bands or rings, with optional noise"}, {0, NULL, 0, NULL, NULL}}; @@ -493,25 +496,26 @@ static void rna_def_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "ofs"); RNA_def_property_ui_range(prop, -10, 10, 10, 2); - RNA_def_property_ui_text(prop, "Offset", "Fine tunes texture mapping X, Y and Z locations"); + RNA_def_property_ui_text(prop, "Offset", "Fine tune of the texture mapping X, Y and Z locations"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_ui_range(prop, -100, 100, 10, 2); - RNA_def_property_ui_text(prop, "Size", "Sets scaling for the texture's X, Y and Z sizes"); + RNA_def_property_ui_text(prop, "Size", "Set scaling for the texture's X, Y and Z sizes"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "r"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Color", "The default color for textures that don't return RGB or when RGB to intensity is enabled"); + RNA_def_property_ui_text(prop, "Color", + "Default color for textures that don't return RGB or when RGB to intensity is enabled"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "blendtype"); RNA_def_property_enum_items(prop, prop_blend_type_items); - RNA_def_property_ui_text(prop, "Blend Type", "The mode used to apply the texture"); + RNA_def_property_ui_text(prop, "Blend Type", "Mode used to apply the texture"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop= RNA_def_property(srna, "use_stencil", PROP_BOOLEAN, PROP_NONE); @@ -521,12 +525,12 @@ static void rna_def_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEGATIVE); - RNA_def_property_ui_text(prop, "Negate", "Inverts the values of the texture to reverse its effect"); + RNA_def_property_ui_text(prop, "Negate", "Invert the values of the texture to reverse its effect"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop= RNA_def_property(srna, "use_rgb_to_intensity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_RGBTOINT); - RNA_def_property_ui_text(prop, "RGB to Intensity", "Converts texture RGB values to intensity (gray) values"); + RNA_def_property_ui_text(prop, "RGB to Intensity", "Convert texture RGB values to intensity (gray) values"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop= RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE); @@ -555,7 +559,7 @@ static void rna_def_filter_common(StructRNA *srna) prop= RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP); - RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Uses Gauss filter to sample down MIP maps"); + RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Use Gauss filter to sample down MIP maps"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE); @@ -567,13 +571,15 @@ static void rna_def_filter_common(StructRNA *srna) prop= RNA_def_property(srna, "filter_probes", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "afmax"); RNA_def_property_range(prop, 1, 256); - RNA_def_property_ui_text(prop, "Filter Probes", "Maximum number of samples. Higher gives less blur at distant/oblique angles, but is also slower"); + RNA_def_property_ui_text(prop, "Filter Probes", + "Maximum number of samples. Higher gives less blur at distant/oblique angles, but is also slower"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "afmax"); RNA_def_property_range(prop, 1, 256); - RNA_def_property_ui_text(prop, "Filter Eccentricity", "Maximum eccentricity. Higher gives less blur at distant/oblique angles, but is also slower"); + RNA_def_property_ui_text(prop, "Filter Eccentricity", + "Maximum eccentricity. Higher gives less blur at distant/oblique angles, but is also slower"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE); @@ -585,7 +591,7 @@ static void rna_def_filter_common(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "filtersize"); RNA_def_property_range(prop, 0.1, 50.0); RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 0.2); - RNA_def_property_ui_text(prop, "Filter Size", "Multiplies the filter size used by MIP Map and Interpolation"); + RNA_def_property_ui_text(prop, "Filter Size", "Multiply the filter size used by MIP Map and Interpolation"); RNA_def_property_update(prop, 0, "rna_Texture_update"); } @@ -595,9 +601,9 @@ static void rna_def_environment_map(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_source_items[] = { - {ENV_STATIC, "STATIC", 0, "Static", "Calculates environment map only once"}, - {ENV_ANIM, "ANIMATED", 0, "Animated", "Calculates environment map at each rendering"}, - {ENV_LOAD, "IMAGE_FILE", 0, "Image File", "Loads a saved environment map image from disk"}, + {ENV_STATIC, "STATIC", 0, "Static", "Calculate environment map only once"}, + {ENV_ANIM, "ANIMATED", 0, "Animated", "Calculate environment map at each rendering"}, + {ENV_LOAD, "IMAGE_FILE", 0, "Image File", "Load a saved environment map image from disk"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_mapping_items[] = { @@ -662,7 +668,7 @@ static void rna_def_environment_map(BlenderRNA *brna) prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_range(prop, 0, 5); - RNA_def_property_ui_text(prop, "Depth", "Number of times a map will be rendered recursively (mirror effects.)"); + RNA_def_property_ui_text(prop, "Depth", "Number of times a map will be rendered recursively (mirror effects)"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, 0); @@ -926,13 +932,13 @@ static void rna_def_texture_blend(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_blend_progression[] = { - {TEX_LIN, "LINEAR", 0, "Linear", "Creates a linear progression"}, - {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Creates a quadratic progression"}, - {TEX_EASE, "EASING", 0, "Easing", "Creates a progression easing from one step to the next"}, - {TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Creates a diagonal progression"}, - {TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Creates a spherical progression"}, - {TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Creates a quadratic progression in the shape of a sphere"}, - {TEX_RAD, "RADIAL", 0, "Radial", "Creates a radial progression"}, + {TEX_LIN, "LINEAR", 0, "Linear", "Create a linear progression"}, + {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"}, + {TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"}, + {TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"}, + {TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Create a spherical progression"}, + {TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Create a quadratic progression in the shape of a sphere"}, + {TEX_RAD, "RADIAL", 0, "Radial", "Create a radial progression"}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem prop_flip_axis_items[]= { @@ -1021,11 +1027,12 @@ static void rna_def_texture_image(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_image_extension[] = { - {TEX_EXTEND, "EXTEND", 0, "Extend", "Extends by repeating edge pixels of the image"}, - {TEX_CLIP, "CLIP", 0, "Clip", "Clips to image size and sets exterior pixels as transparent"}, - {TEX_CLIPCUBE, "CLIP_CUBE", 0, "Clip Cube", "Clips to cubic-shaped area around the image and sets exterior pixels as transparent"}, - {TEX_REPEAT, "REPEAT", 0, "Repeat", "Causes the image to repeat horizontally and vertically"}, - {TEX_CHECKER, "CHECKER", 0, "Checker", "Causes the image to repeat in checker board pattern"}, + {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, + {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and sets exterior pixels as transparent"}, + {TEX_CLIPCUBE, "CLIP_CUBE", 0, "Clip Cube", + "Clip to cubic-shaped area around the image and sets exterior pixels as transparent"}, + {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"}, + {TEX_CHECKER, "CHECKER", 0, "Checker", "Cause the image to repeat in checker board pattern"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ImageTexture", "Texture"); @@ -1219,11 +1226,15 @@ static void rna_def_texture_musgrave(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_musgrave_type[] = { - {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Fractal noise algorithm. Multifractal: Uses Perlin noise as a basis"}, - {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", "Fractal noise algorithm. Ridged Multifractal: Uses Perlin noise with inflection as a basis"}, - {TEX_HYBRIDMF, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", "Fractal noise algorithm.Hybrid Multifractal: Uses Perlin noise as a basis, with extended controls"}, + {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", + "Fractal noise algorithm. Multifractal: Uses Perlin noise as a basis"}, + {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", + "Fractal noise algorithm. Ridged Multifractal: Uses Perlin noise with inflection as a basis"}, + {TEX_HYBRIDMF, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", + "Fractal noise algorithm.Hybrid Multifractal: Uses Perlin noise as a basis, with extended controls"}, {TEX_FBM, "FBM", 0, "fBM", "Fractal noise algorithm. Fractal Brownian Motion: Uses Brownian noise as a basis"}, - {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Fractal noise algorithm. Hetero Terrain: similar to multifractal"}, + {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", + "Fractal noise algorithm. Hetero Terrain: similar to multifractal"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MusgraveTexture", "Texture"); @@ -1298,13 +1309,28 @@ static void rna_def_texture_voronoi(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_distance_metric_items[] = { - {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "Algorithm used to calculate distance of sample points to feature points. Actual Distance: sqrt(x*x+y*y+z*z)"}, - {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "Algorithm used to calculate distance of sample points to feature points. Distance squared: (x*x+y*y+z*z)"}, - {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Algorithm used to calculate distance of sample points to feature points. Manhattan: The length of the distance in axial directions"}, - {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Algorithm used to calculate distance of sample points to feature points. Chebychev: The length of the longest Axial journey"}, - {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkovsky 1/2", "Algorithm used to calculate distance of sample points to feature points. Minovsky 1/2: Sets Minkovsky variable to 0.5"}, - {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkovsky 4", "Algorithm used to calculate distance of sample points to feature points. Minkovsky 4: Sets Minkovsky variable to 4"}, - {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky", "Algorithm used to calculate distance of sample points to feature points. Minkovsky: Uses the Minkowsky function to calculate distance. Exponent value determines the shape of the boundaries"}, + {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", + "Algorithm used to calculate distance of sample points to feature points; " + "Actual Distance: sqrt(x*x+y*y+z*z)"}, + {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", + "Algorithm used to calculate distance of sample points to feature points; " + "Distance squared: (x*x+y*y+z*z)"}, + {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan", + "Algorithm used to calculate distance of sample points to feature points; " + "Manhattan: The length of the distance in axial directions"}, + {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", + "Algorithm used to calculate distance of sample points to feature points; " + "Chebychev: The length of the longest Axial journey"}, + {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkovsky 1/2", + "Algorithm used to calculate distance of sample points to feature points; " + "Minovsky 1/2: Sets Minkovsky variable to 0.5"}, + {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkovsky 4", + "Algorithm used to calculate distance of sample points to feature points; " + "Minkovsky 4: Sets Minkovsky variable to 4"}, + {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky", + "Algorithm used to calculate distance of sample points to feature points; " + "Minkovsky: Uses the Minkowsky function to calculate distance " + "(exponent value determines the shape of the boundaries)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_coloring_items[] = { @@ -1312,7 +1338,8 @@ static void rna_def_texture_voronoi(BlenderRNA *brna) {TEX_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"}, {TEX_COL1, "POSITION", 0, "Position", "Color cells by position"}, {TEX_COL2, "POSITION_OUTLINE", 0, "Position and Outline", "Use position plus an outline based on F2-F.1"}, - {TEX_COL3, "POSITION_OUTLINE_INTENSITY", 0, "Position, Outline, and Intensity", "Multiply position and outline by intensity"}, + {TEX_COL3, "POSITION_OUTLINE_INTENSITY", 0, "Position, Outline, and Intensity", + "Multiply position and outline by intensity"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "VoronoiTexture", "Texture"); @@ -1458,14 +1485,16 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) static EnumPropertyItem color_source_items[] = { {TEX_PD_COLOR_CONSTANT, "CONSTANT", 0, "Constant", ""}, {TEX_PD_COLOR_PARTAGE, "PARTICLE_AGE", 0, "Particle Age", "Lifetime mapped as 0.0 - 1.0 intensity"}, - {TEX_PD_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"}, + {TEX_PD_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", + "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"}, {TEX_PD_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "XYZ velocity mapped to RGB colors"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem turbulence_influence_items[] = { {TEX_PD_NOISE_STATIC, "STATIC", 0, "Static", "Noise patterns will remain unchanged, faster and suitable for stills"}, {TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "Turbulent noise driven by particle velocity"}, - {TEX_PD_NOISE_AGE, "PARTICLE_AGE", 0, "Particle Age", "Turbulent noise driven by the particle's age between birth and death"}, + {TEX_PD_NOISE_AGE, "PARTICLE_AGE", 0, "Particle Age", + "Turbulent noise driven by the particle's age between birth and death"}, {TEX_PD_NOISE_TIME, "GLOBAL_TIME", 0, "Global Time", "Turbulent noise driven by the global current frame"}, {0, NULL, 0, NULL, NULL}}; @@ -1760,17 +1789,17 @@ static void rna_def_texture(BlenderRNA *brna) prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bright"); RNA_def_property_range(prop, 0, 2); - RNA_def_property_ui_text(prop, "Brightness", "Adjusts the brightness of the texture"); + RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 5); - RNA_def_property_ui_text(prop, "Contrast", "Adjusts the contrast of the texture"); + RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0, 2); - RNA_def_property_ui_text(prop, "Saturation", "Adjusts the saturation of colors in the texture"); + RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); /* RGB Factor */ diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 587e56443ff..2c2bc4704bf 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -661,7 +661,7 @@ static void rna_def_panel(BlenderRNA *brna) "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_PT_hello\""); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", @@ -719,7 +719,7 @@ static void rna_def_header(BlenderRNA *brna) prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "layout"); RNA_def_property_struct_type(prop, "UILayout"); - RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the header in the UI"); + RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI"); /* registration */ prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); @@ -727,7 +727,7 @@ static void rna_def_header(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); RNA_def_property_ui_text(prop, "ID Name", "If this is set, the header gets a custom ID, otherwise it takes the " - "name of the class used to define the panel. For example, if the " + "name of the class used to define the panel; for example, if the " "class name is \"OBJECT_HT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_HT_hello\""); @@ -781,11 +781,11 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); RNA_def_property_ui_text(prop, "ID Name", "If this is set, the menu gets a custom ID, otherwise it takes the " - "name of the class used to define the panel. For example, if the " + "name of the class used to define the menu (for example, if the " "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the " - "script, then bl_idname = \"OBJECT_MT_hello\""); + "script, then bl_idname = \"OBJECT_MT_hello\")"); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The menu label"); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 85ad6b231aa..9e9e64a480d 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -428,6 +428,10 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); + func= RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties"); + parm= RNA_def_pointer(func, "item", "KeyMapItem", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); + func= RNA_def_function(srna, "introspect", "uiLayoutIntrospect"); parm= RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 35c7b26b49a..35df17b57ea 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2013,10 +2013,16 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) static void rna_def_userdef_view(BlenderRNA *brna) { static EnumPropertyItem timecode_styles[] = { - {USER_TIMECODE_MINIMAL, "MINIMAL", 0, "Minimal Info", "Most compact representation. Uses '+' as separator for sub-second frame numbers, with left and right truncation of the timecode as necessary"}, - {USER_TIMECODE_SMPTE_FULL, "SMPTE", 0, "SMPTE (Full)", "Full SMPTE timecode. Format is HH:MM:SS:FF"}, - {USER_TIMECODE_SMPTE_MSF, "SMPTE_COMPACT", 0, "SMPTE (Compact)", "SMPTE timecode showing minutes, seconds, and frames only. Hours are also shown if necessary, but not by default"}, - {USER_TIMECODE_MILLISECONDS, "MILLISECONDS", 0, "Compact with Milliseconds", "Similar to SMPTE (Compact), except that instead of frames, milliseconds are shown instead"}, + {USER_TIMECODE_MINIMAL, "MINIMAL", 0, "Minimal Info", + "Most compact representation, uses '+' as separator for sub-second frame numbers, " + "with left and right truncation of the timecode as necessary"}, + {USER_TIMECODE_SMPTE_FULL, "SMPTE", 0, "SMPTE (Full)", "Full SMPTE timecode (format is HH:MM:SS:FF)"}, + {USER_TIMECODE_SMPTE_MSF, "SMPTE_COMPACT", 0, "SMPTE (Compact)", + "SMPTE timecode showing minutes, seconds, and frames only - " + "hours are also shown if necessary, but not by default"}, + {USER_TIMECODE_MILLISECONDS, "MILLISECONDS", 0, "Compact with Milliseconds", + "Similar to SMPTE (Compact), except that instead of frames, " + "milliseconds are shown instead"}, {USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds", "Direct conversion of frame numbers to seconds"}, {0, NULL, 0, NULL, NULL}}; @@ -2046,7 +2052,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop= RNA_def_property(srna, "use_global_scene", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SCENEGLOBAL); - RNA_def_property_ui_text(prop, "Global Scene", "Forces the current Scene to be displayed in all Screens"); + RNA_def_property_ui_text(prop, "Global Scene", "Force the current Scene to be displayed in all Screens"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "show_large_cursors", PROP_BOOLEAN, PROP_NONE); @@ -2065,34 +2071,40 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop= RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS); - RNA_def_property_ui_text(prop, "Show Playback FPS", "Show the frames per second screen refresh rate, while animation is played back"); + RNA_def_property_ui_text(prop, "Show Playback FPS", + "Show the frames per second screen refresh rate, while animation is played back"); RNA_def_property_update(prop, 0, "rna_userdef_update"); /* menus */ prop= RNA_def_property(srna, "use_mouse_over_open", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MENUOPENAUTO); - RNA_def_property_ui_text(prop, "Open On Mouse Over", "Open menu buttons and pulldowns automatically when the mouse is hovering"); + RNA_def_property_ui_text(prop, "Open On Mouse Over", + "Open menu buttons and pulldowns automatically when the mouse is hovering"); prop= RNA_def_property(srna, "open_toplevel_delay", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "menuthreshold1"); RNA_def_property_range(prop, 1, 40); - RNA_def_property_ui_text(prop, "Top Level Menu Open Delay", "Time delay in 1/10 seconds before automatically opening top level menus"); + RNA_def_property_ui_text(prop, "Top Level Menu Open Delay", + "Time delay in 1/10 seconds before automatically opening top level menus"); prop= RNA_def_property(srna, "open_sublevel_delay", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "menuthreshold2"); RNA_def_property_range(prop, 1, 40); - RNA_def_property_ui_text(prop, "Sub Level Menu Open Delay", "Time delay in 1/10 seconds before automatically opening sub level menus"); + RNA_def_property_ui_text(prop, "Sub Level Menu Open Delay", + "Time delay in 1/10 seconds before automatically opening sub level menus"); /* Toolbox click-hold delay */ prop= RNA_def_property(srna, "open_left_mouse_delay", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tb_leftmouse"); RNA_def_property_range(prop, 1, 40); - RNA_def_property_ui_text(prop, "Hold LMB Open Toolbox Delay", "Time in 1/10 seconds to hold the Left Mouse Button before opening the toolbox"); + RNA_def_property_ui_text(prop, "Hold LMB Open Toolbox Delay", + "Time in 1/10 seconds to hold the Left Mouse Button before opening the toolbox"); prop= RNA_def_property(srna, "open_right_mouse_delay", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "tb_rightmouse"); RNA_def_property_range(prop, 1, 40); - RNA_def_property_ui_text(prop, "Hold RMB Open Toolbox Delay", "Time in 1/10 seconds to hold the Right Mouse Button before opening the toolbox"); + RNA_def_property_ui_text(prop, "Hold RMB Open Toolbox Delay", + "Time in 1/10 seconds to hold the Right Mouse Button before opening the toolbox"); prop= RNA_def_property(srna, "show_column_layout", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_PLAINMENUS); @@ -2100,7 +2112,8 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop= RNA_def_property(srna, "use_directional_menus", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER); - RNA_def_property_ui_text(prop, "Contents Follow Opening Direction", "Otherwise menus, etc will always be top to bottom, left to right, no matter opening direction"); + RNA_def_property_ui_text(prop, "Contents Follow Opening Direction", + "Otherwise menus, etc will always be top to bottom, left to right, no matter opening direction"); prop= RNA_def_property(srna, "use_global_pivot", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCKAROUND); @@ -2112,17 +2125,22 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop= RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT); - RNA_def_property_ui_text(prop, "Camera Parent Lock", "When the camera is locked to the view and in fly mode, transform the parent rather than the camera"); + RNA_def_property_ui_text(prop, "Camera Parent Lock", + "When the camera is locked to the view and in fly mode, " + "transform the parent rather than the camera"); /* view zoom */ prop= RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS); - RNA_def_property_ui_text(prop, "Zoom To Mouse Position", "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center"); + RNA_def_property_ui_text(prop, "Zoom To Mouse Position", + "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center"); /* view rotation */ prop= RNA_def_property(srna, "use_auto_perspective", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_AUTOPERSP); - RNA_def_property_ui_text(prop, "Auto Perspective", "Automatically switch between orthographic and perspective when changing from top/front/side views"); + RNA_def_property_ui_text(prop, "Auto Perspective", + "Automatically switch between orthographic and perspective when changing " + "from top/front/side views"); prop= RNA_def_property(srna, "use_rotate_around_active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_SELECTION); @@ -2131,30 +2149,30 @@ static void rna_def_userdef_view(BlenderRNA *brna) /* mini axis */ prop= RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_ROTVIEWICON); - RNA_def_property_ui_text(prop, "Show Mini Axis", "Show a small rotating 3D axis in the bottom left corner of the 3D View"); + RNA_def_property_ui_text(prop, "Show Mini Axes", "Show a small rotating 3D axes in the bottom left corner of the 3D View"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "mini_axis_size", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rvisize"); RNA_def_property_range(prop, 10, 64); - RNA_def_property_ui_text(prop, "Mini Axis Size", "The axis icon's size"); + RNA_def_property_ui_text(prop, "Mini Axes Size", "The axes icon's size"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "mini_axis_brightness", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rvibright"); RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "Mini Axis Brightness", "The brightness of the icon"); + RNA_def_property_ui_text(prop, "Mini Axes Brightness", "Brightness of the icon"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "smooth_view", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "smooth_viewtx"); RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_text(prop, "Smooth View", "The time to animate the view in milliseconds, zero to disable"); + RNA_def_property_ui_text(prop, "Smooth View", "Time to animate the view in milliseconds, zero to disable"); prop= RNA_def_property(srna, "rotation_angle", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "pad_rot_angle"); RNA_def_property_range(prop, 0, 90); - RNA_def_property_ui_text(prop, "Rotation Angle", "The rotation step for numerical pad keys (2 4 6 8)"); + RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation step for numerical pad keys (2 4 6 8)"); /* 3D transform widget */ prop= RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE); @@ -2192,7 +2210,8 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop= RNA_def_property(srna, "view2d_grid_spacing_min", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "v2d_min_gridsize"); RNA_def_property_range(prop, 1, 500); // XXX: perhaps the lower range should only go down to 5? - RNA_def_property_ui_text(prop, "2D View Minimum Grid Spacing", "Minimum number of pixels between each gridline in 2D Viewports"); + RNA_def_property_ui_text(prop, "2D View Minimum Grid Spacing", + "Minimum number of pixels between each gridline in 2D Viewports"); RNA_def_property_update(prop, 0, "rna_userdef_update"); // TODO: add a setter for this, so that we can bump up the minimum size as necessary... @@ -2200,7 +2219,8 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_enum_items(prop, timecode_styles); RNA_def_property_enum_sdna(prop, NULL, "timecode_style"); RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL); - RNA_def_property_ui_text(prop, "TimeCode Style", "Format of Time Codes displayed when not displaying timing in terms of frames"); + RNA_def_property_ui_text(prop, "TimeCode Style", + "Format of Time Codes displayed when not displaying timing in terms of frames"); RNA_def_property_update(prop, 0, "rna_userdef_update"); } @@ -2220,7 +2240,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem object_align_items[]= { - {0, "WORLD", 0, "World", "Align newly added objects to the world coordinates"}, + {0, "WORLD", 0, "World", "Align newly added objects to the world coordinate system"}, {USER_ADD_VIEWALIGNED, "VIEW", 0, "View", "Align newly added objects facing the active 3D View direction"}, {0, NULL, 0, NULL, NULL}}; @@ -2234,12 +2254,14 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "material_link", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, material_link_items); - RNA_def_property_ui_text(prop, "Material Link To", "Toggle whether the material is linked to object data or the object block"); + RNA_def_property_ui_text(prop, "Material Link To", + "Toggle whether the material is linked to object data or the object block"); prop= RNA_def_property(srna, "object_align", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, object_align_items); - RNA_def_property_ui_text(prop, "Align Object To", "When adding objects from a 3D View menu, either align them to that view's direction or the world coordinates"); + RNA_def_property_ui_text(prop, "Align Object To", + "When adding objects from a 3D View menu, either align them with that view or with the world"); prop= RNA_def_property(srna, "use_enter_edit_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_ADD_EDITMODE); @@ -2262,22 +2284,26 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "use_global_undo", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO); - RNA_def_property_ui_text(prop, "Global Undo", "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory"); + RNA_def_property_ui_text(prop, "Global Undo", + "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory"); /* auto keyframing */ prop= RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON); - RNA_def_property_ui_text(prop, "Auto Keying Enable", "Automatic keyframe insertion for Objects and Bones (default setting used for new Scenes)"); + RNA_def_property_ui_text(prop, "Auto Keying Enable", + "Automatic keyframe insertion for Objects and Bones (default setting used for new Scenes)"); RNA_def_property_ui_icon(prop, ICON_REC, 0); prop= RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, auto_key_modes); RNA_def_property_enum_funcs(prop, "rna_userdef_autokeymode_get", "rna_userdef_autokeymode_set", NULL); - RNA_def_property_ui_text(prop, "Auto Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones (default setting used for new Scenes)"); + RNA_def_property_ui_text(prop, "Auto Keying Mode", + "Mode of automatic keyframe insertion for Objects and Bones " + "(default setting used for new Scenes)"); prop= RNA_def_property(srna, "use_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTAVAIL); - RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available", "Automatic keyframe insertion in available curves"); + RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available", "Automatic keyframe insertion in available F-Curves"); /* keyframing settings */ prop= RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE); @@ -2290,12 +2316,16 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_XYZ2RGB); - RNA_def_property_ui_text(prop, "New F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"); + RNA_def_property_ui_text(prop, "New F-Curve Colors - XYZ to RGB", + "Color for newly added transformation F-Curves (Location, Rotation, Scale) " + "and also Color is based on the transform axis"); prop= RNA_def_property(srna, "keyframe_new_interpolation_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items); RNA_def_property_enum_sdna(prop, NULL, "ipo_new"); - RNA_def_property_ui_text(prop, "New Interpolation Type", "Interpolation mode used for first keyframe on newly added F-Curves. Subsequent keyframes take interpolation from preceeding keyframe"); + RNA_def_property_ui_text(prop, "New Interpolation Type", + "Interpolation mode used for first keyframe on newly added F-Curves " + "(subsequent keyframes take interpolation from preceeding keyframe)"); prop= RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, keyframe_handle_type_items); @@ -2316,7 +2346,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "grease_pencil_euclidean_distance", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gp_euclideandist"); RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_text(prop, "Grease Pencil Euclidean Distance", "Distance moved by mouse when drawing stroke (in pixels) to include"); + RNA_def_property_ui_text(prop, "Grease Pencil Euclidean Distance", + "Distance moved by mouse when drawing stroke (in pixels) to include"); prop= RNA_def_property(srna, "use_grease_pencil_smooth_stroke", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSMOOTH); @@ -2469,10 +2500,14 @@ static void rna_def_userdef_system(BlenderRNA *brna) static EnumPropertyItem draw_method_items[] = { {USER_DRAW_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically set based on graphics card and driver"}, - {USER_DRAW_TRIPLE, "TRIPLE_BUFFER", 0, "Triple Buffer", "Use a third buffer for minimal redraws at the cost of more memory"}, + {USER_DRAW_TRIPLE, "TRIPLE_BUFFER", 0, "Triple Buffer", + "Use a third buffer for minimal redraws at the cost of more memory"}, {USER_DRAW_OVERLAP, "OVERLAP", 0, "Overlap", "Redraw all overlapping regions, minimal memory usage but more redraws"}, - {USER_DRAW_OVERLAP_FLIP, "OVERLAP_FLIP", 0, "Overlap Flip", "Redraw all overlapping regions, minimal memory usage but more redraws (for graphics drivers that do flipping)"}, - {USER_DRAW_FULL, "FULL", 0, "Full", "Do a full redraw each time, slow, only use for reference or when all else fails"}, + {USER_DRAW_OVERLAP_FLIP, "OVERLAP_FLIP", 0, "Overlap Flip", + "Redraw all overlapping regions, minimal memory usage but more redraws " + "(for graphics drivers that do flipping)"}, + {USER_DRAW_FULL, "FULL", 0, "Full", + "Do a full redraw each time, slow, only use for reference or when everything else fails"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem color_picker_types[] = { @@ -2546,7 +2581,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, language_items); - RNA_def_property_ui_text(prop, "Language", "Language use for translation"); + RNA_def_property_ui_text(prop, "Language", "Language used for translation"); RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update"); prop= RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE); @@ -2573,7 +2608,8 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "use_weight_color_range", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_CUSTOM_RANGE); - RNA_def_property_ui_text(prop, "Use Weight Color Range", "Enable color range used for weight visualization in weight painting mode"); + RNA_def_property_ui_text(prop, "Use Weight Color Range", + "Enable color range used for weight visualization in weight painting mode"); RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update"); prop= RNA_def_property(srna, "weight_color_range", PROP_POINTER, PROP_NONE); @@ -2590,16 +2626,20 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "use_preview_images", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ALLWINCODECS); - RNA_def_property_ui_text(prop, "Enable All Codecs", "Enables automatic saving of preview images in the .blend file (Windows only)"); + RNA_def_property_ui_text(prop, "Enable All Codecs", + "Allow user to choose any codec (Windows only, might generate instability)"); prop= RNA_def_property(srna, "use_scripts_auto_execute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_SCRIPT_AUTOEXEC_DISABLE); - RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)"); + RNA_def_property_ui_text(prop, "Auto Run Python Scripts", + "Allow any .blend file to run scripts automatically " + "(unsafe with blend files from an untrusted source)"); RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update"); prop= RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE); - RNA_def_property_ui_text(prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces for new and loaded text files"); + RNA_def_property_ui_text(prop, "Tabs as Spaces", + "Automatically convert all new tabs into spaces for new and loaded text files"); prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "prefetchframes"); @@ -2625,12 +2665,14 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "use_mipmaps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_MIPMAP); - RNA_def_property_ui_text(prop, "Mipmaps", "Scale textures for the 3D View (looks nicer but uses more memory and slows image reloading)"); + RNA_def_property_ui_text(prop, "Mipmaps", + "Scale textures for the 3D View (looks nicer but uses more memory and slows image reloading)"); RNA_def_property_update(prop, 0, "rna_userdef_mipmap_update"); prop= RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO); RNA_def_property_ui_text(prop, "VBOs", "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering"); + RNA_def_property_update(prop, NC_WINDOW, NULL); /* this isnt essential but nice to check if VBO draws any differently */ prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA); @@ -2640,7 +2682,8 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter"); RNA_def_property_enum_items(prop, anisotropic_items); RNA_def_property_enum_default(prop, 1); - RNA_def_property_ui_text(prop, "Anisotropic Filter", "The quality of the anisotropic filtering (values greater than 1.0 enable anisotropic filtering)"); + RNA_def_property_ui_text(prop, "Anisotropic Filter", + "Quality of the anisotropic filtering (values greater than 1.0 enable anisotropic filtering)"); RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update"); prop= RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE); @@ -2652,12 +2695,15 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_time_out", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "textimeout"); RNA_def_property_range(prop, 0, 3600); - RNA_def_property_ui_text(prop, "Texture Time Out", "Time since last access of a GL texture in seconds after which it is freed. (Set to 0 to keep textures allocated.)"); + RNA_def_property_ui_text(prop, "Texture Time Out", + "Time since last access of a GL texture in seconds after which it is freed " + "(set to 0 to keep textures allocated)"); prop= RNA_def_property(srna, "texture_collection_rate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "texcollectrate"); RNA_def_property_range(prop, 1, 3600); - RNA_def_property_ui_text(prop, "Texture Collection Rate", "Number of seconds between each run of the GL texture garbage collector"); + RNA_def_property_ui_text(prop, "Texture Collection Rate", + "Number of seconds between each run of the GL texture garbage collector"); prop= RNA_def_property(srna, "window_draw_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "wmdrawmethod"); @@ -2668,31 +2714,31 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "audio_mixing_buffer", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mixbufsize"); RNA_def_property_enum_items(prop, audio_mixing_samples_items); - RNA_def_property_ui_text(prop, "Audio Mixing Buffer", "Sets the number of samples used by the audio mixing buffer"); + RNA_def_property_ui_text(prop, "Audio Mixing Buffer", "Number of samples used by the audio mixing buffer"); RNA_def_property_update(prop, 0, "rna_UserDef_audio_update"); prop= RNA_def_property(srna, "audio_device", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "audiodevice"); RNA_def_property_enum_items(prop, audio_device_items); - RNA_def_property_ui_text(prop, "Audio Device", "Sets the audio output device"); + RNA_def_property_ui_text(prop, "Audio Device", "Audio output device"); RNA_def_property_update(prop, 0, "rna_UserDef_audio_update"); prop= RNA_def_property(srna, "audio_sample_rate", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "audiorate"); RNA_def_property_enum_items(prop, audio_rate_items); - RNA_def_property_ui_text(prop, "Audio Sample Rate", "Sets the audio sample rate"); + RNA_def_property_ui_text(prop, "Audio Sample Rate", "Audio sample rate"); RNA_def_property_update(prop, 0, "rna_UserDef_audio_update"); prop= RNA_def_property(srna, "audio_sample_format", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "audioformat"); RNA_def_property_enum_items(prop, audio_format_items); - RNA_def_property_ui_text(prop, "Audio Sample Format", "Sets the audio sample format"); + RNA_def_property_ui_text(prop, "Audio Sample Format", "Audio sample format"); RNA_def_property_update(prop, 0, "rna_UserDef_audio_update"); prop= RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "audiochannels"); RNA_def_property_enum_items(prop, audio_channel_items); - RNA_def_property_ui_text(prop, "Audio Channels", "Sets the audio channel count"); + RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count"); RNA_def_property_update(prop, 0, "rna_UserDef_audio_update"); prop= RNA_def_property(srna, "screencast_fps", PROP_INT, PROP_NONE); @@ -2713,11 +2759,11 @@ static void rna_def_userdef_system(BlenderRNA *brna) #if 0 prop= RNA_def_property(srna, "verse_master", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "versemaster"); - RNA_def_property_ui_text(prop, "Verse Master", "The Verse Master-server IP"); + RNA_def_property_ui_text(prop, "Verse Master", "Verse Master-server IP"); prop= RNA_def_property(srna, "verse_username", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "verseuser"); - RNA_def_property_ui_text(prop, "Verse Username", "The Verse user name"); + RNA_def_property_ui_text(prop, "Verse Username", "Verse user name"); #endif } @@ -2738,13 +2784,13 @@ static void rna_def_userdef_input(BlenderRNA *brna) static EnumPropertyItem view_zoom_styles[] = { {USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"}, - {USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zooms in and out based on vertical mouse movement"}, - {USER_ZOOM_SCALE, "SCALE", 0, "Scale", "Zooms in and out like scaling the view, mouse movements relative to center"}, + {USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zoom in and out based on vertical mouse movement"}, + {USER_ZOOM_SCALE, "SCALE", 0, "Scale", "Zoom in and out like scaling the view, mouse movements relative to center"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem view_zoom_axes[] = { - {0, "VERTICAL", 0, "Vertical", "Zooms in and out based on vertical mouse movement"}, - {USER_ZOOM_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zooms in and out based on horizontal mouse movement"}, + {0, "VERTICAL", 0, "Vertical", "Zoom in and out based on vertical mouse movement"}, + {USER_ZOOM_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zoom in and out based on horizontal mouse movement"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesInput", NULL); @@ -2756,7 +2802,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, select_mouse_items); RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_select_mouse_set", NULL); - RNA_def_property_ui_text(prop, "Select Mouse", "The mouse button used for selection"); + RNA_def_property_ui_text(prop, "Select Mouse", "Mouse button used for selection"); prop= RNA_def_property(srna, "view_zoom_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "viewzoom"); @@ -2779,7 +2825,8 @@ static void rna_def_userdef_input(BlenderRNA *brna) prop= RNA_def_property(srna, "use_mouse_continuous", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE); - RNA_def_property_ui_text(prop, "Continuous Grab", "Allow moving the mouse outside the view on some manipulations (transform, ui control drag)"); + RNA_def_property_ui_text(prop, "Continuous Grab", + "Allow moving the mouse outside the view on some manipulations (transform, ui control drag)"); /* tweak tablet & mouse preset */ prop= RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_NONE); @@ -2787,7 +2834,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_range(prop, 3, 40); RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens"); - /* 3D mouse settings */ + /* 3D mouse settings */ /* global options */ prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.25f, 4.0f); @@ -2856,15 +2903,16 @@ static void rna_def_userdef_input(BlenderRNA *brna) prop= RNA_def_property(srna, "mouse_double_click_time", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dbl_click_time"); RNA_def_property_range(prop, 1, 1000); - RNA_def_property_ui_text(prop, "Double Click Timeout", "The time (in ms) for a double click"); + RNA_def_property_ui_text(prop, "Double Click Timeout", "Time/delay (in ms) for a double click"); prop= RNA_def_property(srna, "use_mouse_emulate_3_button", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE); - RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse", "Emulates Middle Mouse with Alt+Left Mouse (doesn't work with Left Mouse Select option)"); + RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse", + "Emulate Middle Mouse with Alt+Left Mouse (doesn't work with Left Mouse Select option)"); prop= RNA_def_property(srna, "use_emulate_numpad", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD); - RNA_def_property_ui_text(prop, "Emulate Numpad", "Causes the 1 to 0 keys to act as the numpad (useful for laptops)"); + RNA_def_property_ui_text(prop, "Emulate Numpad", "Main 1 to 0 keys act as the numpad ones (useful for laptops)"); /* middle mouse button */ prop= RNA_def_property(srna, "use_mouse_mmb_paste", PROP_BOOLEAN, PROP_NONE); @@ -2878,7 +2926,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) prop= RNA_def_property(srna, "wheel_scroll_lines", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "wheellinescroll"); RNA_def_property_range(prop, 0, 32); - RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "The number of lines scrolled at a time with the mouse wheel"); + RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "Number of lines scrolled at a time with the mouse wheel"); prop= RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "keyconfigstr"); @@ -2907,7 +2955,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT); - RNA_def_property_ui_text(prop, "Hide Dot Files/Datablocks", "Hide files/datablocks that start with a dot(.*)"); + RNA_def_property_ui_text(prop, "Hide Dot Files/Datablocks", "Hide files/datablocks that start with a dot (.*)"); prop= RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS); @@ -2955,7 +3003,9 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "script_directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "pythondir"); - RNA_def_property_ui_text(prop, "Python Scripts Directory", "Alternate script path, matching the default layout with subdirs: startup, addons & modules (requires restart)"); + RNA_def_property_ui_text(prop, "Python Scripts Directory", + "Alternate script path, matching the default layout with subdirs: " + "startup, addons & modules (requires restart)"); /* TODO, editing should reset sys.path! */ prop= RNA_def_property(srna, "sound_directory", PROP_STRING, PROP_DIRPATH); @@ -2986,11 +3036,13 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "versions"); RNA_def_property_range(prop, 0, 32); - RNA_def_property_ui_text(prop, "Save Versions", "The number of old versions to maintain in the current directory, when manually saving"); + RNA_def_property_ui_text(prop, "Save Versions", + "The number of old versions to maintain in the current directory, when manually saving"); prop= RNA_def_property(srna, "use_auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE); - RNA_def_property_ui_text(prop, "Auto Save Temporary Files", "Automatic saving of temporary files in temp directory, uses process ID"); + RNA_def_property_ui_text(prop, "Auto Save Temporary Files", + "Automatic saving of temporary files in temp directory, uses process ID"); RNA_def_property_update(prop, 0, "rna_userdef_autosave_update"); prop= RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE); @@ -3016,7 +3068,7 @@ void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "Addons"); srna= RNA_def_struct(brna, "Addons", NULL); - RNA_def_struct_ui_text(srna, "User Add-Ons", "Collection of add-ons"); + RNA_def_struct_ui_text(srna, "User Addons", "Collection of addons"); func= RNA_def_function(srna, "new", "rna_userdef_addon_new"); RNA_def_function_flag(func, FUNC_NO_SELF); @@ -3041,7 +3093,7 @@ void RNA_def_userdef(BlenderRNA *brna) {USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""}, {USER_SECTION_EDIT, "EDITING", 0, "Editing", ""}, {USER_SECTION_INPUT, "INPUT", 0, "Input", ""}, - {USER_SECTION_ADDONS, "ADDONS", 0, "Add-Ons", ""}, + {USER_SECTION_ADDONS, "ADDONS", 0, "Addons", ""}, {USER_SECTION_THEME, "THEMES", 0, "Themes", ""}, {USER_SECTION_FILE, "FILES", 0, "File", ""}, {USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""}, diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c6805206051..e9df79acd4a 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -451,7 +451,7 @@ static PointerRNA rna_Operator_properties_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties); } -static PointerRNA rna_OperatorTypeMacro_properties_get(PointerRNA *ptr) +static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr) { wmOperatorTypeMacro *otmacro= (wmOperatorTypeMacro*)ptr->data; wmOperatorType *ot = WM_operatortype_find(otmacro->idname, TRUE); @@ -1188,7 +1188,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); RNA_def_struct_name_property(srna, prop); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); @@ -1277,8 +1277,8 @@ static void rna_def_operator_type_macro(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "OperatorTypeMacro", NULL); - RNA_def_struct_ui_text(srna, "OperatorTypeMacro", "Storage of a sub operator in a macro after it has been added"); + srna= RNA_def_struct(brna, "OperatorMacro", NULL); + RNA_def_struct_ui_text(srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added"); RNA_def_struct_sdna(srna, "wmOperatorTypeMacro"); // prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); @@ -1291,7 +1291,7 @@ static void rna_def_operator_type_macro(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "OperatorProperties"); RNA_def_property_ui_text(prop, "Properties", ""); - RNA_def_property_pointer_funcs(prop, "rna_OperatorTypeMacro_properties_get", NULL, NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_OperatorMacro_properties_get", NULL, NULL, NULL); } static void rna_def_operator_utils(BlenderRNA *brna) diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index fb4aa4ca4a5..7e06ef1d017 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -65,7 +65,6 @@ set(SRC intern/MOD_meshdeform.c intern/MOD_mirror.c intern/MOD_multires.c - intern/MOD_navmesh.c intern/MOD_none.c intern/MOD_particleinstance.c intern/MOD_particlesystem.c diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 0b46d950950..0ef85a49899 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -42,6 +42,7 @@ #include "DNA_mesh_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -70,7 +71,7 @@ static void copyData(ModifierData *md, ModifierData *target) tamd->object = amd->object; tamd->deformflag = amd->deformflag; tamd->multi = amd->multi; - strncpy(tamd->defgrp_name, amd->defgrp_name, 32); + BLI_strncpy(tamd->defgrp_name, amd->defgrp_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 277f404f64d..197e6a24342 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -72,7 +72,7 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->lim_flags = bmd->lim_flags; tbmd->e_flags = bmd->e_flags; tbmd->bevel_angle = bmd->bevel_angle; - strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); + BLI_strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 4061128b5ad..b0e001f0978 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_deform.h" @@ -77,7 +78,7 @@ static void copyData(ModifierData *md, ModifierData *target) tcmd->flag = cmd->flag; tcmd->type = cmd->type; tcmd->object = cmd->object; - strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); + BLI_strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); } static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index d928c239eac..b732158358d 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -41,6 +41,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -65,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target) tcmd->defaxis = cmd->defaxis; tcmd->object = cmd->object; - strncpy(tcmd->name, cmd->name, 32); + BLI_strncpy(tcmd->name, cmd->name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index fb7aeacecc8..b0d9892a8df 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -75,11 +76,11 @@ static void copyData(ModifierData *md, ModifierData *target) tdmd->texture = dmd->texture; tdmd->strength = dmd->strength; tdmd->direction = dmd->direction; - strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32); + BLI_strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32); tdmd->midlevel = dmd->midlevel; tdmd->texmapping = dmd->texmapping; tdmd->map_object = dmd->map_object; - strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); + BLI_strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 3d01661bc79..0f3822f8cb6 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -543,7 +543,8 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int } } -static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm){ +static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) +{ DerivedMesh *splitdm; MFace *mf=NULL,*df1=NULL; MFace *mface=dm->getFaceArray(dm); @@ -557,7 +558,9 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm){ int *vertpa = MEM_callocN(sizeof(int)*totvert,"explode_vertpa2"); int *facepa = emd->facepa; int *fs, totesplit=0,totfsplit=0,curdupface=0; - int i,j,v1,v2,v3,v4,esplit, v[4], uv[4]; + int i,j,v1,v2,v3,v4,esplit, + v[4] = {0, 0, 0, 0}, /* To quite gcc barking... */ + uv[4] = {0, 0, 0, 0}; /* To quite gcc barking... */ int numlayer; edgehash= BLI_edgehash_new(); diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 785abc7d4d1..ad97ee82ee2 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -41,6 +41,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_action.h" #include "BKE_cdderivedmesh.h" @@ -72,8 +73,8 @@ static void copyData(ModifierData *md, ModifierData *target) thmd->totindex = hmd->totindex; thmd->indexar = MEM_dupallocN(hmd->indexar); memcpy(thmd->parentinv, hmd->parentinv, sizeof(hmd->parentinv)); - strncpy(thmd->name, hmd->name, 32); - strncpy(thmd->subtarget, hmd->subtarget, 32); + BLI_strncpy(thmd->name, hmd->name, 32); + BLI_strncpy(thmd->subtarget, hmd->subtarget, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 31c17fb7376..4ff92e3c86d 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -40,6 +40,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -57,7 +58,7 @@ static void copyData(ModifierData *md, ModifierData *target) LatticeModifierData *tlmd = (LatticeModifierData*) target; tlmd->object = lmd->object; - strncpy(tlmd->name, lmd->name, 32); + BLI_strncpy(tlmd->name, lmd->name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_navmesh.c b/source/blender/modifiers/intern/MOD_navmesh.c deleted file mode 100644 index c259239a003..00000000000 --- a/source/blender/modifiers/intern/MOD_navmesh.c +++ /dev/null @@ -1,313 +0,0 @@ -/* -* $Id$ -* -* ***** BEGIN GPL LICENSE BLOCK ***** -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -* The Original Code is Copyright (C) 2005 by the Blender Foundation. -* All rights reserved. -* -* Contributor(s): -* -* ***** END GPL LICENSE BLOCK ***** -* -*/ - -/** \file blender/modifiers/intern/MOD_navmesh.c - * \ingroup modifiers - */ - - -#include <math.h> - -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" - -#ifdef WITH_GAMEENGINE -# include "recast-capi.h" -# include "BKE_navmesh_conversion.h" -# include "GL/glew.h" -# include "GPU_buffers.h" -# include "GPU_draw.h" -#endif - -#include "BLI_math.h" -#include "BLI_utildefines.h" - -#include "BKE_cdderivedmesh.h" -#include "BKE_mesh.h" -#include "BKE_modifier.h" -#include "BKE_particle.h" -#include "BKE_customdata.h" -#include "MEM_guardedalloc.h" - -BM_INLINE int bit(int a, int b) -{ - return (a & (1 << b)) >> b; -} - -BM_INLINE void intToCol(int i, float* col) -{ - int r = bit(i, 0) + bit(i, 3) * 2 + 1; - int g = bit(i, 1) + bit(i, 4) * 2 + 1; - int b = bit(i, 2) + bit(i, 5) * 2 + 1; - col[0] = 1 - r*63.0f/255.0f; - col[1] = 1 - g*63.0f/255.0f; - col[2] = 1 - b*63.0f/255.0f; -} - - -static void initData(ModifierData *UNUSED(md)) -{ - /* NavMeshModifierData *nmmd = (NavMeshModifierData*) md; */ /* UNUSED */ -} - -static void copyData(ModifierData *UNUSED(md), ModifierData *UNUSED(target)) -{ - /* NavMeshModifierData *nmmd = (NavMeshModifierData*) md; */ - /* NavMeshModifierData *tnmmd = (NavMeshModifierData*) target; */ - - //.todo - deep copy -} - -/* -static void (*drawFacesSolid_original)(DerivedMesh *dm, float (*partial_redraw_planes)[4], - int fast, int (*setMaterial)(int, void *attribs)) = NULL;*/ - -#ifdef WITH_GAMEENGINE - -static void drawNavMeshColored(DerivedMesh *dm) -{ - int a, glmode; - MVert *mvert = (MVert *)CustomData_get_layer(&dm->vertData, CD_MVERT); - MFace *mface = (MFace *)CustomData_get_layer(&dm->faceData, CD_MFACE); - int* polygonIdx = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST); - const float BLACK_COLOR[3] = {0.f, 0.f, 0.f}; - float col[3]; - - if (!polygonIdx) - return; - - /* - //UI_ThemeColor(TH_WIRE); - glDisable(GL_LIGHTING); - glLineWidth(2.0); - dm->drawEdges(dm, 0, 1); - glLineWidth(1.0); - glEnable(GL_LIGHTING);*/ - - glDisable(GL_LIGHTING); - if(GPU_buffer_legacy(dm) ) { - DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" ); - //glShadeModel(GL_SMOOTH); - glBegin(glmode = GL_QUADS); - for(a = 0; a < dm->numFaceData; a++, mface++) { - int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES; - int polygonIdx = *(int*)CustomData_get(&dm->faceData, a, CD_RECAST); - if (polygonIdx<=0) - memcpy(col, BLACK_COLOR, 3*sizeof(float)); - else - intToCol(polygonIdx, col); - - if(new_glmode != glmode) { - glEnd(); - glBegin(glmode = new_glmode); - } - glColor3fv(col); - glVertex3fv(mvert[mface->v1].co); - glVertex3fv(mvert[mface->v2].co); - glVertex3fv(mvert[mface->v3].co); - if(mface->v4) { - glVertex3fv(mvert[mface->v4].co); - } - } - glEnd(); - } - glEnable(GL_LIGHTING); -} - -static void navDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) -{ - (void) setDrawOptions; - - drawNavMeshColored(dm); -} - -static void navDM_drawFacesSolid(DerivedMesh *dm, - float (*partial_redraw_planes)[4], - int UNUSED(fast), int (*setMaterial)(int, void *attribs)) -{ - (void) partial_redraw_planes; - (void) setMaterial; - - //drawFacesSolid_original(dm, partial_redraw_planes, fast, setMaterial); - drawNavMeshColored(dm); -} -#endif /* WITH_GAMEENGINE */ - -static DerivedMesh *createNavMeshForVisualization(NavMeshModifierData *UNUSED(mmd), DerivedMesh *dm) -{ -#ifdef WITH_GAMEENGINE - DerivedMesh *result; - int maxFaces = dm->getNumFaces(dm); - int *recastData; - int vertsPerPoly=0, nverts=0, ndtris=0, npolys=0; - float* verts=NULL; - unsigned short *dtris=NULL, *dmeshes=NULL, *polys=NULL; - int *dtrisToPolysMap=NULL, *dtrisToTrisMap=NULL, *trisToFacesMap=NULL; - int res; - - result = CDDM_copy(dm); - if (!CustomData_has_layer(&result->faceData, CD_RECAST)) - { - int *sourceRecastData = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST); - CustomData_add_layer_named(&result->faceData, CD_RECAST, CD_DUPLICATE, - sourceRecastData, maxFaces, "recastData"); - } - recastData = (int*)CustomData_get_layer(&result->faceData, CD_RECAST); - result->drawFacesTex = navDM_drawFacesTex; - result->drawFacesSolid = navDM_drawFacesSolid; - - - //process mesh - res = buildNavMeshDataByDerivedMesh(dm, &vertsPerPoly, &nverts, &verts, &ndtris, &dtris, - &npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap, - &trisToFacesMap); - if (res) - { - size_t polyIdx; - - //invalidate concave polygon - for (polyIdx=0; polyIdx<(size_t)npolys; polyIdx++) - { - unsigned short* poly = &polys[polyIdx*2*vertsPerPoly]; - if (!polyIsConvex(poly, vertsPerPoly, verts)) - { - //set negative polygon idx to all faces - unsigned short *dmesh = &dmeshes[4*polyIdx]; - unsigned short tbase = dmesh[2]; - unsigned short tnum = dmesh[3]; - unsigned short ti; - - for (ti=0; ti<tnum; ti++) - { - unsigned short triidx = dtrisToTrisMap[tbase+ti]; - unsigned short faceidx = trisToFacesMap[triidx]; - if (recastData[faceidx]>0) - recastData[faceidx] = -recastData[faceidx]; - } - } - } - - } - else - { - printf("Error during creation polygon infos\n"); - } - - //clean up - if (verts!=NULL) - MEM_freeN(verts); - if (dtris!=NULL) - MEM_freeN(dtris); - if (dmeshes!=NULL) - MEM_freeN(dmeshes); - if (polys!=NULL) - MEM_freeN(polys); - if (dtrisToPolysMap!=NULL) - MEM_freeN(dtrisToPolysMap); - if (dtrisToTrisMap!=NULL) - MEM_freeN(dtrisToTrisMap); - if (trisToFacesMap!=NULL) - MEM_freeN(trisToFacesMap); - - return result; -#else // WITH_GAMEENGINE - return dm; -#endif // WITH_GAMEENGINE -} - -/* -static int isDisabled(ModifierData *md, int useRenderParams) -{ - NavMeshModifierData *amd = (NavMeshModifierData*) md; - return false; -}*/ - - - -static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *derivedData, - int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) -{ - DerivedMesh *result = NULL; - NavMeshModifierData *nmmd = (NavMeshModifierData*) md; - int hasRecastData = CustomData_has_layer(&derivedData->faceData, CD_RECAST)>0; - if (ob->body_type!=OB_BODY_TYPE_NAVMESH || !hasRecastData ) - { - //convert to nav mesh object: - //1)set physics type - ob->gameflag &= ~OB_COLLISION; - ob->gameflag |= OB_NAVMESH; - ob->body_type = OB_BODY_TYPE_NAVMESH; - //2)add and init recast data layer - if (!hasRecastData) - { - Mesh* obmesh = (Mesh *)ob->data; - if (obmesh) - { - int i; - int numFaces = obmesh->totface; - int* recastData; - CustomData_add_layer_named(&obmesh->fdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData"); - recastData = (int*)CustomData_get_layer(&obmesh->fdata, CD_RECAST); - for (i=0; i<numFaces; i++) - { - recastData[i] = i+1; - } - CustomData_add_layer_named(&derivedData->faceData, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData"); - } - } - } - - result = createNavMeshForVisualization(nmmd, derivedData); - - return result; -} - - -ModifierTypeInfo modifierType_NavMesh = { - /* name */ "NavMesh", - /* structName */ "NavMeshModifierData", - /* structSize */ sizeof(NavMeshModifierData), - /* type */ eModifierTypeType_Constructive, - /* flags */ (ModifierTypeFlag) (eModifierTypeFlag_AcceptsMesh - | eModifierTypeFlag_Single), - /* copyData */ copyData, - /* deformVerts */ 0, - /* deformMatrices */ 0, - /* deformVertsEM */ 0, - /* deformMatricesEM */ 0, - /* applyModifier */ applyModifier, - /* applyModifierEM */ 0, - /* initData */ initData, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, -}; diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 16898a80b53..5e13b8a6d3c 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" @@ -69,7 +70,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->fac = smd->fac; tsmd->repeat = smd->repeat; tsmd->flag = smd->flag; - strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); + BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); } static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index a2fe947a523..26e9d48cd0a 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -295,7 +295,6 @@ void modifier_type_init(ModifierTypeInfo *types[]) INIT_TYPE(Solidify); INIT_TYPE(Screw); INIT_TYPE(Warp); - INIT_TYPE(NavMesh); INIT_TYPE(WeightVGEdit); INIT_TYPE(WeightVGMix); INIT_TYPE(WeightVGProximity); diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 36d3dc88b56..a088ba80b3d 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -33,6 +33,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" @@ -73,13 +74,13 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->strength = wmd->strength; twmd->falloff_radius = wmd->falloff_radius; twmd->falloff_type = wmd->falloff_type; - strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); + BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); twmd->curfalloff = curvemapping_copy(wmd->curfalloff); /* map info */ twmd->texture = wmd->texture; twmd->map_object = wmd->map_object; - strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); + BLI_strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); twmd->texmapping= wmd->texmapping; } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 4b5769ff603..820c7e16f53 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -42,6 +42,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_DerivedMesh.h" @@ -98,7 +99,7 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->texture = wmd->texture; twmd->map_object = wmd->map_object; twmd->texmapping = wmd->texmapping; - strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); + BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); } static int dependsOnTime(ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 2c94c4d1505..dcdb6b4dde8 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -225,7 +225,8 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne } /* Adds the given vertex to the specified vertex group, with given weight. */ -static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) { +static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) +{ /* TODO, move into deform.c as a generic function. This assumes the vertex * groups have already been checked, so this has to remain low level. */ MDeformWeight *newdw; @@ -244,7 +245,8 @@ static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float we /* Removes the given vertex from the vertex group, specified either by its defgrp_idx, * or directly by its MDeformWeight pointer, if dw is not NULL. * WARNING: This function frees the given MDeformWeight, do not use it afterward! */ -static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) { +static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) +{ /* TODO, move this into deform.c as a generic function. */ MDeformWeight *newdw; int i; diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c index d5ae442c25f..ed85d1c2fb8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.c +++ b/source/blender/nodes/composite/nodes/node_composite_common.c @@ -174,7 +174,8 @@ static void group_move_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack } /* Free internal buffers */ -static void group_free_internal(bNodeTreeExec *gexec) { +static void group_free_internal(bNodeTreeExec *gexec) +{ bNodeStack *ns; int i; diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c index 43f78a90add..ddab415b3be 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c @@ -99,7 +99,7 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */; - if(rd->scemode & R_FULL_SAMPLE) + if((rd->scemode & R_FULL_SAMPLE) || node->custom2 == 0) do_idmask_fsa(stackbuf, cbuf, (float)node->custom1); else do_idmask(stackbuf, cbuf, (float)node->custom1); diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 6149947233e..c18a35fdd98 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -74,7 +74,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i ibuf= BKE_image_get_ibuf(ima, iuser); if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { - return NULL; + return NULL; } if (ibuf->rect_float == NULL) { diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 35f2dbf7b32..fa5a3c727c2 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -551,8 +551,8 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) } /* delete the group instance. this also removes old input links! */ - nodeFreeNode(ntree, gnode); - + nodeFreeNode(ntree, gnode); + /* free the group tree (takes care of user count) */ free_libblock(&G.main->nodetree, wgroup); @@ -567,7 +567,7 @@ bNodeSocket *node_group_add_socket(bNodeTree *ngroup, const char *name, int type bNodeSocketType *stype = ntreeGetSocketType(type); bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket"); - strncpy(gsock->name, name, sizeof(gsock->name)); + BLI_strncpy(gsock->name, name, sizeof(gsock->name)); gsock->type = type; /* group sockets are dynamically added */ gsock->flag |= SOCK_DYNAMIC; diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 8ca7eac40f1..fa8238badaa 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -42,7 +42,7 @@ if env['BF_BUILDINFO']: defs.append('BUILD_DATE') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361]) diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 2543d34f58c..e6883eb30af 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -269,7 +269,7 @@ static int idp_sequence_type(PyObject *seq) PyObject *item; int type= IDP_INT; - int i, len = PySequence_Size(seq); + Py_ssize_t i, len = PySequence_Size(seq); for (i=0; i < len; i++) { item = PySequence_GetItem(seq, i); if (PyFloat_Check(item)) { diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 44d42a479ec..35c211d5424 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -286,8 +286,8 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject Buffer *buffer; int dimensions[MAX_DIMENSIONS]; - int i, type; - int ndimensions = 0; + int type; + Py_ssize_t i, ndimensions = 0; if(kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 67ed90c79eb..d29bc798399 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -93,7 +93,7 @@ void bpy_import_main_set(struct Main *maggie) /* returns a dummy filename for a textblock so we can tell what file a text block comes from */ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text) { - BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : bpy_import_main->name, SEP, text->id.name+2); + BLI_snprintf(fn, fn_len, "%s%c%s", ID_BLEND_PATH(bpy_import_main, &text->id), SEP, text->id.name+2); } PyObject *bpy_text_import(Text *text) @@ -120,7 +120,7 @@ PyObject *bpy_text_import(Text *text) } len= strlen(text->id.name+2); - strncpy(modulename, text->id.name+2, len); + BLI_strncpy(modulename, text->id.name+2, len); modulename[len - 3]= '\0'; /* remove .py */ return PyImport_ExecCodeModule(modulename, text->compiled); } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index d5bd44fc288..bf14102bb0d 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -107,7 +107,8 @@ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObje /* for debugging */ -void PyC_ObSpit(const char *name, PyObject *var) { +void PyC_ObSpit(const char *name, PyObject *var) +{ fprintf(stderr, "<%s> : ", name); if (var==NULL) { fprintf(stderr, "<NIL>"); @@ -126,7 +127,8 @@ void PyC_ObSpit(const char *name, PyObject *var) { fprintf(stderr, "\n"); } -void PyC_LineSpit(void) { +void PyC_LineSpit(void) +{ const char *filename; int lineno; @@ -363,12 +365,15 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) * chars since blender doesnt limit this */ return result; } - else if(PyBytes_Check(py_str)) { - PyErr_Clear(); - return PyBytes_AS_STRING(py_str); - } else { - return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(py_str))); + PyErr_Clear(); + + if(PyBytes_Check(py_str)) { + return PyBytes_AS_STRING(py_str); + } + else { + return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(py_str))); + } } } diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 70129a25df6..3fe8aada3ae 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -97,7 +97,7 @@ if(WITH_AUDASPACE) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index b909a0d5f55..cd3d78410f2 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -40,6 +40,8 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg); static PyTypeObject BlenderAppCbType; static PyStructSequence_Field app_cb_info_fields[]= { + {(char *)"frame_change_pre", NULL}, + {(char *)"frame_change_post", NULL}, {(char *)"render_pre", NULL}, {(char *)"render_post", NULL}, {(char *)"render_stats", NULL}, diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index f3ef55d29c4..319790340ca 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -41,6 +41,9 @@ #include "bpy_driver.h" +extern void BPY_update_rna_module(void); + + /* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */ PyObject *bpy_pydriver_Dict= NULL; @@ -164,6 +167,10 @@ float BPY_driver_exec(ChannelDriver *driver) if(use_gil) gilstate= PyGILState_Ensure(); + /* needed since drivers are updated directly after undo where 'main' is + * re-allocated [#28807] */ + BPY_update_rna_module(); + /* init global dictionary for py-driver evaluation settings */ if (!bpy_pydriver_Dict) { if (bpy_pydriver_create_dict() != 0) { diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 7327679cc7e..dedc5df1f1c 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -408,12 +408,51 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value) return (PyObject *)pyrna; } +static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value) +{ + wmOperatorType *ot; + wmOperator *op; + PointerRNA ptr; + char *opname= _PyUnicode_AsString(value); + BPy_StructRNA *pyrna= NULL; + + if(opname==NULL) { + PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_instance() expects a string argument"); + return NULL; + } + ot= WM_operatortype_find(opname, TRUE); + if(ot==NULL) { + PyErr_Format(PyExc_KeyError, "_bpy.ops.get_instance(\"%s\") not found", opname); + return NULL; + } + +#ifdef PYRNA_FREE_SUPPORT + op= MEM_callocN(sizeof(wmOperator), __func__); +#else + op= PyMem_MALLOC(sizeof(wmOperator)); + memset(op, 0, sizeof(wmOperator)); +#endif + BLI_strncpy(op->idname, op->idname, sizeof(op->idname)); /* incase its needed */ + op->type= ot; + + RNA_pointer_create(NULL, &RNA_Operator, op, &ptr); + + pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr); +#ifdef PYRNA_FREE_SUPPORT + pyrna->freeptr= TRUE; +#endif + op->ptr= &pyrna->ptr; + + return (PyObject *)pyrna; +} + static struct PyMethodDef bpy_ops_methods[]= { {"poll", (PyCFunction) pyop_poll, METH_VARARGS, NULL}, {"call", (PyCFunction) pyop_call, METH_VARARGS, NULL}, {"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL}, {"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL}, - {"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL}, + {"get_rna", (PyCFunction) pyop_getrna, METH_O, NULL}, /* only for introspection, leaks memory */ + {"get_instance", (PyCFunction) pyop_getinstance, METH_O, NULL}, /* only for introspection, leaks memory */ {"macro_define", (PyCFunction) PYOP_wrap_macro_define, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index de29cb2aeac..b5ded8b3a65 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -125,7 +125,7 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args) otmacro= WM_operatortype_macro_define(ot, opname); - RNA_pointer_create(NULL, &RNA_OperatorTypeMacro, otmacro, &ptr_otmacro); + RNA_pointer_create(NULL, &RNA_OperatorMacro, otmacro, &ptr_otmacro); return pyrna_struct_CreatePyObject(&ptr_otmacro); } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index a3d5bc99ad8..5c668590dff 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -56,13 +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_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_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}}; @@ -72,7 +72,7 @@ static EnumPropertyItem property_subtype_string_items[]= { {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""}, {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""}, {PROP_FILENAME, "FILENAME", 0, "Filename", ""}, - {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, + {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, {PROP_NONE, "NONE", 0, "None", ""}, {0, NULL, 0, NULL, NULL}}; @@ -267,6 +267,18 @@ static int bpy_prop_callback_assign(struct PropertyRNA *prop, PyObject *update_c return 0; } +/* utility function we need for parsing int's in an if statement */ +static int py_long_as_int(PyObject *py_long, int *r_int) +{ + if(PyLong_CheckExact(py_long)) { + *r_int= (int)PyLong_AS_LONG(py_long); + return 0; + } + else { + return -1; + } +} + /* 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) \ @@ -914,6 +926,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i for(i=0; i<seq_len; i++) { EnumPropertyItem tmp= {0, "", 0, "", ""}; + Py_ssize_t item_size; Py_ssize_t id_str_size; Py_ssize_t name_str_size; Py_ssize_t desc_str_size; @@ -921,13 +934,17 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i item= PySequence_Fast_GET_ITEM(seq_fast, i); if( (PyTuple_CheckExact(item)) && - (PyTuple_GET_SIZE(item) == 3) && + (item_size= PyTuple_GET_SIZE(item)) && + (item_size == 3 || item_size == 4) && (tmp.identifier= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) && (tmp.name= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) && - (tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) + (tmp.description= _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) && + (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1) /* TODO, number isnt ensured to be unique from the script author */ ) { if(is_enum_flag) { - tmp.value= 1<<i; + if(item_size < 4) { + tmp.value= 1<<i; + } if(def && PySet_Contains(def, PyTuple_GET_ITEM(item, 0))) { *defvalue |= tmp.value; @@ -935,7 +952,9 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i } } else { - tmp.value= i; + if(item_size < 4) { + tmp.value= i; + } if(def && def_used == 0 && strcmp(def_cmp, tmp.identifier)==0) { *defvalue= tmp.value; @@ -950,7 +969,10 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i } else { MEM_freeN(items); - PyErr_SetString(PyExc_TypeError, "EnumProperty(...): expected an tuple containing (identifier, name description)"); + PyErr_SetString(PyExc_TypeError, + "EnumProperty(...): expected an tuple containing " + "(identifier, name description) and optionally a " + "unique number"); return NULL; } @@ -973,7 +995,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i PyErr_Format(PyExc_TypeError, "EnumProperty(..., default=\'%s\'): not found in enum members", - def); + def_cmp); return NULL; } } @@ -1081,8 +1103,9 @@ BPY_PROPDEF_DESC_DOC " :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" +" [(identifier, name, description, number), ...] where the identifier is used\n" " for python access and other values are used for the interface.\n" +" Note the item is optional.\n" " For dynamic values a callback can be passed which returns a list in\n" " the same format as the static list.\n" " This function must take 2 arguments (self, context)\n" diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 013eac7fd58..f5ecf91305d 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -73,7 +73,7 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include "UI_interface.h" /* bad level call into editors */ #endif @@ -84,6 +84,11 @@ static PyObject* pyrna_struct_Subtype(PointerRNA *ptr); static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self); +#define BPY_DOC_ID_PROP_TYPE_NOTE \ +" .. note:: Only :class:`bpy.types.ID`, :class:`bpy.types.Bone` and \n" \ +" :class:`bpy.types.PoseBone` classes support custom properties.\n" + + int pyrna_struct_validity_check(BPy_StructRNA *pysrna) { if(pysrna->ptr.type) @@ -370,7 +375,7 @@ static int mathutils_rna_generic_check(BaseMathObject *bmo) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); return self->prop ? 0 : -1; } @@ -379,7 +384,7 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); if(self->prop==NULL) return -1; @@ -401,7 +406,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype) BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; float min, max; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); if(self->prop==NULL) return -1; @@ -452,7 +457,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtyp { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); if(self->prop==NULL) return -1; @@ -465,7 +470,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); if(self->prop==NULL) return -1; @@ -509,7 +514,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); if(self->prop==NULL) return -1; @@ -522,7 +527,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); if(self->prop==NULL) return -1; @@ -863,7 +868,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) char type_fmt[64]= ""; int type; - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); type= RNA_property_type(self->prop); @@ -926,7 +931,7 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) PyObject *ret; const char *path; - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); if(id == NULL) return pyrna_prop_str(self); /* fallback */ @@ -1523,11 +1528,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { param= _PyUnicode_AsString(value); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(subtype == PROP_TRANSLATE) { param= UI_translate_do_iface(param); } -#endif // INTERNATIONAL +#endif // WITH_INTERNATIONAL } #else // USE_STRING_COERCE @@ -1718,7 +1723,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } case PROP_COLLECTION: { - int seq_len, i; + Py_ssize_t seq_len, i; PyObject *item; PointerRNA itemptr; ListBase *lb; @@ -1736,7 +1741,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } seq_len= PySequence_Size(value); - for(i=0; i<seq_len; i++) { + for(i=0; i < seq_len; i++) { item= PySequence_GetItem(value, i); if(item==NULL) { @@ -1805,7 +1810,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb static PyObject *pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int index) { - PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self) + PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self); return pyrna_py_from_array_index(self, &self->ptr, self->prop, index); } @@ -1884,7 +1889,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P //---------------sequence------------------------------------------- static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self) { - PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self) + PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self); if (RNA_property_array_dimension(&self->ptr, self->prop, NULL) > 1) return RNA_property_multi_array_length(&self->ptr, self->prop, self->arraydim); @@ -1894,7 +1899,7 @@ static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self) static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self) { - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); return RNA_property_collection_length(&self->ptr, self->prop); } @@ -1903,7 +1908,7 @@ static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self) * of 1000's of items in a linked list for eg. */ static int pyrna_prop_array_bool(BPy_PropertyRNA *self) { - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); return RNA_property_array_length(&self->ptr, self->prop) ? 1 : 0; } @@ -1914,7 +1919,7 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self) CollectionPropertyIterator iter; int test; - PYRNA_PROP_CHECK_INT(self) + PYRNA_PROP_CHECK_INT(self); RNA_property_collection_begin(&self->ptr, self->prop, &iter); test= iter.valid; @@ -1922,25 +1927,30 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self) return test; } + +#define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \ + /* notice getting the length of the collection is avoided unless negative \ + * index is used or to detect internal error with a valid index. \ + * This is done for faster lookups. */ \ + if(keynum < 0) { \ + keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \ + if(keynum_abs < 0) { \ + PyErr_Format(PyExc_IndexError, \ + "bpy_prop_collection[%d]: out of range.", keynum); \ + return ret_err; \ + } \ + } \ + + /* internal use only */ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum) { PointerRNA newptr; Py_ssize_t keynum_abs= keynum; - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); - /* notice getting the length of the collection is avoided unless negative index is used - * or to detect internal error with a valid index. - * This is done for faster lookups. */ - if(keynum < 0) { - keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); - - if(keynum_abs < 0) { - PyErr_Format(PyExc_IndexError, "bpy_prop_collection[%d]: out of range.", keynum); - return NULL; - } - } + PYRNA_PROP_COLLECTION_ABS_INDEX(NULL); if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum_abs, &newptr)) { return pyrna_struct_CreatePyObject(&newptr); @@ -1963,11 +1973,33 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s } } +/* values type must have been already checked */ +static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum, PyObject *value) +{ + Py_ssize_t keynum_abs= keynum; + const PointerRNA *ptr= (value == Py_None) ? (&PointerRNA_NULL) : &((BPy_StructRNA *)value)->ptr; + + PYRNA_PROP_CHECK_INT(self); + + PYRNA_PROP_COLLECTION_ABS_INDEX(-1); + + if(RNA_property_collection_assign_int(&self->ptr, self->prop, keynum_abs, ptr) == 0) { + + PyErr_Format(PyExc_IndexError, + "bpy_prop_collection[index] = value: " + "failed assignment (unknown reason)", keynum); + + return -1; + } + + return 0; +} + static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int keynum) { int len; - PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self) + PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self); len= pyrna_prop_array_length(self); @@ -1984,7 +2016,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons { PointerRNA newptr; - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); if(RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr)) return pyrna_struct_CreatePyObject(&newptr); @@ -2002,7 +2034,7 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py PyObject *list; PyObject *item; - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); list= PyList_New(0); @@ -2041,11 +2073,11 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po int count, totdim; PyObject *tuple; - PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self) + PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self); tuple= PyTuple_New(stop - start); - /* PYRNA_PROP_CHECK_OBJ(self) isn't needed, internal use only */ + /* PYRNA_PROP_CHECK_OBJ(self); isn't needed, internal use only */ totdim= RNA_property_array_dimension(ptr, prop, NULL); @@ -2116,7 +2148,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject *key) { - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); if (PyUnicode_Check(key)) { return pyrna_prop_collection_subscript_str(self, _PyUnicode_AsString(key)); @@ -2173,9 +2205,131 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject } } +/* generic check to see if a PyObject is compatible with a collection + * -1 on failier, 0 on success, sets the error */ +static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *value) +{ + StructRNA *prop_srna; + + if(value == Py_None) { + if (RNA_property_flag(self->prop) & PROP_NEVER_NULL) { + PyErr_Format(PyExc_TypeError, + "bpy_prop_collection[key] = value: invalid, " + "this collection doesnt support None assignment"); + return -1; + } + else { + return 0; /* None is OK */ + } + } + else if (BPy_StructRNA_Check(value) == 0) { + PyErr_Format(PyExc_TypeError, + "bpy_prop_collection[key] = value: invalid, " + "expected a StructRNA type or None, not a %.200s", + Py_TYPE(value)->tp_name); + return -1; + } + else if((prop_srna= RNA_property_pointer_type(&self->ptr, self->prop))) { + StructRNA *value_srna= ((BPy_StructRNA *)value)->ptr.type; + if (RNA_struct_is_a(value_srna, prop_srna) == 0) { + PyErr_Format(PyExc_TypeError, + "bpy_prop_collection[key] = value: invalid, " + "expected a '%.200s' type or None, not a '%.200s'", + RNA_struct_identifier(prop_srna), + RNA_struct_identifier(value_srna) + ); + return -1; + } + else { + return 0; /* OK, this is the correct type!*/ + } + } + + PyErr_Format(PyExc_TypeError, + "bpy_prop_collection[key] = value: internal error, " + "failed to get the collection type"); + return -1; +} + +/* note: currently this is a copy of 'pyrna_prop_collection_subscript' with + * large blocks commented, we may support slice/key indicies later */ +static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *key, PyObject *value) +{ + PYRNA_PROP_CHECK_INT(self); + + /* validate the assigned value */ + if(value == NULL) { + PyErr_SetString(PyExc_TypeError, + "del bpy_prop_collection[key]: not supported"); + return -1; + } + else if (pyrna_prop_collection_type_check(self, value) == -1) { + return -1; /* exception is set */ + } + +#if 0 + if (PyUnicode_Check(key)) { + return pyrna_prop_collection_subscript_str(self, _PyUnicode_AsString(key)); + } + else +#endif + if (PyIndex_Check(key)) { + Py_ssize_t i= PyNumber_AsSsize_t(key, PyExc_IndexError); + if (i == -1 && PyErr_Occurred()) + return -1; + + return pyrna_prop_collection_ass_subscript_int(self, i, value); + } +#if 0 /* TODO, fake slice assignment */ + else if (PySlice_Check(key)) { + PySliceObject *key_slice= (PySliceObject *)key; + Py_ssize_t step= 1; + + if(key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) { + return NULL; + } + else if (step != 1) { + PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported"); + return NULL; + } + else if(key_slice->start == Py_None && key_slice->stop == Py_None) { + return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX); + } + else { + Py_ssize_t start= 0, stop= PY_SSIZE_T_MAX; + + /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */ + if(key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL; + if(key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) return NULL; + + if(start < 0 || stop < 0) { + /* only get the length for negative values */ + Py_ssize_t len= (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); + if(start < 0) start += len; + if(stop < 0) start += len; + } + + if (stop - start <= 0) { + return PyList_New(0); + } + else { + return pyrna_prop_collection_subscript_slice(self, start, stop); + } + } + } +#endif + else { + PyErr_Format(PyExc_TypeError, + "bpy_prop_collection[key]: invalid key, " + "must be a string or an int, not %.200s", + Py_TYPE(key)->tp_name); + return -1; + } +} + static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject *key) { - PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self) + PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self); /*if (PyUnicode_Check(key)) { return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key)); @@ -2331,7 +2485,7 @@ static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t k { int len; - PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self) + PYRNA_PROP_CHECK_INT((BPy_PropertyRNA *)self); len= pyrna_prop_array_length(self); @@ -2409,7 +2563,7 @@ static PyMappingMethods pyrna_prop_array_as_mapping= { static PyMappingMethods pyrna_prop_collection_as_mapping= { (lenfunc) pyrna_prop_collection_length, /* mp_length */ (binaryfunc) pyrna_prop_collection_subscript, /* mp_subscript */ - (objobjargproc) NULL, /* mp_ass_subscript */ + (objobjargproc) pyrna_prop_collection_ass_subscript, /* mp_ass_subscript */ }; /* only for fast bool's, large structs, assign nb_bool on init */ @@ -2466,7 +2620,7 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value) IDProperty *group; const char *name= _PyUnicode_AsString(value); - PYRNA_STRUCT_CHECK_INT(self) + PYRNA_STRUCT_CHECK_INT(self); if (!name) { PyErr_SetString(PyExc_TypeError, "bpy_struct.__contains__: expected a string"); @@ -2505,7 +2659,7 @@ static PySequenceMethods pyrna_prop_collection_as_sequence= { NULL, /* sq_repeat */ (ssizeargfunc)pyrna_prop_collection_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */ NULL, /* *was* sq_slice */ - NULL, /* sq_ass_item */ + (ssizeobjargproc)/* pyrna_prop_collection_ass_subscript_int */ NULL /* let mapping take this one */, /* sq_ass_item */ NULL, /* *was* sq_ass_slice */ (objobjproc)pyrna_prop_collection_contains, /* sq_contains */ (binaryfunc) NULL, /* sq_inplace_concat */ @@ -2531,7 +2685,7 @@ static PyObject *pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key) IDProperty *group, *idprop; const char *name= _PyUnicode_AsString(key); - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if(RNA_struct_idprops_check(self->ptr.type)==0) { PyErr_SetString(PyExc_TypeError, "this type doesn't support IDProperties"); @@ -2564,7 +2718,7 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje { IDProperty *group; - PYRNA_STRUCT_CHECK_INT(self) + PYRNA_STRUCT_CHECK_INT(self); group= RNA_struct_idprops(&self->ptr, 1); @@ -2597,8 +2751,7 @@ PyDoc_STRVAR(pyrna_struct_keys_doc, " :return: custom property keys.\n" " :rtype: list of strings\n" "\n" -" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes\n" -" support custom properties.\n" +BPY_DOC_ID_PROP_TYPE_NOTE ); static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self) { @@ -2626,8 +2779,7 @@ PyDoc_STRVAR(pyrna_struct_items_doc, " :return: custom property key, value pairs.\n" " :rtype: list of key, value tuples\n" "\n" -" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n" -" classes support custom properties.\n" +BPY_DOC_ID_PROP_TYPE_NOTE ); static PyObject *pyrna_struct_items(BPy_PropertyRNA *self) { @@ -2655,8 +2807,7 @@ PyDoc_STRVAR(pyrna_struct_values_doc, " :return: custom property values.\n" " :rtype: list\n" "\n" -" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n" -" classes support custom properties.\n" +BPY_DOC_ID_PROP_TYPE_NOTE ); static PyObject *pyrna_struct_values(BPy_PropertyRNA *self) { @@ -2690,7 +2841,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg const char *name; int ret; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "s:is_property_set", &name)) return NULL; @@ -2733,7 +2884,7 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject * PropertyRNA *prop; const char *name; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name)) return NULL; @@ -2767,7 +2918,7 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args) PropertyRNA *r_prop; int index= -1; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "s|O!:path_resolve", &path, &PyBool_Type, &coerce)) return NULL; @@ -2825,7 +2976,7 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args) PropertyRNA *prop; PyObject *ret; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "|s:path_from_id", &name)) return NULL; @@ -2907,7 +3058,7 @@ static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { PointerRNA r_ptr; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); RNA_pointer_recast(&self->ptr, &r_ptr); return pyrna_struct_CreatePyObject(&r_ptr); @@ -2988,7 +3139,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self) PyObject *ret; PyObject *pystring; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); /* Include this incase this instance is a subtype of a python class * In these instances we may want to return a function or variable provided by the subtype @@ -3035,7 +3186,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) PropertyRNA *prop; FunctionRNA *func; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if(name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_struct: __getattr__ must be a string"); @@ -3256,7 +3407,7 @@ static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject const char *name= _PyUnicode_AsString(pyname); PropertyRNA *prop= NULL; - PYRNA_STRUCT_CHECK_INT(self) + PYRNA_STRUCT_CHECK_INT(self); #ifdef USE_PEDANTIC_WRITE if(rna_disallow_writes && rna_id_write_error(&self->ptr, pyname)) { @@ -3506,18 +3657,28 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self) Py_RETURN_NONE; } +static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self) +{ + PointerRNA tptr; + RNA_pointer_create(NULL, &RNA_Property, self->prop, &tptr); + return pyrna_struct_Subtype(&tptr); +} + + + /*****************************************************************************/ /* Python attributes get/set structure: */ /*****************************************************************************/ static PyGetSetDef pyrna_prop_getseters[]= { - {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL}, + {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL}, + {(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)"The property type for introspection", NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; static PyGetSetDef pyrna_struct_getseters[]= { - {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL}, + {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; @@ -3624,8 +3785,7 @@ PyDoc_STRVAR(pyrna_struct_get_doc, " *key* is not found.\n" " :type default: Undefined\n" "\n" -" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n" -" classes support custom properties.\n" +BPY_DOC_ID_PROP_TYPE_NOTE ); static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args) { @@ -3634,7 +3794,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args) const char *key; PyObject* def= Py_None; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) return NULL; @@ -3691,7 +3851,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args const char *key; PyObject* def= Py_None; - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) return NULL; @@ -3964,7 +4124,7 @@ PyDoc_STRVAR(pyrna_prop_collection_foreach_get_doc, ); static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args) { - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); return foreach_getset(self, args, 0); } @@ -3984,7 +4144,7 @@ PyDoc_STRVAR(pyrna_prop_collection_foreach_set_doc, ); static PyObject *pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObject *args) { - PYRNA_PROP_CHECK_OBJ(self) + PYRNA_PROP_CHECK_OBJ(self); return foreach_getset(self, args, 1); } @@ -3998,7 +4158,7 @@ static PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self) PyObject *iter= NULL; int len; - PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self) + PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self); len= pyrna_prop_array_length(self); ret= pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len); @@ -4140,8 +4300,8 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject * /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { - +static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) +{ BPy_PropertyRNA *base; if (!PyArg_ParseTuple(args, "O!:bpy_prop.__new__", &pyrna_prop_Type, &base)) @@ -4706,7 +4866,11 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ NULL, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ +#if defined(_MSC_VER) || defined(FREE_WINDOWS) + NULL, /* defer assignment */ +#else + &PyType_Type, /* struct _typeobject *tp_base; */ +#endif NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ NULL, /* descrsetfunc tp_descr_set; */ @@ -5277,7 +5441,11 @@ PyTypeObject pyrna_prop_collection_iter_Type= { NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ +#if defined(_MSC_VER) || defined(FREE_WINDOWS) + NULL, /* defer assignment */ +#else PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */ +#endif NULL, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ @@ -5306,7 +5474,11 @@ PyTypeObject pyrna_prop_collection_iter_Type= { #endif /*** Added in release 2.2 ***/ /* Iterators */ +#if defined(_MSC_VER) || defined(FREE_WINDOWS) + NULL, /* defer assignment */ +#else PyObject_SelfIter, /* getiterfunc tp_iter; */ +#endif (iternextfunc) pyrna_prop_collection_iter_next, /* iternextfunc tp_iternext; */ /*** Attribute descriptor and subclassing stuff ***/ @@ -5692,8 +5864,15 @@ void BPY_rna_init(void) mathutils_rna_matrix_cb_index= Mathutils_RegisterCallback(&mathutils_rna_matrix_cb); #endif - /* metaclass */ + /* for some reason MSVC complains of these */ +#if defined(_MSC_VER) || defined(FREE_WINDOWS) pyrna_struct_meta_idprop_Type.tp_base= &PyType_Type; + + pyrna_prop_collection_iter_Type.tp_iter= PyObject_SelfIter; + pyrna_prop_collection_iter_Type.tp_getattro= PyObject_GenericGetAttr; +#endif + + /* metaclass */ if(PyType_Ready(&pyrna_struct_meta_idprop_Type) < 0) return; @@ -5738,7 +5917,11 @@ PyObject *BPY_rna_module(void) void BPY_update_rna_module(void) { +#if 0 RNA_main_pointer_create(G.main, rna_module_ptr); +#else + rna_module_ptr->data= G.main; /* just set data is enough */ +#endif } #if 0 @@ -6238,7 +6421,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param ParameterIterator iter; PointerRNA funcptr; int err= 0, i, flag, ret_len=0; - int is_static= RNA_function_flag(func) & FUNC_NO_SELF; + const char is_static= (RNA_function_flag(func) & FUNC_NO_SELF) != 0; + + /* annoying!, need to check if the screen gets set to NULL which is a + * hint that the file was actually re-loaded. */ + char is_valid_wm; PropertyRNA *pret_single= NULL; void *retdata_single= NULL; @@ -6265,6 +6452,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if(C==NULL) C= BPy_GetContext(); + is_valid_wm= (CTX_wm_manager(C) != NULL); + bpy_context_set(C, &gilstate); if (!is_static) { @@ -6498,7 +6687,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if(err != 0) { ReportList *reports; /* alert the user, else they wont know unless they see the console. */ - if (!is_static && ptr->data && RNA_struct_is_a(ptr->type, &RNA_Operator)) { + if ( (!is_static) && + (ptr->data) && + (RNA_struct_is_a(ptr->type, &RNA_Operator)) && + (is_valid_wm == (CTX_wm_manager(C) != NULL))) + { wmOperator *op= ptr->data; reports= op->reports; } diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 30f6c02115a..502fa25c872 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -44,9 +44,6 @@ /* support for inter references, currently only needed for corner case */ #define USE_PYRNA_STRUCT_REFERENCE -/* use real collection iterators rather than faking with a list */ -#define USE_PYRNA_ITER - #else /* WITH_PYTHON_SAFETY */ /* default, no defines! */ @@ -67,6 +64,11 @@ * so prefer the leak to the memory bloat for now. */ // #define PYRNA_FREE_SUPPORT +/* use real collection iterators rather than faking with a list + * this is needed so enums can be iterated over without crashing, + * since finishing the iteration frees temp allocated enums */ +#define USE_PYRNA_ITER + /* --- end bpy build options --- */ struct ID; diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 8bde1db96ca..c87a141f5bd 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -189,7 +189,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb float cfra= FLT_MAX; const char *group_name= NULL; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()", @@ -237,7 +237,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb float cfra= FLT_MAX; const char *group_name= NULL; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_delete()", @@ -273,14 +273,14 @@ char pyrna_struct_driver_add_doc[] = " :arg index: array index of the property drive. Defaults to -1 for all indices or a single channel if the property is not an array.\n" " :type index: int\n" " :return: The driver(s) added.\n" -" :rtype: :class:`FCurve` or list if index is -1 with an array property.\n" +" :rtype: :class:`bpy.types.FCurve` or list if index is -1 with an array property.\n" ; PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) { const char *path, *path_full; int index= -1; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index)) return NULL; @@ -356,7 +356,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args) const char *path, *path_full; int index= -1; - PYRNA_STRUCT_CHECK_OBJ(self) + PYRNA_STRUCT_CHECK_OBJ(self); if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index)) return NULL; diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index e50ce233671..cab57724d6d 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -61,12 +61,12 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *) static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[], ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix) { - int i; + Py_ssize_t i; /* not the last dimension */ if (dim + 1 < totdim) { /* check that a sequence contains dimsize[dim] items */ - const int seq_size= PySequence_Size(seq); + const Py_ssize_t seq_size= PySequence_Size(seq); if(seq_size == -1) { PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name); @@ -147,8 +147,8 @@ static int count_items(PyObject *seq, int dim) int totitem= 0; if(dim > 1) { - const int seq_size= PySequence_Size(seq); - int i; + const Py_ssize_t seq_size= PySequence_Size(seq); + Py_ssize_t i; for (i= 0; i < seq_size; i++) { PyObject *item= PySequence_GetItem(seq, i); if(item) { @@ -281,9 +281,9 @@ static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *pro static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int dim, char *data, unsigned int item_size, int *index, ItemConvertFunc convert_item, RNA_SetIndexFunc rna_set_index) { - unsigned int i; int totdim= RNA_property_array_dimension(ptr, prop, NULL); - const int seq_size= PySequence_Size(seq); + const Py_ssize_t seq_size= PySequence_Size(seq); + Py_ssize_t i; /* Regarding PySequence_GetItem() failing. * diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 50b75b09cb2..9adeae9dc29 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -94,11 +94,11 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject * #if 1 /* approx 6x speedup for mathutils types */ int size; - if( (VectorObject_Check(value) && (size= ((VectorObject *)value)->size)) || - (EulerObject_Check(value) && (size= 3)) || - (QuaternionObject_Check(value) && (size= 4)) || - (ColorObject_Check(value) && (size= 3)) - ) { + if( (size= VectorObject_Check(value) ? ((VectorObject *)value)->size : 0) || + (size= EulerObject_Check(value) ? 3 : 0) || + (size= QuaternionObject_Check(value) ? 4 : 0) || + (size= ColorObject_Check(value) ? 3 : 0)) + { if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; } diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 947e4425d3f..9d1cfb1948a 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -193,7 +193,7 @@ static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value) } PyDoc_STRVAR(Quaternion_rotation_difference_doc, -".. function:: difference(other)\n" +".. function:: rotation_difference(other)\n" "\n" " Returns a quaternion representing the rotational difference.\n" "\n" diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript index 24dfab13fd9..a128ded965c 100644 --- a/source/blender/quicktime/SConscript +++ b/source/blender/quicktime/SConscript @@ -35,5 +35,6 @@ defs=['WITH_QUICKTIME'] if env['WITH_GHOST_COCOA']: defs.append('GHOST_COCOA') - -env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities) + env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/g++-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers do not support it fully yet +else: + env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities) diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 1fd377b2afc..63977eb2b21 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -488,7 +488,6 @@ typedef struct VolPrecachePart int res[3]; float bbmin[3]; float voxel[3]; - int working, done; struct Render *re; } VolPrecachePart; diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index dfff35ba51a..550652560be 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -441,7 +441,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i) } else { assert(0); - return 0; + return 0; } } diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp index 331358f727b..8fc3c938427 100644 --- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp @@ -116,8 +116,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } /* the cast to pointer function is needed to workarround gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11407 */ diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp index a99c57ab233..0d1526fba6f 100644 --- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp @@ -152,8 +152,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } /* the cast to pointer function is needed to workarround gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11407 */ diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp index 25eada43a4a..620477f1e70 100644 --- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp @@ -154,8 +154,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 310fc516a16..5c49f230ee6 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1350,7 +1350,7 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl int totsplit = bb->uv_split * bb->uv_split; int tile, x, y; /* Tile offsets */ - float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; + float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; vlr= RE_findOrAddVlak(obr, obr->totvlak++); vlr->v1= RE_findOrAddVert(obr, obr->totvert++); @@ -4419,9 +4419,9 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset) /* Database */ /* ------------------------------------------------------------------------- */ -static int render_object_type(int type) +static int render_object_type(short type) { - return ELEM5(type, OB_FONT, OB_CURVE, OB_SURF, OB_MESH, OB_MBALL); + return OB_TYPE_SUPPORT_MATERIAL(type); } static void find_dupli_instances(Render *re, ObjectRen *obr) @@ -4912,8 +4912,13 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp * NULL is just for init */ set_dupli_tex_mat(NULL, NULL, NULL); - for(SETLOOPER(re->scene, sce_iter, base)) { - ob= base->object; + /* loop over all objects rather then using SETLOOPER because we may + * reference an mtex-mapped object which isnt rendered or is an + * empty in a dupli group. We could scan all render material/lamp/world + * mtex's for mapto objects but its easier just to set the + * 'imat' / 'imat_ren' on all and unlikely to be a performance hit + * See bug: [#28744] - campbell */ + for(ob= re->main->object.first; ob; ob= ob->id.next) { /* imat objects has to be done here, since displace can have texture using Object map-input */ mul_m4_m4m4(mat, ob->obmat, re->viewmat); invert_m4_m4(ob->imat_ren, mat); @@ -5081,7 +5086,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* per second, per object, stats print this */ re->i.infostr= "Preparing Scene data"; re->i.cfra= scene->r.cfra; - strncpy(re->i.scenename, scene->id.name+2, 20); + BLI_strncpy(re->i.scenename, scene->id.name+2, sizeof(re->i.scenename)); /* XXX add test if dbase was filled already? */ diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 64b007585c8..08e9278ce46 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1203,7 +1203,7 @@ Render *RE_NewRender(const char *name) /* new render data struct */ re= MEM_callocN(sizeof(Render), "new render"); BLI_addtail(&RenderGlobal.renderlist, re); - strncpy(re->name, name, RE_MAXNAME); + BLI_strncpy(re->name, name, RE_MAXNAME); BLI_rw_mutex_init(&re->resultmutex); } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 8d953ccc73d..ae814f67450 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1748,7 +1748,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL}; // temp TexResult float tco[3], texv[3], cd, ud, vd, du, dv, idu, idv; const int fromrgb = ((tex->type == TEX_IMAGE) || ((tex->flag & TEX_COLORBAND)!=0)); - const float bf = 0.04f*Tnor*mtex->norfac; + const float bf = -0.04f*Tnor*mtex->norfac; int rgbnor; // disable internal bump eval float* nvec = texres->nor; @@ -1904,7 +1904,14 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL}; // temp TexResult const int fromrgb = ((tex->type == TEX_IMAGE) || ((tex->flag & TEX_COLORBAND)!=0)); - float Hscale = Tnor*mtex->norfac; + + // The negate on Hscale is done because the + // normal in the renderer points inward which corresponds + // to inverting the bump map. The normals are generated + // this way in calc_vertexnormals(). Should this ever change + // this negate must be removed. + float Hscale = -Tnor*mtex->norfac; + int dimx=512, dimy=512; const int imag_tspace_dimension_x = 1024; // only used for texture space variant float aspect = 1.0f; diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 18132c4a7f3..d6cfcee4ac9 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -477,6 +477,11 @@ static void *vol_precache_part_test(void *data) } #endif +typedef struct VolPrecacheQueue { + ThreadQueue *work; + ThreadQueue *done; +} VolPrecacheQueue; + /* Iterate over the 3d voxel grid, and fill the voxels with scattering information * * It's stored in memory as 3 big float grids next to each other, one for each RGB channel. @@ -485,58 +490,65 @@ static void *vol_precache_part_test(void *data) */ static void *vol_precache_part(void *data) { - VolPrecachePart *pa = (VolPrecachePart *)data; - ObjectInstanceRen *obi = pa->obi; - RayObject *tree = pa->tree; - ShadeInput *shi = pa->shi; - float scatter_col[3] = {0.f, 0.f, 0.f}; - float co[3], cco[3], view[3]; - int x, y, z, i; - int res[3]; - - res[0]= pa->res[0]; - res[1]= pa->res[1]; - res[2]= pa->res[2]; - - for (z= pa->minz; z < pa->maxz; z++) { - co[2] = pa->bbmin[2] + (pa->voxel[2] * (z + 0.5f)); - - for (y= pa->miny; y < pa->maxy; y++) { - co[1] = pa->bbmin[1] + (pa->voxel[1] * (y + 0.5f)); + VolPrecacheQueue *queue = (VolPrecacheQueue*)data; + VolPrecachePart *pa; + + while ((pa = BLI_thread_queue_pop(queue->work))) { + ObjectInstanceRen *obi = pa->obi; + RayObject *tree = pa->tree; + ShadeInput *shi = pa->shi; + float scatter_col[3] = {0.f, 0.f, 0.f}; + float co[3], cco[3], view[3]; + int x, y, z, i; + int res[3]; + + if (pa->re->test_break && pa->re->test_break(pa->re->tbh)) + break; + + res[0]= pa->res[0]; + res[1]= pa->res[1]; + res[2]= pa->res[2]; + + for (z= pa->minz; z < pa->maxz; z++) { + co[2] = pa->bbmin[2] + (pa->voxel[2] * (z + 0.5f)); - for (x=pa->minx; x < pa->maxx; x++) { - co[0] = pa->bbmin[0] + (pa->voxel[0] * (x + 0.5f)); - - if (pa->re->test_break && pa->re->test_break(pa->re->tbh)) - break; + for (y= pa->miny; y < pa->maxy; y++) { + co[1] = pa->bbmin[1] + (pa->voxel[1] * (y + 0.5f)); - /* convert from world->camera space for shading */ - mul_v3_m4v3(cco, pa->viewmat, co); - - i= V_I(x, y, z, res); + for (x=pa->minx; x < pa->maxx; x++) { + co[0] = pa->bbmin[0] + (pa->voxel[0] * (x + 0.5f)); + + if (pa->re->test_break && pa->re->test_break(pa->re->tbh)) + break; + + /* convert from world->camera space for shading */ + mul_v3_m4v3(cco, pa->viewmat, co); + + i= V_I(x, y, z, res); + + // don't bother if the point is not inside the volume mesh + if (!point_inside_obi(tree, obi, cco)) { + obi->volume_precache->data_r[i] = -1.0f; + obi->volume_precache->data_g[i] = -1.0f; + obi->volume_precache->data_b[i] = -1.0f; + continue; + } + + copy_v3_v3(view, cco); + normalize_v3(view); + vol_get_scattering(shi, scatter_col, cco, view); - // don't bother if the point is not inside the volume mesh - if (!point_inside_obi(tree, obi, cco)) { - obi->volume_precache->data_r[i] = -1.0f; - obi->volume_precache->data_g[i] = -1.0f; - obi->volume_precache->data_b[i] = -1.0f; - continue; + obi->volume_precache->data_r[i] = scatter_col[0]; + obi->volume_precache->data_g[i] = scatter_col[1]; + obi->volume_precache->data_b[i] = scatter_col[2]; + } - - copy_v3_v3(view, cco); - normalize_v3(view); - vol_get_scattering(shi, scatter_col, cco, view); - - obi->volume_precache->data_r[i] = scatter_col[0]; - obi->volume_precache->data_g[i] = scatter_col[1]; - obi->volume_precache->data_b[i] = scatter_col[2]; - } } + + BLI_thread_queue_push(queue->done, pa); } - pa->done = 1; - return NULL; } @@ -602,9 +614,6 @@ static void precache_init_parts(Render *re, RayObject *tree, ShadeInput *shi, Ob minz = z * sizez; maxz = minz + sizez; maxz = (maxz>res[2])?res[2]:maxz; - - pa->done = 0; - pa->working = 0; pa->re = re; pa->num = i; @@ -630,21 +639,6 @@ static void precache_init_parts(Render *re, RayObject *tree, ShadeInput *shi, Ob } } -static VolPrecachePart *precache_get_new_part(Render *re) -{ - VolPrecachePart *pa, *nextpa=NULL; - - for (pa = re->volume_precache_parts.first; pa; pa=pa->next) - { - if (pa->done==0 && pa->working==0) { - nextpa = pa; - break; - } - } - - return nextpa; -} - /* calculate resolution from bounding box in world space */ static int precache_resolution(Render *re, VolumePrecache *vp, ObjectInstanceRen *obi, int res) { @@ -678,14 +672,15 @@ static int precache_resolution(Render *re, VolumePrecache *vp, ObjectInstanceRen static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Material *ma) { VolumePrecache *vp; - VolPrecachePart *nextpa, *pa; + VolPrecachePart *pa; RayObject *tree; ShadeInput shi; ListBase threads; + VolPrecacheQueue queue; int parts[3] = {1, 1, 1}, totparts; - int caching=1, counter=0; - int totthread = re->r.threads; + int counter=0; + int totthread = re->r.threads, thread; double time, lasttime= PIL_check_seconds_timer(); @@ -718,34 +713,29 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o precache_init_parts(re, tree, &shi, obi, totthread, parts); totparts = parts[0] * parts[1] * parts[2]; + + /* setup work and done queues */ + queue.work = BLI_thread_queue_init(); + queue.done = BLI_thread_queue_init(); + BLI_thread_queue_nowait(queue.work); + + for(pa= re->volume_precache_parts.first; pa; pa= pa->next) + BLI_thread_queue_push(queue.work, pa); + /* launch threads */ BLI_init_threads(&threads, vol_precache_part, totthread); + + for(thread= 0; thread<totthread; thread++) + BLI_insert_thread(&threads, &queue); - while(caching) { + /* loop waiting for work to be done */ + while(counter < totparts) { + if(re->test_break && re->test_break(re->tbh)) + break; - if(BLI_available_threads(&threads) && !(re->test_break(re->tbh))) { - nextpa = precache_get_new_part(re); - if (nextpa) { - nextpa->working = 1; - BLI_insert_thread(&threads, nextpa); - } - } - else PIL_sleep_ms(50); + if(BLI_thread_queue_pop_timeout(queue.done, 50)) + counter++; - caching=0; - counter=0; - for(pa= re->volume_precache_parts.first; pa; pa= pa->next) { - - if(pa->done) { - counter++; - BLI_remove_thread(&threads, pa); - } else - caching = 1; - } - - if (re->test_break(re->tbh) && BLI_available_threads(&threads)==totthread) - caching=0; - time= PIL_check_seconds_timer(); if(time-lasttime>1.0) { char str[64]; @@ -757,7 +747,10 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o } } + /* free */ BLI_end_threads(&threads); + BLI_thread_queue_free(queue.work); + BLI_thread_queue_free(queue.done); BLI_freelistN(&re->volume_precache_parts); if(tree) { @@ -788,13 +781,22 @@ void volume_precache(Render *re) ObjectInstanceRen *obi; VolumeOb *vo; + re->i.infostr= "Volume preprocessing"; + re->stats_draw(re->sdh, &re->i); + for(vo= re->volumes.first; vo; vo= vo->next) { if (using_lightcache(vo->ma)) { for(obi= re->instancetable.first; obi; obi= obi->next) { if (obi->obr == vo->obr) { vol_precache_objectinstance_threads(re, obi, vo->ma); + + if(re->test_break && re->test_break(re->tbh)) + break; } } + + if(re->test_break && re->test_break(re->tbh)) + break; } } diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 7c34c086b2e..7da2e17ad89 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -82,7 +82,7 @@ set(SRC add_definitions(-DGLEW_STATIC) if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() if(WITH_OPENCOLLADA) diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index c60752b85f8..ef6ddd18bb1 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -40,6 +40,6 @@ if env['BF_BUILDINFO']: defs.append('WITH_BUILDINFO') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] ) diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index cc3ae3ab753..fec59e97194 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -464,8 +464,6 @@ typedef struct wmOperatorType { /* struct wmOperatorTypeMacro */ ListBase macro; - short flag; - /* pointer to modal keymap, do not free! */ struct wmKeyMap *modalkeymap; @@ -476,6 +474,10 @@ typedef struct wmOperatorType { /* RNA integration */ ExtensionRNA ext; + + /* Flag last for padding */ + short flag; + } wmOperatorType; /* **************** Paint Cursor ******************* */ @@ -540,11 +542,12 @@ typedef struct wmDropBox { /* if poll survives, operator is called */ wmOperatorType *ot; /* not saved in file, so can be pointer */ - short opcontext; /* default invoke */ - - struct IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */ + + struct IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */ struct PointerRNA *ptr; /* rna pointer to access properties */ + short opcontext; /* default invoke */ + } wmDropBox; /* *************** migrated stuff, clean later? ************** */ diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 9299b50103c..5beb07a1ed0 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -230,6 +230,7 @@ void WM_keymap_init(bContext *C) { wmWindowManager *wm= CTX_wm_manager(C); + /* create standard key configs */ if(!wm->defaultconf) wm->defaultconf= WM_keyconfig_new(wm, "Blender"); if(!wm->addonconf) @@ -237,10 +238,17 @@ void WM_keymap_init(bContext *C) if(!wm->userconf) wm->userconf= WM_keyconfig_new(wm, "Blender User"); + /* initialize only after python init is done, for keymaps that + use python operators */ if(CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) { - /* create default key config */ - wm_window_keymap(wm->defaultconf); - ED_spacetypes_keymap(wm->defaultconf); + /* create default key config, only initialize once, + it's persistent across sessions */ + if(!(wm->defaultconf->flag & KEYCONF_INIT_DEFAULT)) { + wm_window_keymap(wm->defaultconf); + ED_spacetypes_keymap(wm->defaultconf); + + wm->defaultconf->flag |= KEYCONF_INIT_DEFAULT; + } WM_keyconfig_update_tag(NULL, NULL); WM_keyconfig_update(wm); diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 32a4648c7f8..8939ffd85a9 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -317,8 +317,8 @@ are for */ #define BEGIN_CURSOR_BLOCK { #define END_CURSOR_BLOCK } -void wm_init_cursor_data(void){ - +void wm_init_cursor_data(void) +{ /********************** NW_ARROW Cursor **************************/ BEGIN_CURSOR_BLOCK static char nw_sbm[]={ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index dad43b4fe69..cafee6b49ca 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1223,41 +1223,47 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand retval= ot->modal(C, op, event); OPERATOR_RETVAL_CHECK(retval); - if(ot->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) - wm->op_undo_depth--; + /* when this is _not_ the case the modal modifier may have loaded + * a new blend file (demo mode does this), so we have to assume + * the event, operator etc have all been freed. - campbell */ + if(CTX_wm_manager(C) == wm) { - /* putting back screen context, reval can pass trough after modal failures! */ - if((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) { - CTX_wm_area_set(C, area); - CTX_wm_region_set(C, region); - } - else { - /* this special cases is for areas and regions that get removed */ - CTX_wm_area_set(C, NULL); - CTX_wm_region_set(C, NULL); - } + if(ot->flag & OPTYPE_UNDO) + wm->op_undo_depth--; - if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) - wm_operator_reports(C, op, retval, 0); - - if(retval & OPERATOR_FINISHED) { - wm_operator_finished(C, op, 0); - handler->op= NULL; - } - else if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) { - WM_operator_free(op); - handler->op= NULL; - } - - /* remove modal handler, operator itself should have been cancelled and freed */ - if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) { - WM_cursor_ungrab(CTX_wm_window(C)); + /* putting back screen context, reval can pass trough after modal failures! */ + if((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) { + CTX_wm_area_set(C, area); + CTX_wm_region_set(C, region); + } + else { + /* this special cases is for areas and regions that get removed */ + CTX_wm_area_set(C, NULL); + CTX_wm_region_set(C, NULL); + } - BLI_remlink(handlers, handler); - wm_event_free_handler(handler); - - /* prevent silly errors from operator users */ - //retval &= ~OPERATOR_PASS_THROUGH; + if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) + wm_operator_reports(C, op, retval, 0); + + if(retval & OPERATOR_FINISHED) { + wm_operator_finished(C, op, 0); + handler->op= NULL; + } + else if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) { + WM_operator_free(op); + handler->op= NULL; + } + + /* remove modal handler, operator itself should have been cancelled and freed */ + if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) { + WM_cursor_ungrab(CTX_wm_window(C)); + + BLI_remlink(handlers, handler); + wm_event_free_handler(handler); + + /* prevent silly errors from operator users */ + //retval &= ~OPERATOR_PASS_THROUGH; + } } } @@ -1270,6 +1276,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand if(ot) retval= wm_operator_invoke(C, ot, event, properties, NULL, FALSE); } + /* Finished and pass through flag as handled */ /* Finished and pass through flag as handled */ if(retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH)) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index f862af6173a..bf5b60d691f 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -226,13 +226,16 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist) oldwm= oldwmlist->first; wm= G.main->wm.first; - /* move addon key configuration to new wm, to preserve their keymaps */ - if(oldwm->addonconf) { - wm->addonconf= oldwm->addonconf; - BLI_remlink(&oldwm->keyconfigs, oldwm->addonconf); - oldwm->addonconf= NULL; - BLI_addtail(&wm->keyconfigs, wm->addonconf); - } + /* preserve key configurations in new wm, to preserve their keymaps */ + wm->keyconfigs= oldwm->keyconfigs; + wm->addonconf= oldwm->addonconf; + wm->defaultconf= oldwm->defaultconf; + wm->userconf= oldwm->userconf; + + oldwm->keyconfigs.first= oldwm->keyconfigs.last= NULL; + oldwm->addonconf= NULL; + oldwm->defaultconf= NULL; + oldwm->userconf= NULL; /* ensure making new keymaps and set space types */ wm->initialized= 0; @@ -286,7 +289,8 @@ static void wm_init_userdef(bContext *C) if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; else G.f &= ~G_SCRIPT_AUTOEXEC; } - if(U.tempdir[0]) BLI_where_is_temp(btempdir, FILE_MAX, 1); + /* update tempdir from user preferences */ + BLI_where_is_temp(btempdir, FILE_MAX, 1); } @@ -408,6 +412,10 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) BPY_app_handlers_reset(); BPY_modules_load_user(C); #endif + + /* important to do before NULL'ing the context */ + BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); + CTX_wm_window_set(C, NULL); /* exits queues */ #if 0 /* gives popups on windows but not linux, bug in report API but disable for now to stop users getting annoyed */ @@ -425,8 +433,6 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) // XXX undo_editmode_clear(); BKE_reset_undo(); BKE_write_undo(C, "original"); /* save current state */ - - BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); } else if(retval == BKE_READ_EXOTIC_OK_OTHER) BKE_write_undo(C, "Import file"); @@ -850,14 +856,14 @@ void wm_autosave_location(char *filepath) * BLI_make_file_string will create string that has it most likely on C:\ * through get_default_root(). * If there is no C:\tmp autosave fails. */ - if (!BLI_exists(U.tempdir)) { + if (!BLI_exists(btempdir)) { savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL); BLI_make_file_string("/", filepath, savedir, pidstr); return; } #endif - - BLI_make_file_string("/", filepath, U.tempdir, pidstr); + + BLI_make_file_string("/", filepath, btempdir, pidstr); } void WM_autosave_init(wmWindowManager *wm) @@ -915,7 +921,7 @@ void wm_autosave_delete(void) if(BLI_exists(filename)) { char str[FILE_MAXDIR+FILE_MAXFILE]; - BLI_make_file_string("/", str, U.tempdir, "quit.blend"); + BLI_make_file_string("/", str, btempdir, "quit.blend"); /* if global undo; remove tempsave, otherwise rename */ if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0); diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index cf3f12da767..766be796484 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -403,7 +403,7 @@ void WM_exit_ext(bContext *C, const short do_python) BLF_exit(); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL BLF_free_unifont(); #endif @@ -427,6 +427,8 @@ void WM_exit_ext(bContext *C, const short do_python) * the pyDriver bug can be fixed if it happens again we can deal with it then */ BPY_python_end(); } +#else + (void)do_python; #endif GPU_global_buffer_pool_free(); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 68cd95c1b99..eda85f112df 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -863,7 +863,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, RNA_def_boolean(ot->srna, "relative_path", (U.flag & USER_RELPATHS) ? 1:0, "Relative Path", "Select the file relative to the blend file"); } -void WM_operator_properties_select_all(wmOperatorType *ot) { +void WM_operator_properties_select_all(wmOperatorType *ot) +{ static EnumPropertyItem select_all_actions[] = { {SEL_TOGGLE, "TOGGLE", 0, N_("Toggle"), "Toggle selection for all elements"}, {SEL_SELECT, "SELECT", 0, N_("Select"), "Select all elements"}, @@ -1207,9 +1208,6 @@ static int wm_resource_check_prev(void) static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg)) { - extern char datatoc_splash_png[]; - extern int datatoc_splash_png_size; - uiBlock *block; uiBut *but; uiLayout *layout, *split, *col; @@ -1218,9 +1216,17 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar int i; MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE); char url[96]; - /* hardcoded to splash, loading and freeing every draw, eek! */ + +#ifndef WITH_HEADLESS + extern char datatoc_splash_png[]; + extern int datatoc_splash_png_size; + ImBuf *ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect); - +#else + ImBuf *ibuf= NULL; +#endif + + #ifdef WITH_BUILDINFO int ver_width, rev_width; char *version_str = NULL; @@ -1274,7 +1280,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiItemL(col, "Links", ICON_NONE); uiItemStringO(col, UI_translate_do_iface(N_("Donations")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); uiItemStringO(col, UI_translate_do_iface(N_("Credits")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); - uiItemStringO(col, UI_translate_do_iface(N_("Release Log")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-259"); + uiItemStringO(col, UI_translate_do_iface(N_("Release Log")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-260"); uiItemStringO(col, UI_translate_do_iface(N_("Manual")), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); uiItemStringO(col, UI_translate_do_iface(N_("Blender Website")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); uiItemStringO(col, UI_translate_do_iface(N_("User Community")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); @@ -1620,7 +1626,15 @@ static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev } else { /* XXX TODO solve where to get last linked library from */ - RNA_string_set(op->ptr, "filepath", G.lib); + if(G.lib[0] != '\0') { + RNA_string_set(op->ptr, "filepath", G.lib); + } + else if(G.relbase_valid) { + char path[FILE_MAX]; + BLI_strncpy(path, G.main->name, sizeof(G.main->name)); + BLI_parent_dir(path); + RNA_string_set(op->ptr, "filepath", path); + } WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; } diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index c8bf3b002f1..82847cb8079 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -63,6 +63,18 @@ if(WIN32 AND NOT UNIX) endif() add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc) + +elseif(APPLE) + add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c) + # setup Info.plist + execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) + set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist) + set_target_properties(blenderplayer PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${PLAYER_SOURCEINFO} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION} + MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}") + else() add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c) endif() diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 2944a3cef69..0252f161774 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -371,6 +371,7 @@ void uiTemplateHistogram(struct uiLayout *layout, struct PointerRNA *ptr, char * void uiTemplateReportsBanner(struct uiLayout *layout, struct bContext *C, struct wmOperator *op){} void uiTemplateWaveform(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand){} void uiTemplateVectorscope(struct uiLayout *_self, struct PointerRNA *data, char* property, int expand){} +void uiTemplateKeymapItemProperties(struct uiLayout *layout, struct PointerRNA *ptr){} /* rna render */ struct RenderResult *RE_engine_begin_result(struct RenderEngine *engine, int x, int y, int w, int h){return (struct RenderResult *) NULL;} diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index d66b783370a..acee1c9ff00 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -126,7 +126,7 @@ if(WIN32 AND NOT UNIX) -DBLEN_VER_RC_4=0 ) endif() - + list(APPEND SRC ../icons/winblender.rc @@ -199,16 +199,16 @@ if(WITH_PYTHON_MODULE) LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin # only needed on windows ) - + if(WIN32) # python modules use this set_target_properties( blender PROPERTIES SUFFIX ".pyd" - ) + ) endif() - + else() add_executable(blender ${EXETYPE} ${SRC}) endif() @@ -352,11 +352,6 @@ if(UNIX AND NOT APPLE) if(WITH_INTERNATIONAL) install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages - DESTINATION ${TARGETDIR_VER} - ) - - install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts @@ -429,10 +424,6 @@ elseif(WIN32) if(WITH_INTERNATIONAL) # same as linux!, deduplicate install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages - DESTINATION ${TARGETDIR_VER} - ) - install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts @@ -592,12 +583,12 @@ elseif(WIN32) FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll DESTINATION ${TARGETDIR} ) - else() - install( - FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll - DESTINATION ${TARGETDIR} - ) endif() + + install( # x86 builds can run on x64 Windows, so this is required at all times + FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll + DESTINATION ${TARGETDIR} + ) elseif(APPLE) set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app) @@ -665,11 +656,6 @@ elseif(APPLE) # localization if(WITH_INTERNATIONAL) install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages - DESTINATION ${TARGETDIR_VER}/datafiles - ) - - install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale @@ -688,14 +674,14 @@ elseif(APPLE) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python) set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip") - + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/ COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/ DEPENDS ${LIBDIR}/release/${PYTHON_ZIP}) - + add_dependencies(blender extractpyzip) # copy extracted python files @@ -710,6 +696,48 @@ elseif(APPLE) \${TARGETDIR_VER} ) endif() + + # install blenderplayer bundle - copy of blender.app above. re-using macros et al + # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it + if(WITH_GAMEENGINE AND WITH_PLAYER) + set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) + set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist) + set(PLAYER_TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION}) + + + # important to make a clean install each time else old scripts get loaded. + install( + CODE + "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})" + ) + + install( + FILES ${PLAYER_SOURCEDIR}/Contents/PkgInfo + DESTINATION ${TARGETDIR}/blenderplayer.app/Contents + ) + + install_dir( + ${PLAYER_SOURCEDIR}/Contents/Resources + \${TARGETDIR}/blenderplayer.app/Contents/ + ) + + # python + if(WITH_PYTHON) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python + COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/ + DEPENDS ${LIBDIR}/release/${PYTHON_ZIP}) + + # copy extracted python files + install_dir( + ${CMAKE_CURRENT_BINARY_DIR}/python + \${PLAYER_TARGETDIR_VER} + ) + endif() + + endif() endif() unset(BLENDER_TEXT_FILES) @@ -877,12 +905,12 @@ endif() message(STATUS "Blender Skipping: (${REM_MSG})") endif() target_link_libraries(blender ${BLENDER_SORTED_LIBS}) - + unset(SEARCHLIB) unset(SORTLIB) unset(REMLIB) unset(REM_MSG) - + #else() # target_link_libraries(blender ${BLENDER_LINK_LIBS}) #endif() diff --git a/source/creator/creator.c b/source/creator/creator.c index 42e70c34b8b..747af430ce9 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -485,7 +485,7 @@ static int no_joystick(int UNUSED(argc), const char **UNUSED(argv), void *data) SYS_SystemHandle *syshandle = data; /** - don't initialize joysticks if user doesn't want to use joysticks + don't initialize joysticks if user doesn't want to use joysticks failed joystick initialization delays over 5 seconds, before game engine start */ SYS_WriteCommandLineInt(*syshandle, "nojoystick",1); @@ -522,8 +522,8 @@ static int set_output(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1){ - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic)); } else { printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n"); @@ -548,17 +548,17 @@ static int set_engine(int argc, const char **argv, void *data) exit(0); } else { - if (CTX_data_scene(C)==NULL) { - printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); - } - else { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { RenderData *rd = &scene->r; if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) { BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine)); } } + else { + printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); + } } return 1; @@ -575,10 +575,8 @@ static int set_image_type(int argc, const char **argv, void *data) bContext *C = data; if (argc >= 1){ const char *imtype = argv[1]; - if (CTX_data_scene(C)==NULL) { - printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n"); - } else { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (!strcmp(imtype,"TGA")) scene->r.imtype = R_TARGA; else if (!strcmp(imtype,"IRIS")) scene->r.imtype = R_IRIS; #ifdef WITH_DDS @@ -614,6 +612,9 @@ static int set_image_type(int argc, const char **argv, void *data) #endif else printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n"); } + else { + printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n"); + } return 1; } else { printf("\nError: you must specify a format after '-F / --render-foramt'.\n"); @@ -640,8 +641,8 @@ static int set_extension(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1) { - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argv[1][0] == '0') { scene->r.scemode &= ~R_EXTENSION; } else if (argv[1][0] == '1') { @@ -723,9 +724,9 @@ example: static int render_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); if (argc > 1) { Render *re = RE_NewRender(scene->id.name); @@ -765,9 +766,9 @@ static int render_frame(int argc, const char **argv, void *data) static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); Render *re= RE_NewRender(scene->id.name); ReportList reports; BKE_reports_init(&reports, RPT_PRINT); @@ -784,9 +785,9 @@ static int set_scene(int argc, const char **argv, void *data) { if(argc > 1) { bContext *C= data; - Scene *sce= set_scene_name(CTX_data_main(C), argv[1]); - if(sce) { - CTX_data_scene_set(C, sce); + Scene *scene= set_scene_name(CTX_data_main(C), argv[1]); + if(scene) { + CTX_data_scene_set(C, scene); } return 1; } else { @@ -798,8 +799,8 @@ static int set_scene(int argc, const char **argv, void *data) static int set_start_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.sfra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -817,8 +818,8 @@ static int set_start_frame(int argc, const char **argv, void *data) static int set_end_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.efra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -836,8 +837,8 @@ static int set_end_frame(int argc, const char **argv, void *data) static int set_skip_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.frame_step) = CLAMPIS(frame, 1, MAXFRAME); diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 895def17e8e..557b4aa7f11 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -226,10 +226,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) break; } - // Continue only really makes sense for play stop and flipper. All other modes go until they are complete. - if (m_flag & ACT_FLAG_CONTINUE && - (m_playtype == ACT_ACTION_LOOP_STOP || - m_playtype == ACT_ACTION_FLIPPER)) + if (m_flag & ACT_FLAG_CONTINUE) bUseContinue = true; @@ -244,12 +241,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (m_flag & ACT_FLAG_ATTEMPT_PLAY) SetLocalTime(curtime); - if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) - { - m_localtime = obj->GetActionFrame(m_layer); - ResetStartTime(curtime); - } - // Handle a frame property if it's defined if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0) { @@ -264,22 +255,25 @@ bool BL_ActionActuator::Update(double curtime, bool frame) } // Handle a finished animation - if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer)) + if ((m_flag & ACT_FLAG_PLAY_END) && (m_flag & ACT_FLAG_ACTIVE) && obj->IsActionDone(m_layer)) { m_flag &= ~ACT_FLAG_ACTIVE; m_flag &= ~ACT_FLAG_ATTEMPT_PLAY; - obj->StopAction(m_layer); return false; } // If a different action is playing, we've been overruled and are no longer active - if (obj->GetCurrentAction(m_layer) != m_action) + if (obj->GetCurrentAction(m_layer) != m_action && !obj->IsActionDone(m_layer)) m_flag &= ~ACT_FLAG_ACTIVE; if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & ACT_FLAG_ACTIVE))) { if (bPositiveEvent) + { + if (obj->IsActionDone(m_layer)) + m_localtime = start; ResetStartTime(curtime); + } if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags)) { @@ -307,11 +301,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) return false; } - - m_localtime = obj->GetActionFrame(m_layer); - if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) - m_localtime = m_startframe; - switch(m_playtype) { case ACT_ACTION_LOOP_STOP: @@ -340,6 +329,12 @@ bool BL_ActionActuator::Update(double curtime, bool frame) break; } } + + if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) + { + m_localtime = obj->GetActionFrame(m_layer); + ResetStartTime(curtime); + } return true; } diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp index df3a575850b..5442878d6c5 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp @@ -279,19 +279,19 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str if (sa > FLT_EPSILON) { norm = atan2(sa,ca)/sa; } else { - if (ca < 0.0) { - norm = M_PI; - mul_v3_fl(joints,0.f); - if (joint_mat[0][0] > 0.f) { - joints[0] = 1.0f; - } else if (joint_mat[1][1] > 0.f) { - joints[1] = 1.0f; - } else { - joints[2] = 1.0f; - } - } else { - norm = 0.0; - } + if (ca < 0.0) { + norm = M_PI; + mul_v3_fl(joints,0.f); + if (joint_mat[0][0] > 0.f) { + joints[0] = 1.0f; + } else if (joint_mat[1][1] > 0.f) { + joints[1] = 1.0f; + } else { + joints[2] = 1.0f; + } + } else { + norm = 0.0; + } } mul_v3_fl(joints,norm); break; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 2c2fd052b5d..8633a14de03 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -642,7 +642,7 @@ bool ConvertMaterial( if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID)) material->alphablend = GEMAT_ALPHA; - // always zsort alpha + add + // always zsort alpha + add if((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) { material->ras_mode |= ALPHA; material->ras_mode |= (mat && (mat->game.alpha_blend & GEMAT_ALPHA_SORT))? ZSORT: 0; diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h index e7b8784a076..45737bd41bc 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.h +++ b/source/gameengine/Converter/BlenderWorldInfo.h @@ -54,22 +54,22 @@ public: ~BlenderWorldInfo(); bool hasWorld(); - bool hasMist(); - float getBackColorRed(); - float getBackColorGreen(); - float getBackColorBlue(); + bool hasMist(); + float getBackColorRed(); + float getBackColorGreen(); + float getBackColorBlue(); float getAmbientColorRed(); float getAmbientColorGreen(); float getAmbientColorBlue(); - float getMistStart(); - float getMistDistance(); - float getMistColorRed(); - float getMistColorGreen(); - float getMistColorBlue(); + float getMistStart(); + float getMistDistance(); + float getMistColorRed(); + float getMistColorGreen(); + float getMistColorBlue(); - void + void setBackColor( float r, float g, diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index b13dbe324f5..4ea77e4349d 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -102,7 +102,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B rotmode = "rotation_axis_angle"; drotmode = "delta_rotation_axis_angle"; break; - case ROT_MODE_QUAT: + case ROT_MODE_QUAT: /* XXX, this isnt working, currently only eulers are supported [#28853] */ rotmode = "rotation_quaternion"; drotmode = "delta_rotation_quaternion"; break; diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index f3233732ee3..f6cd5814e22 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -48,7 +48,7 @@ unsigned int KX_Hash(void * inDWord) key += ~(key << 9); key ^= (key >> 17); - return (unsigned int)(key & 0xffffffff); + return (unsigned int)(key & 0xffffffff); } diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 934f2a8dd87..ade54f6d924 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -487,12 +487,12 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value) static PySequenceMethods listvalue_as_sequence = { listvalue_bufferlen,//(inquiry)buffer_length, /*sq_length*/ listvalue_buffer_concat, /*sq_concat*/ - NULL, /*sq_repeat*/ + NULL, /*sq_repeat*/ listvalue_buffer_item, /*sq_item*/ // TODO, slicing in py3 NULL, // listvalue_buffer_slice, /*sq_slice*/ - NULL, /*sq_ass_item*/ - NULL, /*sq_ass_slice*/ + NULL, /*sq_ass_item*/ + NULL, /*sq_ass_slice*/ (objobjproc)listvalue_buffer_contains, /* sq_contains */ (binaryfunc) NULL, /* sq_inplace_concat */ (ssizeargfunc) NULL, /* sq_inplace_repeat */ @@ -515,12 +515,12 @@ PyTypeObject CListValue::Type = { sizeof(PyObjectPlus_Proxy), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ - py_base_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ + py_base_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ - py_base_repr, /*tp_repr*/ + 0, /*tp_compare*/ + py_base_repr, /*tp_repr*/ 0, /*tp_as_number*/ &listvalue_as_sequence, /*tp_as_sequence*/ &instance_as_mapping, /*tp_as_mapping*/ diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 080e7196d5a..dd4c9a880fd 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -215,7 +215,7 @@ typedef struct PyObjectPlus_Proxy { if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \ return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \ }; \ - static const char method_name##_doc[]; \ + static const char method_name##_doc[]; \ #define KX_PYMETHOD_DOC_VARARGS(class_name, method_name) \ PyObject* Py##method_name(PyObject* args); \ @@ -223,7 +223,7 @@ typedef struct PyObjectPlus_Proxy { if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \ return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \ }; \ - static const char method_name##_doc[]; \ + static const char method_name##_doc[]; \ #define KX_PYMETHOD_DOC_O(class_name, method_name) \ PyObject* Py##method_name(PyObject* value); \ @@ -231,7 +231,7 @@ typedef struct PyObjectPlus_Proxy { if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \ return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \ }; \ - static const char method_name##_doc[]; \ + static const char method_name##_doc[]; \ #define KX_PYMETHOD_DOC_NOARGS(class_name, method_name) \ PyObject* Py##method_name(); \ @@ -239,7 +239,7 @@ typedef struct PyObjectPlus_Proxy { if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \ return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \ }; \ - static const char method_name##_doc[]; \ + static const char method_name##_doc[]; \ /* The line above should remain empty */ @@ -563,7 +563,7 @@ public: /** enable/disable display of deprecation warnings */ static void SetDeprecationWarnings(bool ignoreDeprecationWarnings); - /** Shows a deprecation warning */ + /** Shows a deprecation warning */ static void ShowDeprecationWarning_func(const char* method,const char* prop); static void ClearDeprecationWarning(); diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp index 7c1824cd4eb..33d7ec5b4fc 100644 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp +++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp @@ -134,7 +134,7 @@ PyTypeObject SCA_2DFilterActuator::Type = { PyMethodDef SCA_2DFilterActuator::Methods[] = { /* add python functions to deal with m_msg... */ - {NULL,NULL} + {NULL,NULL} }; PyAttributeDef SCA_2DFilterActuator::Attributes[] = { diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h index 82c82ac3be5..01396839291 100644 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h +++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.h @@ -38,7 +38,7 @@ class SCA_2DFilterActuator : public SCA_IActuator { - Py_Header; + Py_Header; private: vector<STR_String> m_propNames; diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index 19633c2e09d..b61e4f4edca 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -83,8 +83,8 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime) SCA_Joystick *SCA_JoystickManager::GetJoystickDevice( short int joyindex) { - /* - *Return the instance of SCA_Joystick for use - */ + /* + *Return the instance of SCA_Joystick for use + */ return m_joystick[joyindex]; } diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index b452bb97cde..479cf3fd7cc 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -79,7 +79,7 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 726a1d4119a..f5bd3a91c26 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -999,7 +999,7 @@ int main(int argc, char** argv) RNA_exit(); BLF_exit(); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL BLF_free_unifont(); #endif diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 57c1122c2cd..9fb0f053ed8 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -52,6 +52,6 @@ if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib (libname='ge_player_ghost', sources=source_files, includes = incs, defines = defs, libtype=['player'],priority=[0], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index ebb291b2284..7df08b83d49 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -253,7 +253,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) /* ... set up some parameters ... */ /* missing here: the 'floorloc' of the actor's shadow */ - mindistsq= m_minHeight*m_minHeight; + mindistsq= m_minHeight*m_minHeight; maxdistsq= m_maxHeight*m_maxHeight; /* C1: not checked... is a future option */ diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index f0ea6f15ffe..48ad99ae37b 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -231,26 +231,12 @@ void KX_Dome::CalculateImageSize(void) - reduce the buffer for better performace - create a power of 2 texture bigger than the buffer */ -/* -Blender handles Canvas size differently when in fullscreen mode. -We are manually checking for that. Although it's a hack, it works. - -Bug reported here: #18655 - Inconsistency of pixels in canvas dimensions when in maximized mode (affecting BGE Dome) -http://projects.blender.org/tracker/?func=detail&aid=18655&group_id=9&atid=125 -*/ - canvaswidth = m_canvas->GetWidth(); canvasheight = m_canvas->GetHeight(); - bool fullscreen(false); //XXX HACK - fullscreen = (canvaswidth != m_viewport.GetWidth()); - m_buffersize = (canvaswidth > canvasheight?canvasheight:canvaswidth); m_buffersize = (int)(m_buffersize*m_resbuffer); //reduce buffer size for better performance - if (fullscreen) //XXX HACK - m_buffersize --; - int i = 0; while ((1 << i) <= m_buffersize) i++; @@ -266,10 +252,6 @@ http://projects.blender.org/tracker/?func=detail&aid=18655&group_id=9&atid=125 warp.bufferwidth = canvaswidth; warp.bufferheight = canvasheight; } - - //XXX HACK - canvaswidth = m_viewport.GetWidth(); - canvasheight = m_viewport.GetHeight(); } bool KX_Dome::CreateDL(){ diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h index 844f40f0578..009fb0b92ea 100644 --- a/source/gameengine/Ketsji/KX_Dome.h +++ b/source/gameengine/Ketsji/KX_Dome.h @@ -57,22 +57,21 @@ class KX_Dome { public: /// constructor - KX_Dome ( - RAS_ICanvas* m_canvas, - /// rasterizer - RAS_IRasterizer* m_rasterizer, - /// render tools - RAS_IRenderTools* m_rendertools, - /// engine - KX_KetsjiEngine* m_engine, - - short res, - short mode, - short angle, - float resbuf, - short tilt, - struct Text* warptext - ); + KX_Dome (RAS_ICanvas* m_canvas, + /// rasterizer + RAS_IRasterizer* m_rasterizer, + /// render tools + RAS_IRenderTools* m_rendertools, + /// engine + KX_KetsjiEngine* m_engine, + + short res, + short mode, + short angle, + float resbuf, + short tilt, + struct Text* warptext + ); /// destructor virtual ~KX_Dome (void); @@ -180,14 +179,14 @@ protected: /// rendered scene KX_Scene * m_scene; - /// canvas - RAS_ICanvas* m_canvas; - /// rasterizer - RAS_IRasterizer* m_rasterizer; - /// render tools - RAS_IRenderTools* m_rendertools; - /// engine - KX_KetsjiEngine* m_engine; + /// canvas + RAS_ICanvas* m_canvas; + /// rasterizer + RAS_IRasterizer* m_rasterizer; + /// render tools + RAS_IRenderTools* m_rendertools; + /// engine + KX_KetsjiEngine* m_engine; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 853b36b54f7..e5e9c3330e5 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -110,9 +110,9 @@ KX_GameObject::KX_GameObject( m_pGraphicController(NULL), m_xray(false), m_pHitObject(NULL), + m_pObstacleSimulation(NULL), m_actionManager(NULL), - m_isDeformable(false), - m_pObstacleSimulation(NULL) + m_isDeformable(false) #ifdef WITH_PYTHON , m_attr_dict(NULL) #endif diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index acd25ace04a..8e6126bb173 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -765,12 +765,12 @@ else m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_ACTUATOR); scene->UpdateParents(m_clockTime); - - scene->setSuspendedTime(0.0); + + scene->setSuspendedTime(0.0); } // suspended - else - if(scene->getSuspendedTime()==0.0) - scene->setSuspendedTime(m_clockTime); + else + if(scene->getSuspendedTime()==0.0) + scene->setSuspendedTime(m_clockTime); m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); } diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h index 73c5d94e4a5..07787665b1d 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h @@ -140,7 +140,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor */ bool m_positive_event; - /** + /** * Tests whether the object is in mouse focus for this camera */ bool ParentObjectHasFocusCamera(KX_Camera *cam); diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index 5747d8641d0..0ee1ca20234 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -518,7 +518,7 @@ void KX_NavMeshObject::DrawNavMesh(NavMeshRenderMode renderMode) else v = m_navMesh->getDetailVertex(pd->vbase+(t[k]-p->nv)); float pos[3]; - vcopy(pos, v); + rcVcopy(pos, v); flipAxes(pos); tri[k].setValue(pos); } diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index 913a1adac55..eca4d45e9c6 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -49,8 +49,8 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr, float resetmargin, bool bFindMaterial, const STR_String& touchedpropname, - PHY_IPhysicsController* ctrl) - :KX_TouchSensor(eventmgr, + PHY_IPhysicsController* ctrl) + :KX_TouchSensor(eventmgr, gameobj, bFindMaterial, false, diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h index 0737535b84c..3ba257b4f05 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ b/source/gameengine/Ketsji/KX_ObjectActuator.h @@ -100,7 +100,7 @@ class KX_ObjectActuator : public SCA_IActuator // used in servo control MT_Vector3 m_previous_error; MT_Vector3 m_error_accumulator; - KX_LocalFlags m_bitLocalFlag; + KX_LocalFlags m_bitLocalFlag; KX_GameObject* m_reference; // A hack bool -- oh no sorry everyone // This bool is used to check if we have informed diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp index 5f78d9a3722..c2b53fb71ba 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp @@ -633,7 +633,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM const float ivmax = 1.0f / vmax; - float adir[2], adist; + float adir[2] /*, adist */; vcpy(adir, activeObst->pvel); if (vlen(adir) > 0.01f) vnorm(adir); @@ -641,7 +641,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM vset(adir,0,0); float activeObstPos[2]; vset(activeObstPos, activeObst->m_pos.x(), activeObst->m_pos.y()); - adist = vdot(adir, activeObstPos); + /* adist = vdot(adir, activeObstPos); */ float minPenalty = FLT_MAX; diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.h b/source/gameengine/Ketsji/KX_OrientationInterpolator.h index 2ae7b00cb86..8bbe888f74f 100644 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.h +++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.h @@ -41,12 +41,12 @@ class KX_IScalarInterpolator; class KX_OrientationInterpolator : public KX_IInterpolator { public: - KX_OrientationInterpolator(MT_Matrix3x3& target, - KX_IScalarInterpolator **ipos) - : m_target(target) - { - m_ipos[0] = ipos[0]; - m_ipos[1] = ipos[1]; + KX_OrientationInterpolator(MT_Matrix3x3& target, + KX_IScalarInterpolator **ipos) + : m_target(target) + { + m_ipos[0] = ipos[0]; + m_ipos[1] = ipos[1]; m_ipos[2] = ipos[2]; } diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h index a850cc72eb9..6984465623d 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.h +++ b/source/gameengine/Ketsji/KX_ParentActuator.h @@ -56,8 +56,8 @@ class KX_ParentActuator : public SCA_IActuator - public: - enum KX_PARENTACT_MODE +public: + enum KX_PARENTACT_MODE { KX_PARENT_NODEF = 0, KX_PARENT_SET, @@ -65,7 +65,7 @@ class KX_ParentActuator : public SCA_IActuator KX_PARENT_MAX }; - + KX_ParentActuator(class SCA_IObject* gameobj, int mode, bool addToCompound, diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 04a53fbb493..729376f0a24 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -375,9 +375,9 @@ static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self) return (PyObject *)self; } else { return KX_PythonSeq_CreatePyObject(self->base, self->type); - } - } - + } +} + /* * Return next KX_PythonSeq iter. diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h index 04b2c00f4c1..ecae0eba6cd 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h @@ -50,10 +50,10 @@ class KX_SCA_DynamicActuator : public SCA_IActuator float m_setmass; public: KX_SCA_DynamicActuator( - SCA_IObject* gameobj, - short dyn_operation, - float setmass - ); + SCA_IObject* gameobj, + short dyn_operation, + float setmass + ); ~KX_SCA_DynamicActuator( ); diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp index a0a2e148c1e..f998da18f83 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp +++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp @@ -46,38 +46,38 @@ /* ------------------------------------------------------------------------- */ KX_SteeringActuator::KX_SteeringActuator(SCA_IObject *gameobj, - int mode, - KX_GameObject *target, - KX_GameObject *navmesh, - float distance, - float velocity, - float acceleration, - float turnspeed, - bool isSelfTerminated, - int pathUpdatePeriod, - KX_ObstacleSimulation* simulation, - short facingmode, - bool normalup, - bool enableVisualization) : - SCA_IActuator(gameobj, KX_ACT_STEERING), - m_mode(mode), - m_target(target), - m_distance(distance), - m_velocity(velocity), - m_acceleration(acceleration), - m_turnspeed(turnspeed), - m_isSelfTerminated(isSelfTerminated), - m_pathUpdatePeriod(pathUpdatePeriod), - m_updateTime(0), - m_isActive(false), - m_simulation(simulation), - m_enableVisualization(enableVisualization), - m_facingMode(facingmode), - m_normalUp(normalup), - m_obstacle(NULL), - m_pathLen(0), - m_wayPointIdx(-1), - m_steerVec(MT_Vector3(0, 0, 0)) + int mode, + KX_GameObject *target, + KX_GameObject *navmesh, + float distance, + float velocity, + float acceleration, + float turnspeed, + bool isSelfTerminated, + int pathUpdatePeriod, + KX_ObstacleSimulation* simulation, + short facingmode, + bool normalup, + bool enableVisualization) + : SCA_IActuator(gameobj, KX_ACT_STEERING), + m_target(target), + m_mode(mode), + m_distance(distance), + m_velocity(velocity), + m_acceleration(acceleration), + m_turnspeed(turnspeed), + m_simulation(simulation), + m_updateTime(0), + m_obstacle(NULL), + m_isActive(false), + m_isSelfTerminated(isSelfTerminated), + m_enableVisualization(enableVisualization), + m_facingMode(facingmode), + m_normalUp(normalup), + m_pathLen(0), + m_pathUpdatePeriod(pathUpdatePeriod), + m_wayPointIdx(-1), + m_steerVec(MT_Vector3(0, 0, 0)) { m_navmesh = static_cast<KX_NavMeshObject*>(navmesh); if (m_navmesh) @@ -325,9 +325,9 @@ inline float vdot2(const float* a, const float* b) static bool barDistSqPointToTri(const float* p, const float* a, const float* b, const float* c) { float v0[3], v1[3], v2[3]; - vsub(v0, c,a); - vsub(v1, b,a); - vsub(v2, p,a); + rcVsub(v0, c,a); + rcVsub(v1, b,a); + rcVsub(v2, p,a); const float dot00 = vdot2(v0, v0); const float dot01 = vdot2(v0, v1); diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.h b/source/gameengine/Ketsji/KX_SteeringActuator.h index 4f8303107f7..d337799976b 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.h +++ b/source/gameengine/Ketsji/KX_SteeringActuator.h @@ -56,12 +56,12 @@ class KX_SteeringActuator : public SCA_IActuator int m_mode; float m_distance; float m_velocity; - float m_acceleration; + float m_acceleration; float m_turnspeed; KX_ObstacleSimulation* m_simulation; - KX_Obstacle* m_obstacle; double m_updateTime; + KX_Obstacle* m_obstacle; bool m_isActive; bool m_isSelfTerminated; bool m_enableVisualization; diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index 5589d35f44a..e92351ad110 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -436,10 +436,14 @@ KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex) : m_vertex(vertex), m_mesh(mesh) { + /* see bug [#27071] */ + Py_INCREF(m_mesh->GetProxy()); } KX_VertexProxy::~KX_VertexProxy() { + /* see bug [#27071] */ + Py_DECREF(m_mesh->GetProxy()); } diff --git a/source/gameengine/Network/NG_NetworkMessage.h b/source/gameengine/Network/NG_NetworkMessage.h index 0163e18fde7..0b3918773e2 100644 --- a/source/gameengine/Network/NG_NetworkMessage.h +++ b/source/gameengine/Network/NG_NetworkMessage.h @@ -72,7 +72,7 @@ public: { if (! --m_refcount) { - delete this; + delete this; } } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index c34a00513bf..1eed0665564 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -66,7 +66,7 @@ protected: btIDebugDraw* m_debugDrawer; class btDefaultCollisionConfiguration* m_collisionConfiguration; - class btBroadphaseInterface* m_broadphase; // broadphase for dynamic world + class btBroadphaseInterface* m_broadphase; // broadphase for dynamic world // for culling only btOverlappingPairCache* m_cullingCache; struct btDbvtBroadphase* m_cullingTree; // broadphase for culling diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 2988aa4effb..478aa0ab03c 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -207,7 +207,7 @@ public: * @return true if stereo mode is enabled. */ virtual bool Stereo()=0; - virtual StereoMode GetStereoMode()=0; + virtual StereoMode GetStereoMode()=0; virtual bool InterlacedStereo()=0; /** * Sets which eye buffer subsequent primitives will be rendered to. diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h index 422d6dfa1b3..baf3d9c1166 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h @@ -39,7 +39,7 @@ void main(void) { vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114)); - gl_FragColor = vec4(gray, gray, gray, texcolor.a); + gl_FragColor = vec4(gray, gray, gray, texcolor.a); } ); #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h index 475f3506c2c..7df271c15e4 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h @@ -37,9 +37,9 @@ uniform sampler2D bgl_RenderedTexture; void main(void) { - vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); + vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); gl_FragColor.rgb = 1.0 - texcolor.rgb; - gl_FragColor.a = texcolor.a; + gl_FragColor.a = texcolor.a; } ); #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index cbfa49510a5..c28db2fd91c 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -149,7 +149,7 @@ public: virtual void SetRenderArea(); virtual void SetStereoMode(const StereoMode stereomode); - virtual RAS_IRasterizer::StereoMode GetStereoMode(); + virtual RAS_IRasterizer::StereoMode GetStereoMode(); virtual bool Stereo(); virtual bool InterlacedStereo(); virtual void SetEye(const StereoEye eye); diff --git a/source/gameengine/SceneGraph/SG_DList.h b/source/gameengine/SceneGraph/SG_DList.h index 9e7e514b27a..3fb4eb7b55b 100644 --- a/source/gameengine/SceneGraph/SG_DList.h +++ b/source/gameengine/SceneGraph/SG_DList.h @@ -245,10 +245,10 @@ public: } } virtual ~SG_DListHead() {} - T* Remove() - { + T* Remove() + { return static_cast<T*>(SG_DList::Remove()); - } + } }; diff --git a/source/gameengine/SceneGraph/SG_Node.cpp b/source/gameengine/SceneGraph/SG_Node.cpp index 01ada4ea473..c39904bf742 100644 --- a/source/gameengine/SceneGraph/SG_Node.cpp +++ b/source/gameengine/SceneGraph/SG_Node.cpp @@ -128,9 +128,9 @@ Destruct() // We'll delete m_parent_relation now anyway. delete(m_parent_relation); - m_parent_relation = NULL; + m_parent_relation = NULL; - if (m_children.begin() != m_children.end()) + if (m_children.begin() != m_children.end()) { NodeList::iterator childit; for (childit = m_children.begin();childit!=m_children.end();++childit) diff --git a/source/gameengine/VideoTexture/ImageRender.h b/source/gameengine/VideoTexture/ImageRender.h index 1101fbbc2d4..4dfd701ac3d 100644 --- a/source/gameengine/VideoTexture/ImageRender.h +++ b/source/gameengine/VideoTexture/ImageRender.h @@ -52,42 +52,42 @@ public: virtual ~ImageRender (void); /// get background color - int getBackground (int idx) { return (idx < 0 || idx > 3) ? 0 : int(m_background[idx]*255.f); } + int getBackground (int idx) { return (idx < 0 || idx > 3) ? 0 : int(m_background[idx]*255.f); } /// set background color void setBackground (int red, int green, int blue, int alpha); /// clipping distance float getClip (void) { return m_clip; } /// set whole buffer use - void setClip (float clip) { m_clip = clip; } + void setClip (float clip) { m_clip = clip; } protected: - /// true if ready to render - bool m_render; + /// true if ready to render + bool m_render; /// rendered scene KX_Scene * m_scene; /// camera for render KX_Camera * m_camera; - /// do we own the camera? - bool m_owncamera; - /// for mirror operation - KX_GameObject * m_observer; - KX_GameObject * m_mirror; + /// do we own the camera? + bool m_owncamera; + /// for mirror operation + KX_GameObject * m_observer; + KX_GameObject * m_mirror; float m_clip; // clipping distance - float m_mirrorHalfWidth; // mirror width in mirror space - float m_mirrorHalfHeight; // mirror height in mirror space - MT_Point3 m_mirrorPos; // mirror center position in local space - MT_Vector3 m_mirrorZ; // mirror Z axis in local space - MT_Vector3 m_mirrorY; // mirror Y axis in local space - MT_Vector3 m_mirrorX; // mirror X axis in local space - /// canvas - RAS_ICanvas* m_canvas; - /// rasterizer - RAS_IRasterizer* m_rasterizer; - /// render tools - RAS_IRenderTools* m_rendertools; - /// engine - KX_KetsjiEngine* m_engine; + float m_mirrorHalfWidth; // mirror width in mirror space + float m_mirrorHalfHeight; // mirror height in mirror space + MT_Point3 m_mirrorPos; // mirror center position in local space + MT_Vector3 m_mirrorZ; // mirror Z axis in local space + MT_Vector3 m_mirrorY; // mirror Y axis in local space + MT_Vector3 m_mirrorX; // mirror X axis in local space + /// canvas + RAS_ICanvas* m_canvas; + /// rasterizer + RAS_IRasterizer* m_rasterizer; + /// render tools + RAS_IRenderTools* m_rendertools; + /// engine + KX_KetsjiEngine* m_engine; /// background color float m_background[4]; diff --git a/source/gameengine/VideoTexture/ImageViewport.h b/source/gameengine/VideoTexture/ImageViewport.h index 1b415fc58be..70c52b0781c 100644 --- a/source/gameengine/VideoTexture/ImageViewport.h +++ b/source/gameengine/VideoTexture/ImageViewport.h @@ -51,7 +51,7 @@ public: /// is alpha channel used bool getAlpha (void) { return m_alpha; } /// set whole buffer use - void setAlpha (bool alpha) { m_alpha = alpha; } + void setAlpha (bool alpha) { m_alpha = alpha; } /// get capture size in viewport short * getCaptureSize (void) { return m_capSize; } @@ -71,8 +71,8 @@ protected: short m_capSize[2]; /// use whole viewport bool m_whole; - /// use alpha channel - bool m_alpha; + /// use alpha channel + bool m_alpha; /// position of capture rectangle in viewport GLint m_position[2]; diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index 3f802642d33..c5a6831a4cb 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -138,8 +138,30 @@ add_test(import_ply_small_holes ${TEST_BLENDER_EXE} --write-blend=${TEST_OUT_DIR}/import_ply_small_holes.blend ) -# PLY Export tests (TODO) +# PLY Export +add_test(export_ply_cube_all_data ${TEST_BLENDER_EXE} + ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend + --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- + --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_cube_all_data.ply'\) + --md5_source=${TEST_OUT_DIR}/export_ply_cube_all_data.ply + --md5=6adc3748ceae8298496f99d0e7e76c15 --md5_method=FILE +) +add_test(export_ply_suzanne_all_data ${TEST_BLENDER_EXE} + ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend + --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- + --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply'\) + --md5_source=${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply + --md5=68ba23f02efd6511bfd093f45f703221 --md5_method=FILE +) + +add_test(export_ply_vertices ${TEST_BLENDER_EXE} # lame, add a better one + ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend + --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- + --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_vertices.ply'\) + --md5_source=${TEST_OUT_DIR}/export_ply_vertices.ply + --md5=37faba0aa2014451b27f951afa92f870 --md5_method=FILE +) # STL Import tests @@ -164,8 +186,30 @@ add_test(import_stl_knot_max_simplified ${TEST_BLENDER_EXE} --write-blend=${TEST_OUT_DIR}/import_stl_knot_max_simplified.blend ) -# STL Export tests (TODO) +# STL Export +add_test(export_stl_cube_all_data ${TEST_BLENDER_EXE} + ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend + --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- + --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_cube_all_data.stl'\) + --md5_source=${TEST_OUT_DIR}/export_stl_cube_all_data.stl + --md5=64cb97c0cabb015e1c3f76369835075a --md5_method=FILE +) +add_test(export_stl_suzanne_all_data ${TEST_BLENDER_EXE} + ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend + --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- + --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl'\) + --md5_source=${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl + --md5=e9b23c97c139ad64961c635105bb9192 --md5_method=FILE +) + +add_test(export_stl_vertices ${TEST_BLENDER_EXE} # lame, add a better one + ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend + --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- + --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_vertices.stl'\) + --md5_source=${TEST_OUT_DIR}/export_stl_vertices.stl + --md5=3fd3c877e573beeebc782532cc005820 --md5_method=FILE +) # X3D Import @@ -196,7 +240,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=2621d8cc2cc1d34f6711c54519907dac --md5_method=FILE + --md5=05312d278fe41da33560fdfb9bdb268f --md5_method=FILE ) add_test(export_x3d_nurbs ${TEST_BLENDER_EXE} @@ -204,7 +248,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=d56b3736bab063d101d42079bd276f01 --md5_method=FILE + --md5=4286d4a2aa507ef78b22ddcbdcc88481 --md5_method=FILE ) add_test(export_x3d_all_objects ${TEST_BLENDER_EXE} @@ -212,7 +256,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=0914c9a7fcdbfc5741c1269497e9068b --md5_method=FILE + --md5=f5f9fa4c5619a0eeab66685aafd2f7f0 --md5_method=FILE ) @@ -245,7 +289,7 @@ add_test(export_3ds_cube ${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_cube.3ds',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_3ds_cube.3ds - --md5=0df6cfb130052d01e31ef77d391d4cc0 --md5_method=FILE + --md5=a31f5071b6c6dc7445b9099cdc7f63b3 --md5_method=FILE ) add_test(export_3ds_nurbs ${TEST_BLENDER_EXE} @@ -253,7 +297,7 @@ add_test(export_3ds_nurbs ${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_nurbs.3ds',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_3ds_nurbs.3ds - --md5=ba1a6d43346fee3bcadc7e30e3c95935 --md5_method=FILE + --md5=5bdd21be3c80d814fbc83cb25edb08c2 --md5_method=FILE ) add_test(export_3ds_all_objects ${TEST_BLENDER_EXE} @@ -261,7 +305,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=0940ea889498cd437d503670738639ae --md5_method=FILE + --md5=68447761ab0ca38e1e22e7c177ed48a8 --md5_method=FILE ) @@ -273,7 +317,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=86da2495dffd7c270e682f599be6b3d1 --md5_method=FILE + --md5=59a35577462f95f9a0b4e6035226ce9b --md5_method=FILE ) add_test(export_fbx_nurbs ${TEST_BLENDER_EXE} @@ -281,7 +325,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=88a263ddb5181e6522dc214debb92ced --md5_method=FILE + --md5=d31875f18f613fa0c3b16e978f87f6f8 --md5_method=FILE ) add_test(export_fbx_all_objects ${TEST_BLENDER_EXE} @@ -289,5 +333,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=e6f75fe7de9aa366896456e13eafc76a --md5_method=FILE + --md5=b35eb2a9d0e73762ecae2278c25a38ac --md5_method=FILE ) |