From 8f5112f191e24aac86da7b70f461a50825e764da Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 20 Sep 2011 18:29:19 +0000 Subject: pep8 update & some minor cmake edits. --- source/blender/editors/space_logic/CMakeLists.txt | 2 +- source/tests/bl_load_py_modules.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index f4bb255e11f..c4f9f49c9a1 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -21,11 +21,11 @@ set(INC ../include + ../interface ../../blenfont ../../blenkernel ../../blenlib ../../blenloader - ../../editors/interface ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/tests/bl_load_py_modules.py b/source/tests/bl_load_py_modules.py index a88edd5f1fe..619cad67cb8 100644 --- a/source/tests/bl_load_py_modules.py +++ b/source/tests/bl_load_py_modules.py @@ -25,7 +25,6 @@ import addon_utils import sys import os -import imp def source_list(path, filename_check=None): -- cgit v1.2.3 From c5d286f1cb2fd05c02f1da426d4c51e0f9e258d9 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 21 Sep 2011 08:02:26 +0000 Subject: Minor: Other UI strings typos and tweaks. --- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 6 ++--- source/blender/makesrna/intern/rna_ID.c | 10 ++++---- source/blender/makesrna/intern/rna_action.c | 28 +++++++++++------------ 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'source') diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 61b3a9ca1ca..dd3255e1140 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3179,7 +3179,7 @@ static void UV_OT_cursor_set(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in 0.0-1.0 coordinates", -10.0f, 10.0f); + RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f); } /********************** set tile operator **********************/ diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index d5666d135aa..ae4718d8f56 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -818,7 +818,7 @@ static void correct_uv_aspect(EditMesh *em) static void uv_map_clip_correct_properties(wmOperatorType *ot) { RNA_def_boolean(ot->srna, "correct_aspect", 1, "Correct Aspect", - "Map UV's taking image aspect ratio into account"); + "Map UVs taking image aspect ratio into account"); RNA_def_boolean(ot->srna, "clip_to_bounds", 0, "Clip to Bounds", "Clip UV coordinates to bounds after unwrapping"); RNA_def_boolean(ot->srna, "scale_to_bounds", 0, "Scale to Bounds", @@ -980,11 +980,11 @@ void UV_OT_unwrap(wmOperatorType *ot) /* properties */ RNA_def_enum(ot->srna, "method", method_items, 0, "Method", - "Unwrapping method. Angle Based usually gives better results than Conformal, while being somewhat slower"); + "Unwrapping method (Angle Based usually gives better results than Conformal, while being somewhat slower)"); RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes", "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry"); RNA_def_boolean(ot->srna, "correct_aspect", 1, "Correct Aspect", - "Map UV's taking image aspect ratio into account"); + "Map UVs taking image aspect ratio into account"); } /**************** Project From View operator **************/ diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 5c90c1bce91..bf83d33a0a3 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -460,13 +460,13 @@ static void rna_def_ID(BlenderRNA *brna) prop= RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER); - RNA_def_property_ui_text(prop, "Fake User", "Saves this datablock even if it has no users"); + RNA_def_property_ui_text(prop, "Fake User", "Save this datablock even if it has no users"); RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set"); prop= RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_DOIT); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - RNA_def_property_ui_text(prop, "Tag", "Tools can use this to tag data, (initial state is undefined)"); + RNA_def_property_ui_text(prop, "Tag", "Tools can use this to tag data (initial state is undefined)"); prop= RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "lib"); @@ -480,8 +480,8 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_function_return(func, parm); func= RNA_def_function(srna, "user_clear", "rna_ID_user_clear"); - RNA_def_function_ui_description(func, "Clears the user count of a datablock so its not saved, " - "on reload the data will be removed"); + RNA_def_function_ui_description(func, "Clear the user count of a datablock so its not saved, " + "on reload the data will be removed"); func= RNA_def_function(srna, "animation_data_create", "BKE_id_add_animdata"); RNA_def_function_ui_description(func, "Create animation data to this ID, note that not all ID types support this"); @@ -493,7 +493,7 @@ static void rna_def_ID(BlenderRNA *brna) func= RNA_def_function(srna, "update_tag", "rna_ID_update_tag"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Tag the id to update its display data"); + RNA_def_function_ui_description(func, "Tag the ID to update its display data"); RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform"); } diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 6c193a66490..f0e1b68af71 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -98,13 +98,13 @@ static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const ch if(group && group[0]=='\0') group= NULL; if(data_path[0] == '\0') { - BKE_report(reports, RPT_ERROR, "FCurve data path empty, invalid argument"); + BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument"); return NULL; } /* annoying, check if this exists */ if(verify_fcurve(act, group, data_path, index, 0)) { - BKE_reportf(reports, RPT_ERROR, "FCurve '%s[%d]' already exists in action '%s'", data_path, index, act->id.name+2); + BKE_reportf(reports, RPT_ERROR, "F-Curve '%s[%d]' already exists in action '%s'", data_path, index, act->id.name+2); return NULL; } return verify_fcurve(act, group, data_path, index, 1); @@ -114,7 +114,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * { if (fcu->grp) { if (BLI_findindex(&act->groups, fcu->grp) == -1) { - BKE_reportf(reports, RPT_ERROR, "FCurve's ActionGroup '%s' not found in action '%s'", fcu->grp->name, act->id.name+2); + BKE_reportf(reports, RPT_ERROR, "F-Curve's ActionGroup '%s' not found in action '%s'", fcu->grp->name, act->id.name+2); return; } @@ -123,7 +123,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * } else { if (BLI_findindex(&act->curves, fcu) == -1) { - BKE_reportf(reports, RPT_ERROR, "FCurve not found in action '%s'", act->id.name+2); + BKE_reportf(reports, RPT_ERROR, "F-Curve not found in action '%s'", act->id.name+2); return; } @@ -309,20 +309,20 @@ static void rna_def_dopesheet(BlenderRNA *brna) /* NLA Specific Settings */ prop= RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT); - RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA data. (NLA Editor only)"); + RNA_def_property_ui_text(prop, "Include Missing NLA", "Include Animation Data blocks with no NLA data (NLA Editor only)"); RNA_def_property_ui_icon(prop, ICON_ACTION, 0); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); /* Summary Settings (DopeSheet editors only) */ prop= RNA_def_property(srna, "show_summary", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_SUMMARY); - RNA_def_property_ui_text(prop, "Display Summary", "Display an additional 'summary' line. (DopeSheet Editors only)"); + RNA_def_property_ui_text(prop, "Display Summary", "Display an additional 'summary' line (DopeSheet Editors only)"); RNA_def_property_ui_icon(prop, ICON_BORDERMOVE, 0); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); prop= RNA_def_property(srna, "show_expanded_summary", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED); - RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden. (DopeSheet Editors Only)"); + RNA_def_property_ui_text(prop, "Collapse Summary", "Collapse summary when shown, so all other channels get hidden (DopeSheet Editors Only)"); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); @@ -514,24 +514,24 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_srna(cprop, "ActionFCurves"); srna= RNA_def_struct(brna, "ActionFCurves", NULL); RNA_def_struct_sdna(srna, "bAction"); - RNA_def_struct_ui_text(srna, "Action FCurves", "Collection of action fcurves"); + RNA_def_struct_ui_text(srna, "Action F-Curves", "Collection of action F-Curves"); func= RNA_def_function(srna, "new", "rna_Action_fcurve_new"); - RNA_def_function_ui_description(func, "Add a keyframe to the curve"); + RNA_def_function_ui_description(func, "Add a keyframe to the F-Curve"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "FCurve data path to use"); + parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "F-Curve data path to use"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX); - RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this fcurve into"); + RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this F-Curve into"); - parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created fcurve"); + parm= RNA_def_pointer(func, "fcurve", "F-Curve", "", "Newly created F-Curve"); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_Action_fcurve_remove"); RNA_def_function_ui_description(func, "Remove action group"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "FCurve to remove"); + parm= RNA_def_pointer(func, "fcurve", "F-Curve", "", "F-Curve to remove"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } @@ -605,7 +605,7 @@ static void rna_def_action(BlenderRNA *brna) rna_def_action_pose_markers(brna, prop); /* properties */ - prop= RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" , "The final frame range of all fcurves within this action" , 0 , 0); + prop= RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" , "The final frame range of all F-Curves within this action" , 0 , 0); RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get" , NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); -- cgit v1.2.3 From b4907ced60d518cc55e36715defe6f18ba769c29 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Sep 2011 08:35:07 +0000 Subject: fix breakage in 40417 - test compile please even for doc changes. --- source/blender/makesrna/intern/rna_action.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index f0e1b68af71..434e613359d 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -524,14 +524,14 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX); RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this F-Curve into"); - parm= RNA_def_pointer(func, "fcurve", "F-Curve", "", "Newly created F-Curve"); + parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created F-Curve"); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_Action_fcurve_remove"); RNA_def_function_ui_description(func, "Remove action group"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm= RNA_def_pointer(func, "fcurve", "F-Curve", "", "F-Curve to remove"); + parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "F-Curve to remove"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } -- cgit v1.2.3 From 4b449aefea62999aecd0610e6d7f25e6e927c529 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Sep 2011 08:40:30 +0000 Subject: remove support for irix --- source/blender/blenkernel/BKE_colortools.h | 2 - source/blender/blenlib/intern/path_util.c | 4 +- source/blender/blenlib/intern/storage.c | 6 +- source/blender/blenlib/intern/threads.c | 2 - source/blender/blenloader/BLO_sys_types.h | 4 +- source/blender/editors/screen/glutil.c | 11 --- source/blender/imbuf/intern/anim_movie.c | 104 --------------------- source/blender/nodes/intern/node_util.h | 2 - source/creator/creator.c | 14 +-- .../Converter/BL_ShapeActionActuator.cpp | 4 - source/gameengine/Ketsji/KX_IpoActuator.cpp | 5 - 11 files changed, 9 insertions(+), 149 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 5b40fa5d758..758789683d5 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -41,8 +41,6 @@ struct rctf; #if defined _WIN32 # define DO_INLINE __inline -#elif defined (__sgi) -# define DO_INLINE #elif defined (__sun) || defined (__sun__) # define DO_INLINE #else diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index f89283178ec..0b750d5fff3 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1155,8 +1155,8 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check) void BLI_setenv(const char *env, const char*val) { - /* SGI or free windows */ -#if (defined(__sgi) || ((defined(WIN32) || defined(WIN64)) && defined(FREE_WINDOWS))) + /* free windows */ +#if (defined(WIN32) || defined(WIN64)) && defined(FREE_WINDOWS) char *envstr= MEM_mallocN(sizeof(char) * (strlen(env) + strlen(val) + 2), "envstr"); /* one for = another for \0 */ sprintf(envstr, "%s=%s", env, val); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 67e27063fd0..04a6d15a0ea 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -45,7 +45,7 @@ #include #include -#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__) +#if defined (__sun__) || defined (__sun) || defined (__NetBSD__) #include /* Other modern unix os's should probably use this also */ #elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__)) #include @@ -165,7 +165,7 @@ double BLI_diskfree(const char *dir) return (double) (freec*bytesps*sectorspc); #else -#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__) +#if defined (__sun__) || defined (__sun) || defined (__NetBSD__) struct statvfs disk; #else struct statfs disk; @@ -187,7 +187,7 @@ double BLI_diskfree(const char *dir) if (statfs(name, &disk)) return(-1); #endif -#if defined (__sun__) || defined (__sun) || defined (__sgi) || defined (__NetBSD__) +#if defined (__sun__) || defined (__sun) || defined (__NetBSD__) if (statvfs(name, &disk)) return(-1); #elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__)) /* WARNING - This may not be supported by geeneric unix os's - Campbell */ diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 7b59a7905aa..f9cd675dd8c 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -318,8 +318,6 @@ int BLI_system_thread_count( void ) mib[1] = HW_NCPU; len = sizeof(t); sysctl(mib, 2, &t, &len, NULL, 0); -# elif defined(__sgi) - t = sysconf(_SC_NPROC_ONLN); # else t = (int)sysconf(_SC_NPROCESSORS_ONLN); # endif diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h index 4b3902dca43..8c0996528c6 100644 --- a/source/blender/blenloader/BLO_sys_types.h +++ b/source/blender/blenloader/BLO_sys_types.h @@ -99,7 +99,7 @@ unsigned long __attribute__((__stdcall__)) htonl(unsigned long); #else - /* FreeBSD, Irix, Solaris */ + /* FreeBSD, Solaris */ #include #endif /* ifdef platform for types */ @@ -118,7 +118,7 @@ unsigned long __attribute__((__stdcall__)) htonl(unsigned long); #include #elif defined (__APPLE__) #include -#else /* irix sun linux */ +#else /* sun linux */ #include #endif /* ifdef platform for htonl/ntohl */ diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index f56ae17d366..589d652a275 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -279,18 +279,7 @@ void setlinestyle(int nr) void set_inverted_drawing(int enable) { glLogicOp(enable?GL_INVERT:GL_COPY); - - /* Use GL_BLEND_EQUATION_EXT on sgi (if we have it), - * apparently GL_COLOR_LOGIC_OP doesn't work on O2? - * Is this an sgi bug or our bug? - */ -#if defined(__sgi) && defined(GL_BLEND_EQUATION_EXT) - glBlendEquationEXT(enable?GL_LOGIC_OP:GL_FUNC_ADD_EXT); - glToggle(GL_BLEND, enable); -#else glToggle(GL_COLOR_LOGIC_OP, enable); -#endif - glToggle(GL_DITHER, !enable); } diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index c4fe1523e90..3c3cecc0e96 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -114,109 +114,6 @@ #endif #endif -/****/ - -#ifdef __sgi - -#include - -static void movie_printerror(char * str) { - const char * errstr = mvGetErrorStr(mvGetErrno()); - - if (str) { - if (errstr) printf("%s: %s\n", str, errstr); - else printf("%s: returned error\n", str); - } else printf("%s\n", errstr); -} - -static int startmovie(struct anim * anim) { - if (anim == 0) return(-1); - - if ( mvOpenFile (anim->name, O_BINARY|O_RDONLY, &anim->movie ) != DM_SUCCESS ) { - printf("Can't open movie: %s\n", anim->name); - return(-1); - } - if ( mvFindTrackByMedium (anim->movie, DM_IMAGE, &anim->track) != DM_SUCCESS ) { - printf("No image track in movie: %s\n", anim->name); - mvClose(anim->movie); - return(-1); - } - - anim->duration = mvGetTrackLength (anim->track); - anim->params = mvGetParams( anim->track ); - - anim->x = dmParamsGetInt( anim->params, DM_IMAGE_WIDTH); - anim->y = dmParamsGetInt( anim->params, DM_IMAGE_HEIGHT); - anim->interlacing = dmParamsGetEnum (anim->params, DM_IMAGE_INTERLACING); - anim->orientation = dmParamsGetEnum (anim->params, DM_IMAGE_ORIENTATION); - anim->framesize = dmImageFrameSize(anim->params); - - anim->curposition = 0; - anim->preseek = 0; - - /*printf("x:%d y:%d size:%d interl:%d dur:%d\n", anim->x, anim->y, anim->framesize, anim->interlacing, anim->duration);*/ - return (0); -} - -static ImBuf * movie_fetchibuf(struct anim * anim, int position) { - ImBuf * ibuf; -/* extern rectcpy(); */ - int size; - unsigned int *rect1, *rect2; - - if (anim == 0) return (0); - - ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect); - - if ( mvReadFrames(anim->track, position, 1, ibuf->x * ibuf->y * - sizeof(int), ibuf->rect ) != DM_SUCCESS ) { - movie_printerror("mvReadFrames"); - IMB_freeImBuf(ibuf); - return(0); - } - -/* - if (anim->interlacing == DM_IMAGE_INTERLACED_EVEN) { - rect1 = ibuf->rect + (ibuf->x * ibuf->y) - 1; - rect2 = rect1 - ibuf->x; - - for (size = ibuf->x * (ibuf->y - 1); size > 0; size--){ - *rect1-- = *rect2--; - } - } -*/ - - if (anim->interlacing == DM_IMAGE_INTERLACED_EVEN) - { - rect1 = ibuf->rect; - rect2 = rect1 + ibuf->x; - - for (size = ibuf->x * (ibuf->y - 1); size > 0; size--){ - *rect1++ = *rect2++; - } - } - /*if (anim->orientation == DM_TOP_TO_BOTTOM) IMB_flipy(ibuf);*/ - - - return(ibuf); -} - -static void free_anim_movie(struct anim * anim) { - if (anim == NULL) return; - - if (anim->movie) { - mvClose(anim->movie); - anim->movie = NULL; - } - anim->duration = 0; -} - -int ismovie(char *name) { - return (mvIsMovieFile(name) == DM_TRUE); -} - -#else - int ismovie(const char *UNUSED(name)) { return 0; } @@ -226,7 +123,6 @@ static int startmovie(struct anim *UNUSED(anim)) { return 1; } static ImBuf * movie_fetchibuf(struct anim *UNUSED(anim), int UNUSED(position)) { return NULL; } static void free_anim_movie(struct anim *UNUSED(anim)) { ; } -#endif #if defined(_WIN32) # define PATHSEPERATOR '\\' diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index 8d38d57f577..885c48599f8 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -66,8 +66,6 @@ const char *node_filter_label(struct bNode *node); // this is needed for inlining behaviour #if defined _WIN32 # define DO_INLINE __inline -#elif defined (__sgi) -# define DO_INLINE #elif defined (__sun) || defined (__sun__) # define DO_INLINE #else diff --git a/source/creator/creator.c b/source/creator/creator.c index 91c2d74dc26..56108f6c251 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -46,12 +46,6 @@ #include #include -/* for setuid / getuid */ -#ifdef __sgi -#include -#include -#endif - /* This little block needed for linking to Blender... */ #include "MEM_guardedalloc.h" @@ -156,7 +150,7 @@ char btempdir[FILE_MAX]; static void setCallbacks(void); /* set breakpoints here when running in debug mode, useful to catch floating point errors */ -#if defined(__sgi) || defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) +#if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) static void fpe_handler(int UNUSED(sig)) { // printf("SIGFPE trapped\n"); @@ -365,7 +359,7 @@ static int debug_mode(int UNUSED(argc), const char **UNUSED(argv), void *data) static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) { -#if defined(__sgi) || defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) +#if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) /* zealous but makes float issues a heck of a lot easier to find! * set breakpoints on fpe_handler */ signal(SIGFPE, fpe_handler); @@ -1193,10 +1187,6 @@ int main(int argc, const char **argv) BLI_argsParse(ba, 1, NULL, NULL); -#ifdef __sgi - setuid(getuid()); /* end superuser */ -#endif - #if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS) G.background= 1; /* python module mode ALWAYS runs in background mode (for now) */ #else diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp index ac377cdb7ca..c81ff107a98 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp @@ -32,11 +32,7 @@ */ -#if defined (__sgi) -#include -#else #include -#endif #include "SCA_LogicManager.h" #include "BL_ShapeActionActuator.h" diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index aed6c666404..cc5a8ecc727 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -33,12 +33,7 @@ * \ingroup ketsji */ - -#if defined (__sgi) -#include -#else #include -#endif #include "KX_IpoActuator.h" #include "KX_GameObject.h" -- cgit v1.2.3 From b88fe134f62216d6ade63acec6811ac349db97d6 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 21 Sep 2011 10:24:53 +0000 Subject: Revreting 39792 making paste pose only on selected bones by default. Will contact aligorith anyway for confirmation. --- source/blender/editors/armature/poseobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 4405f395843..43122ea08d3 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1227,8 +1227,8 @@ void POSE_OT_paste (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose"); - RNA_def_boolean(ot->srna, "selected_mask", 1, "On Selected Only", "Only paste the stored pose on to selected bones in the current pose"); + RNA_def_boolean(ot->srna, "flipped", FALSE, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose"); + RNA_def_boolean(ot->srna, "selected_mask", FALSE, "On Selected Only", "Only paste the stored pose on to selected bones in the current pose"); } /* ********************************************** */ -- cgit v1.2.3 From f56759bb208b989749ed3f578a7d8ef4faa394f1 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 21 Sep 2011 13:30:52 +0000 Subject: Fix compilation for MinGW. --- source/blender/blenfont/intern/blf_lang.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 8f745180b8b..c0163be4980 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -115,7 +115,7 @@ void BLF_lang_set(const char *str) char *locreturn; const char *short_locale; int ok= 1; -#if defined (_WIN32) +#if defined (_WIN32) && !defined(FREE_WINDOWS) char *long_locale = locales[ 2 * U.language]; #endif @@ -127,7 +127,7 @@ void BLF_lang_set(const char *str) else short_locale = locales[ 2 * U.language + 1]; -#if defined (_WIN32) +#if defined (_WIN32) && !defined(FREE_WINDOWS) if(short_locale) { char *envStr; -- cgit v1.2.3 From 943a026c6011faa7dbdc1a4c640c2f0f25196d96 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Sep 2011 13:53:35 +0000 Subject: py/rna string subtypes for strings which should be automatically translated: layout.prop("blah", text="Translate Me!") --- source/blender/makesrna/RNA_types.h | 1 + source/blender/makesrna/intern/makesrna.c | 1 + source/blender/makesrna/intern/rna_define.c | 14 ++++++++++++++ source/blender/makesrna/intern/rna_rna.c | 1 + source/blender/makesrna/intern/rna_ui_api.c | 6 +++--- source/blender/python/intern/CMakeLists.txt | 4 ++++ source/blender/python/intern/bpy_props.c | 1 + source/blender/python/intern/bpy_rna.c | 10 ++++++++++ 8 files changed, 35 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 4a18518dde9..8e8a2133b89 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -110,6 +110,7 @@ typedef enum PropertySubType { PROP_FILEPATH = 1, PROP_DIRPATH = 2, PROP_FILENAME = 3, + PROP_TRANSLATE = 4, /* a string which should be translated */ /* numbers */ PROP_UNSIGNED = 13, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 23100fa8bd7..80352d3f03e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1815,6 +1815,7 @@ static const char *rna_property_subtypename(PropertySubType type) case PROP_FILEPATH: return "PROP_FILEPATH"; case PROP_FILENAME: return "PROP_FILENAME"; case PROP_DIRPATH: return "PROP_DIRPATH"; + case PROP_TRANSLATE: return "PROP_TRANSLATE"; case PROP_UNSIGNED: return "PROP_UNSIGNED"; case PROP_PERCENTAGE: return "PROP_PERCENTAGE"; case PROP_FACTOR: return "PROP_FACTOR"; diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 758ddc9ac6a..8af65b97ffc 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -2240,6 +2240,20 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *id return prop; } +PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description) +{ + ContainerRNA *cont= cont_; + PropertyRNA *prop; + + prop= RNA_def_property(cont, identifier, PROP_STRING, PROP_TRANSLATE); + if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen); + if(default_value) RNA_def_property_string_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description) { diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 7f85a2fa1d7..95c6b066510 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -53,6 +53,7 @@ EnumPropertyItem property_subtype_items[] = { {PROP_FILEPATH, "FILEPATH", 0, "File Path", ""}, {PROP_DIRPATH, "DIRPATH", 0, "Directory Path", ""}, {PROP_FILENAME, "FILENAME", 0, "File Name", ""}, + {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, /* numbers */ {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""}, diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 84568d914af..816a7ba9cd4 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -84,7 +84,7 @@ static void api_ui_item_common(FunctionRNA *func) { PropertyRNA *prop; - RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item"); + prop= RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item"); prop= RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, icon_items); @@ -309,7 +309,7 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_string(func, "type_property", "", 0, "", "Identifier of property in data giving the type of the ID-blocks to use"); RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI"); + RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI"); func= RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder"); parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); @@ -318,7 +318,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from"); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); - RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI"); + RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI"); func= RNA_def_function(srna, "template_modifier", "uiTemplateModifier"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index acdee5328e7..e628ea10e9c 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -95,4 +95,8 @@ if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DINTERNATIONAL) +endif() + blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 5da142aeea7..a3d5bc99ad8 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -72,6 +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_NONE, "NONE", 0, "None", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index a63cee4e505..013eac7fd58 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -73,6 +73,10 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" +#ifdef INTERNATIONAL +#include "UI_interface.h" /* bad level call into editors */ +#endif + #define USE_PEDANTIC_WRITE #define USE_MATHUTILS #define USE_STRING_COERCE @@ -1519,6 +1523,12 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { param= _PyUnicode_AsString(value); +#ifdef INTERNATIONAL + if(subtype == PROP_TRANSLATE) { + param= UI_translate_do_iface(param); + } +#endif // INTERNATIONAL + } #else // USE_STRING_COERCE param= _PyUnicode_AsString(value); -- cgit v1.2.3 From c589dec2ea3a9ef794c31e079a2010f2c4841a42 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Sep 2011 14:10:26 +0000 Subject: add missing define for last commit and tag bl_label & bl_descriptions for translating too --- source/blender/makesrna/RNA_define.h | 1 + source/blender/makesrna/intern/rna_animation.c | 2 +- source/blender/makesrna/intern/rna_render.c | 2 +- source/blender/makesrna/intern/rna_ui.c | 4 ++-- source/blender/makesrna/intern/rna_wm.c | 8 ++++---- 5 files changed, 9 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index ac2a89161d9..e003b7198b8 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -86,6 +86,7 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont, const char *identifier, c PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description); PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description); PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 702529fde53..0a47c98aebb 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -489,7 +489,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); /* Name */ - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 8c9f8c08a47..1003c9bfba2 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -286,7 +286,7 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_flag(prop, PROP_REGISTER); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 52c359d79dd..587e56443ff 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_NONE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", @@ -785,7 +785,7 @@ static void rna_def_menu(BlenderRNA *brna) "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_MT_hello\""); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); 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_wm.c b/source/blender/makesrna/intern/rna_wm.c index 606355c4fb6..c6805206051 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1188,14 +1188,14 @@ 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_NONE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); 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"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); - prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); @@ -1249,14 +1249,14 @@ static void rna_def_macro_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_NONE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); 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"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); - prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); + prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set"); -- cgit v1.2.3 From 2dbfa5a3e4b54d59a6e71b01f8f4cebf1c220af7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 21 Sep 2011 15:07:19 +0000 Subject: Attempt to fix #28709: change language to simplified Chinese: sequencer -> add image strip crashes Blender Crash was caused by sprintf which tried to parse bytes sequence belongs to chinese letter. Using codepage 1252 for LC_ALL seems to fix this issue, but needs further testing. --- source/blender/blenfont/intern/blf_lang.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index c0163be4980..b0b06bf059b 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -81,8 +81,8 @@ static const char *locales[] = { "catalan", "ca_AD", "czech", "cs_CZ", "ptb", "pt_BR", - "chs", "zh_CN", - "cht", "zh_TW", + "Chinese (Simplified)_China.1252", "zh_CN", + "Chinese (Traditional)_China.1252", "zh_TW", "russian", "ru_RU", "croatian", "hr_HR", "serbian", "sr_RS", -- cgit v1.2.3 From a12e06dc3591bc1e95372e08a08cf85fb53960e1 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Sep 2011 15:14:47 +0000 Subject: Blenfont: add BLF_unload function to unload/reload fonts. --- source/blender/blenfont/BLF_api.h | 2 ++ source/blender/blenfont/intern/blf.c | 68 ++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 23 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 1bb61d02b78..038f0c433c7 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -47,6 +47,8 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size); int BLF_load_unique(const char *name); int BLF_load_mem_unique(const char *name, unsigned char *mem, int mem_size); +void BLF_unload(const char *name); + /* Attach a file with metrics information from memory. */ void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index cccecd00bf7..ec0605236dd 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -61,10 +61,7 @@ #define BLF_MAX_FONT 16 /* Font array. */ -static FontBLF *global_font[BLF_MAX_FONT]; - -/* Number of font. */ -static int global_font_num= 0; +static FontBLF *global_font[BLF_MAX_FONT] = {0}; /* Default size and dpi, for BLF_draw_default. */ static int global_font_default= -1; @@ -99,10 +96,12 @@ void BLF_exit(void) FontBLF *font; int i; - for (i= 0; i < global_font_num; i++) { + for (i= 0; i < BLF_MAX_FONT; i++) { font= global_font[i]; - if (font) + if (font) { blf_font_free(font); + global_font[i]= NULL; + } } blf_font_exit(); @@ -113,7 +112,7 @@ void BLF_cache_clear(void) FontBLF *font; int i; - for (i= 0; i < global_font_num; i++) { + for (i= 0; i < BLF_MAX_FONT; i++) { font= global_font[i]; if (font) blf_glyph_cache_clear(font); @@ -130,6 +129,18 @@ static int blf_search(const char *name) if (font && (!strcmp(font->name, name))) return i; } + + return -1; +} + +static int blf_search_available(void) +{ + int i; + + for (i= 0; i < BLF_MAX_FONT; i++) + if(!global_font[i]) + return i; + return -1; } @@ -149,7 +160,8 @@ int BLF_load(const char *name) return i; } - if (global_font_num+1 >= BLF_MAX_FONT) { + i = blf_search_available(); + if (i == -1) { printf("Too many fonts!!!\n"); return -1; } @@ -168,9 +180,7 @@ int BLF_load(const char *name) return -1; } - global_font[global_font_num]= font; - i= global_font_num; - global_font_num++; + global_font[i]= font; return i; } @@ -186,7 +196,8 @@ int BLF_load_unique(const char *name) /* Don't search in the cache!! make a new * object font, this is for keep fonts threads safe. */ - if (global_font_num+1 >= BLF_MAX_FONT) { + i = blf_search_available(); + if (i == -1) { printf("Too many fonts!!!\n"); return -1; } @@ -205,9 +216,7 @@ int BLF_load_unique(const char *name) return -1; } - global_font[global_font_num]= font; - i= global_font_num; - global_font_num++; + global_font[i]= font; return i; } @@ -234,7 +243,8 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size) return i; } - if (global_font_num+1 >= BLF_MAX_FONT) { + i = blf_search_available(); + if (i == -1) { printf("Too many fonts!!!\n"); return -1; } @@ -250,9 +260,7 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size) return -1; } - global_font[global_font_num]= font; - i= global_font_num; - global_font_num++; + global_font[i]= font; return i; } @@ -268,7 +276,8 @@ int BLF_load_mem_unique(const char *name, unsigned char *mem, int mem_size) * Don't search in the cache, make a new object font! * this is to keep the font thread safe. */ - if (global_font_num+1 >= BLF_MAX_FONT) { + i = blf_search_available(); + if (i == -1) { printf("Too many fonts!!!\n"); return -1; } @@ -284,12 +293,25 @@ int BLF_load_mem_unique(const char *name, unsigned char *mem, int mem_size) return -1; } - global_font[global_font_num]= font; - i= global_font_num; - global_font_num++; + global_font[i]= font; return i; } +void BLF_unload(const char *name) +{ + FontBLF *font; + int i; + + for (i= 0; i < BLF_MAX_FONT; i++) { + font= global_font[i]; + + if (font && (!strcmp(font->name, name))) { + blf_font_free(font); + global_font[i]= NULL; + } + } +} + void BLF_enable(int fontid, int option) { FontBLF *font= BLF_get(fontid); -- cgit v1.2.3 From ae0124157f012aeda994534c21aebda1bae054cd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Sep 2011 15:15:30 +0000 Subject: Translation: reload font on enabling/disabling use international fonts. --- source/blender/editors/include/UI_interface.h | 1 + source/blender/editors/interface/interface.c | 5 ++++ source/blender/editors/interface/interface_style.c | 29 ++++++++++++++++------ .../editors/interface/interface_templates.c | 2 +- source/blender/editors/space_node/drawnode.c | 4 +-- source/blender/makesrna/intern/rna_userdef.c | 4 +++ source/blenderplayer/bad_level_call_stubs/stubs.c | 1 + 7 files changed, 36 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 06b44e36b69..f5abebbebd5 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -610,6 +610,7 @@ void UI_remove_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *pop void UI_init(void); void UI_init_userdef(void); +void UI_reinit_font(void); void UI_exit(void); /* Layout diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 2ff77d255c6..7dac8c6351a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3552,6 +3552,11 @@ void UI_init_userdef(void) uiStyleInit(); } +void UI_reinit_font() +{ + uiStyleInit(); +} + void UI_exit(void) { ui_resources_free(); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 5ea20b33b3a..3a9879384a3 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -323,13 +323,28 @@ void uiStyleInit(void) if(font->uifont_id==UIFONT_DEFAULT) { #ifdef INTERNATIONAL - int unifont_size; - unsigned char *unifont_ttf= BLF_get_unifont(&unifont_size); - - if(unifont_ttf) - font->blf_id= BLF_load_mem_unique("default", unifont_ttf, unifont_size); - else - font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); + int font_size= datatoc_bfont_ttf_size; + unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf; + static int last_font_size = 0; + + /* use unicode font for translation */ + if(U.transopts & USER_DOTRANSLATE) { + font_ttf= BLF_get_unifont(&font_size); + + if(!font_ttf) { + /* fall back if not found */ + font_size= datatoc_bfont_ttf_size; + font_ttf= (unsigned char*)datatoc_bfont_ttf; + } + } + + /* relload only if needed */ + if(last_font_size != font_size) { + BLF_unload("default"); + last_font_size = font_size; + } + + font->blf_id= BLF_load_mem("default", font_ttf, font_size); #else font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); #endif diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index af515bf8061..bec9e6a7664 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2488,7 +2488,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiLayout *ui_abs; uiBlock *block; uiBut *but; - uiStyle *style= U.uistyles.first; + uiStyle *style= UI_GetStyle(); int width; int icon=0; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index f34cef4d2aa..970eccb8be3 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -129,7 +129,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v) block= uiBeginBlock(C, ar, "socket menu", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN); - layout= uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y+2, args->width, NODE_DY, U.uistyles.first), 0); + layout= uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y+2, args->width, NODE_DY, UI_GetStyle()), 0); uiItemR(layout, &args->ptr, "default_value", UI_ITEM_R_EXPAND, "", ICON_NONE); @@ -788,7 +788,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColor(TH_TEXT_HI); layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (short)(rect.xmin+15), (short)(rect.ymax+group_header), - MIN2((int)(rect.xmax - rect.xmin-18.0f), node_group_frame+20), group_header, U.uistyles.first); + MIN2((int)(rect.xmax - rect.xmin-18.0f), node_group_frame+20), group_header, UI_GetStyle()); RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr); uiTemplateIDBrowse(layout, (bContext*)C, &ptr, "node_tree", NULL, NULL, NULL); uiBlockLayoutResolve(gnode->block, NULL, NULL); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index b9a53acd6f4..44d645f970f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -65,6 +65,8 @@ #include "MEM_guardedalloc.h" #include "MEM_CacheLimiterC-Api.h" +#include "UI_interface.h" + static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { WM_main_add_notifier(NC_WINDOW, NULL); @@ -79,7 +81,9 @@ static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { + BLF_cache_clear(); BLF_lang_set(NULL); + UI_reinit_font(); } static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index a75668280cd..c3d389932d1 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -340,6 +340,7 @@ void uiItemS(struct uiLayout *layout){} void uiItemFullR(struct uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, char *name, int icon){} void uiLayoutSetContextPointer(struct uiLayout *layout, char *name, struct PointerRNA *ptr){} char *uiLayoutIntrospect(struct uiLayout *layout){return (char *)NULL;} +void UI_reinit_font() {} /* rna template */ void uiTemplateAnyID(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, char *text){} -- cgit v1.2.3 From 280684c35d6fcf213b0ea240064b2c4efcb90661 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Sep 2011 16:06:47 +0000 Subject: remove blf.gettext, add blf.unload(font) --- source/blender/python/generic/blf_py_api.c | 45 ++++++++++-------------------- 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'source') diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 87e4a301eff..b16efdf5a3d 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -31,15 +31,9 @@ #include "blf_py_api.h" #include "../../blenfont/BLF_api.h" -#include "../../blenfont/BLF_translation.h" #include "BLI_utildefines.h" -#ifdef INTERNATIONAL -#include "DNA_userdef_types.h" /* is it bad level? */ -#endif - - PyDoc_STRVAR(py_blf_position_doc, ".. function:: position(fontid, x, y, z)\n" "\n" @@ -371,33 +365,24 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) return PyLong_FromLong(BLF_load(filename)); } -PyDoc_STRVAR(py_blf_gettext_doc, -".. function:: gettext(msgid)\n" +PyDoc_STRVAR(py_blf_unload_doc, +".. function:: unload(filename)\n" "\n" -" Get a msg in local language.\n" +" Unload an existing font.\n" "\n" -" :arg msgid: the source string.\n" -" :type msgid: string\n" -" :return: the localized string.\n" -" :rtype: string\n" +" :arg filename: the filename of the font.\n" +" :type filename: string\n" ); -static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *value) +static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args) { -#ifdef INTERNATIONAL - if ((U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE)) { - const char *msgid= _PyUnicode_AsString(value); - if(msgid == NULL) { - PyErr_SetString(PyExc_TypeError, "blf.gettext expects a single string argument"); - return NULL; - } - - return PyUnicode_FromString(BLF_gettext(msgid)); - } - else -#endif /* INTERNATIONAL */ - { - return Py_INCREF(value), value; - } + char* filename; + + if (!PyArg_ParseTuple(args, "s:blf.unload", &filename)) + return NULL; + + BLF_unload(filename); + + Py_RETURN_NONE; } /*----------------------------MODULE INIT-------------------------*/ @@ -415,7 +400,7 @@ static PyMethodDef BLF_methods[] = { {"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc}, {"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc}, {"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc}, - {"gettext", (PyCFunction) py_blf_gettext, METH_O, py_blf_gettext_doc}, + {"unload", (PyCFunction) py_blf_unload, METH_VARARGS, py_blf_unload_doc}, {NULL, NULL, 0, NULL} }; -- cgit v1.2.3 From 49f87edf4eec0f2e1dd165eab52ce63b4b2af864 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 21 Sep 2011 17:31:16 +0000 Subject: Minor: Other UI strings typos and tweaks. --- source/blender/makesrna/intern/rna_action.c | 2 +- source/blender/makesrna/intern/rna_material.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 434e613359d..718f70cea1e 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -613,7 +613,7 @@ static void rna_def_action(BlenderRNA *brna) prop= RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "idroot"); RNA_def_property_enum_items(prop, id_type_items); - RNA_def_property_ui_text(prop, "ID Root Type", "Type of ID-block that action can be used on. DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING"); + RNA_def_property_ui_text(prop, "ID Root Type", "Type of ID-block that action can be used on - DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING"); /* API calls */ RNA_api_action(srna); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 673e768e71e..4be8bb4953d 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -377,10 +377,10 @@ static void rna_def_material_mtex(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_mapping_items[] = { - {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly"}, - {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector"}, - {MTEX_TUBE, "TUBE", 0, "Tube", "Maps with Z as central axis"}, - {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Maps with Z as central axis"}, + {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"}, + {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"}, + {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"}, + {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_x_mapping_items[] = { -- cgit v1.2.3 From f1a227cf432d6b95bc7cef67a68aaf1c62caafc7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Sep 2011 17:52:51 +0000 Subject: check that descriptions dont end with a '.', for non release builds. this is annoying for translators so rather then correct along the way which gives merge conflicts for branches - print a complaint message. --- source/blender/editors/object/object_vgroup.c | 8 ++++---- source/blender/makesrna/intern/rna_actuator.c | 10 +++++----- source/blender/makesrna/intern/rna_define.c | 19 +++++++++++++++++++ source/blender/windowmanager/intern/wm_operators.c | 14 +++++++------- 4 files changed, 35 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 797cf428969..85b62c97438 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2355,7 +2355,7 @@ 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; @@ -2363,9 +2363,9 @@ 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, "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); } diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 43cf1fae931..d828139a6d5 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -861,7 +861,7 @@ static void rna_def_camera_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "CameraActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Camera Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Camera Actuator", ""); RNA_def_struct_sdna_from(srna, "bCameraActuator", "data"); prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); @@ -1387,7 +1387,7 @@ static void rna_def_scene_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SceneActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Scene Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Scene Actuator", ""); RNA_def_struct_sdna_from(srna, "bSceneActuator", "data"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); @@ -1445,7 +1445,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "RandomActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Random Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Random Actuator", ""); RNA_def_struct_sdna_from(srna, "bRandomActuator", "data"); prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); @@ -1562,7 +1562,7 @@ static void rna_def_message_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MessageActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Message Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Message Actuator", ""); RNA_def_struct_sdna_from(srna, "bMessageActuator", "data"); prop= RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE); @@ -1877,7 +1877,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Armature Actuator", "Actuator to..."); + RNA_def_struct_ui_text(srna, "Armature Actuator", ""); RNA_def_struct_sdna_from(srna, "bArmatureActuator", "data"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 8af65b97ffc..63b3aed4a3b 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -58,6 +58,21 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1}; #define MAX2(x,y) ((x)>(y)? (x): (y)) #endif +/* pedantic check for '.', do this since its a hassle for translators */ +#ifndef NDEBUG +# define DESCR_CHECK(description, id1, id2) \ + if(description && (description)[0]) { \ + int i = strlen(description); \ + if((description)[i - 1] == '.') { \ + fprintf(stderr, "%s: '%s' '%s' description ends with a '.' !\n", \ + __func__, id1 ? id1 : "", id2 ? id2 : ""); \ + } \ + } \ + +#else +# define DESCR_CHECK(description, id1, id2) +#endif + void rna_addtail(ListBase *listbase, void *vlink) { Link *link= vlink; @@ -847,6 +862,8 @@ void RNA_def_struct_identifier(StructRNA *srna, const char *identifier) void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description) { + DESCR_CHECK(description, srna->identifier, NULL); + srna->name= name; srna->description= description; } @@ -1109,6 +1126,8 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description) { + DESCR_CHECK(description, prop->identifier, NULL); + prop->name= name; prop->description= description; } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 320dc2ecdda..68cd95c1b99 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1962,7 +1962,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory"); - RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active."); + RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active"); } /* *************** save file directly ******** */ @@ -3279,12 +3279,12 @@ static void WM_OT_radial_control(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; /* all paths relative to the context */ - RNA_def_string(ot->srna, "data_path", "", 0, "Data Path", "Path of property to be set by the radial control."); - RNA_def_string(ot->srna, "rotation_path", "", 0, "Rotation Path", "Path of property used to rotate the texture display."); - RNA_def_string(ot->srna, "color_path", "", 0, "Color Path", "Path of property used to set the color of the control."); - RNA_def_string(ot->srna, "fill_color_path", "", 0, "Fill Color Path", "Path of property used to set the fill color of the control."); - RNA_def_string(ot->srna, "zoom_path", "", 0, "Zoom Path", "Path of property used to set the zoom level for the control."); - RNA_def_string(ot->srna, "image_id", "", 0, "Image ID", "Path of ID that is used to generate an image for the control."); + RNA_def_string(ot->srna, "data_path", "", 0, "Data Path", "Path of property to be set by the radial control"); + RNA_def_string(ot->srna, "rotation_path", "", 0, "Rotation Path", "Path of property used to rotate the texture display"); + RNA_def_string(ot->srna, "color_path", "", 0, "Color Path", "Path of property used to set the color of the control"); + RNA_def_string(ot->srna, "fill_color_path", "", 0, "Fill Color Path", "Path of property used to set the fill color of the control"); + RNA_def_string(ot->srna, "zoom_path", "", 0, "Zoom Path", "Path of property used to set the zoom level for the control"); + RNA_def_string(ot->srna, "image_id", "", 0, "Image ID", "Path of ID that is used to generate an image for the control"); } /* ************************** timer for testing ***************** */ -- cgit v1.2.3 From ad1d1bd8186420c5b80eb8b4bb99d7b8d702fa23 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 21 Sep 2011 18:05:01 +0000 Subject: Added misses INTERNATIONAL definition in scons rules. --- source/blender/python/SConscript | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source') diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 5cc3f3bedc4..b21bc142a28 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -43,5 +43,8 @@ if env['WITH_BF_PYTHON_SAFETY']: if env['BF_BUILDINFO']: defs.append('BUILD_DATE') +if env['WITH_BF_INTERNATIONAL']: + defs.append('INTERNATIONAL') + sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361]) -- cgit v1.2.3 From b2a43f5e8cfad97be128821a2c904213847c591b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 21 Sep 2011 21:17:38 +0000 Subject: One of the two latest commits in this file broke the multi-bone selection in pose mode (shift-selection)... --- source/blender/editors/armature/editarmature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 566ff09c366..b979962de5d 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4298,7 +4298,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor * note, special exception for armature mode so we can do multi-select * we could check for multi-select explicitly but think its fine to * always give pradictable behavior in weight paint mode - campbell */ - if (!(extend) || ((ob_act && ob_act->mode & OB_MODE_WEIGHT_PAINT) == 0)) { + if (!extend || (ob_act && ob_act->mode & OB_MODE_WEIGHT_PAINT)) { ED_pose_deselectall(ob, 0); nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL); arm->act_bone= nearBone; -- cgit v1.2.3 From 0bc5fef976270343ee128015f3a2555994b83158 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Sep 2011 02:33:58 +0000 Subject: correct fix for armature selection, also remove international define from generic python C funcs. --- source/blender/editors/armature/editarmature.c | 2 +- source/blender/python/SConscript | 3 --- source/blender/python/generic/CMakeLists.txt | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index b979962de5d..20368bbf57b 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4298,7 +4298,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor * note, special exception for armature mode so we can do multi-select * we could check for multi-select explicitly but think its fine to * always give pradictable behavior in weight paint mode - campbell */ - if (!extend || (ob_act && ob_act->mode & OB_MODE_WEIGHT_PAINT)) { + if (!extend || ((ob_act && (ob_act != ob) && (ob_act->mode & OB_MODE_WEIGHT_PAINT)==0))) { ED_pose_deselectall(ob, 0); nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL); arm->act_bone= nearBone; diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index b21bc142a28..f00d49fe8dd 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -17,9 +17,6 @@ defs = [] if is_debug: defs.append('_DEBUG') -if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') - sources = env.Glob('generic/*.c') env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [363,165]) # ketsji is 360 diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index 0a49036c15d..847a0d19a7f 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -48,8 +48,4 @@ set(SRC py_capi_utils.h ) -if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) -endif() - blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}") -- cgit v1.2.3 From 86d528afa7c54d74162f2ef873da5c62b5c77b52 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Sep 2011 03:14:50 +0000 Subject: comment some unused vars / assignments. --- source/blender/blenkernel/intern/blender.c | 2 ++ source/blender/blenkernel/intern/multires.c | 2 +- source/blender/editors/curve/editcurve.c | 14 ++++++-------- source/blender/imbuf/intern/jpeg.c | 6 +++--- source/blender/makesrna/intern/rna_ui_api.c | 2 +- .../nodes/composite/nodes/node_composite_lummaMatte.c | 2 -- source/blender/render/intern/source/pixelshading.c | 3 +-- source/blender/render/intern/source/shadeoutput.c | 6 +++--- 8 files changed, 17 insertions(+), 20 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 218b83fc52a..27ea1585e4b 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -318,6 +318,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath set_scene_bg(G.main, CTX_data_scene(C)); MEM_freeN(bfd); + + (void)curscene; /* quiet warning */ } static int handle_subversion_warning(Main *main, ReportList *reports) diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index e621e800520..cd264c5ddfd 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1408,7 +1408,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl) } /* Interior face verts */ - lvl = lvl1->next->next; + /* lvl = lvl1->next->next; */ /* UNUSED */ dst = 0; for(j = 0; j < lvl1->totface; ++j) { int sides = lvl1->faces[j].v[3] ? 4 : 3; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 84df77bb120..75188411f41 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2376,7 +2376,7 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short BezTriple *bezt; BPoint *bp; int a; - short lastsel= 0, sel=0; + short lastsel= 0; if(next==0) return; @@ -2388,13 +2388,12 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short if(next < 0) bezt= (nu->bezt + (a-1)); while(a--) { if(a-abs(next) < 0) break; - sel= 0; if((lastsel==0) && (bezt->hide==0) && ((bezt->f2 & SELECT) || (selstatus==0))) { bezt+=next; if(!(bezt->f2 & SELECT) || (selstatus==0)) { - sel= select_beztriple(bezt, selstatus, 1, VISIBLE); + short sel= select_beztriple(bezt, selstatus, 1, VISIBLE); if((sel==1) && (cont==0)) lastsel= 1; - } + } } else { bezt+=next; @@ -2410,11 +2409,10 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short if(next < 0) bp= (nu->bp + (a-1)); while(a--) { if(a-abs(next) < 0) break; - sel=0; if((lastsel==0) && (bp->hide==0) && ((bp->f1 & SELECT) || (selstatus==0))) { bp+=next; if(!(bp->f1 & SELECT) || (selstatus==0)) { - sel= select_bpoint(bp, selstatus, 1, VISIBLE); + short sel= select_bpoint(bp, selstatus, 1, VISIBLE); if((sel==1) && (cont==0)) lastsel= 1; } } @@ -2443,7 +2441,6 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu BezTriple *bezt; Curve *cu; int a; - short sel; if(obedit==NULL) return; @@ -2451,7 +2448,6 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu cu->lastsel= NULL; for(nu= editnurb->first; nu; nu= nu->next) { - sel= 0; if(nu->type == CU_BEZIER) { a= nu->pntsu; @@ -2464,6 +2460,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu } while(a--) { + short sel; if(doswap) sel= swap_selection_beztriple(bezt); else sel= select_beztriple(bezt, selstatus, 1, VISIBLE); @@ -2483,6 +2480,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu while(a--) { if (bp->hide == 0) { + short sel; if(doswap) sel= swap_selection_bpoint(bp); else sel= select_bpoint(bp, selstatus, 1, VISIBLE); diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 0759d97e69f..b87b46ca464 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -255,12 +255,12 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t static boolean handle_app1 (j_decompress_ptr cinfo) { - INT32 length, i; + INT32 length; /* initialized by the macro */ + INT32 i; char neogeo[128]; INPUT_VARS(cinfo); - - length = 0; + INPUT_2BYTES(cinfo, length, return FALSE); length -= 2; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 816a7ba9cd4..85ad6b231aa 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -84,7 +84,7 @@ static void api_ui_item_common(FunctionRNA *func) { PropertyRNA *prop; - prop= RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item"); + RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item"); prop= RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, icon_items); diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c index cac2a386801..f7028fbeafd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c @@ -52,8 +52,6 @@ static void do_luma_matte(bNode *node, float *out, float *in) NodeChroma *c=(NodeChroma *)node->storage; float alpha; - alpha=0.0; - /* test range*/ if(in[0]>c->t1) { alpha=1.0; diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 5c5162d268b..93038984115 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -226,8 +226,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) } /* shadow */ - if(i> -0.41f) { /* heuristic valua! */ - shadfac= 1.0; + if(i> -0.41f) { /* heuristic valua! */ if(lar->shb) { shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f); if(shadfac==0.0f) continue; diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 41d12c6065e..c808d930e7c 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -726,7 +726,7 @@ static float Toon_Diff( float *n, float *l, float *UNUSED(v), float size, float /* in latter case, only last multiplication uses 'nl' */ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough ) { - float i/*, nh*/, nv, vh, realnl, h[3]; + float i/*, nh*/, nv /*, vh */, realnl, h[3]; float a, b, t, A, B; float Lit_A, View_A, Lit_B[3], View_B[3]; @@ -745,8 +745,8 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough if(realnl<=0.0f) return 0.0f; if(nl<0.0f) return 0.0f; /* value from area light */ - vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; /* Dot product between view vector and halfway vector */ - if(vh<=0.0f) vh= 0.0f; + /* vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; */ /* Dot product between view vector and halfway vector */ + /* if(vh<=0.0f) vh= 0.0f; */ Lit_A = saacos(realnl); View_A = saacos( nv ); -- cgit v1.2.3 From dc09774fb62ca3b8fe7e8b0da32d50636884a14b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Sep 2011 05:05:26 +0000 Subject: use bli math functions for vgroup_fix operator. --- source/blender/editors/object/object_vgroup.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 85b62c97438..5265261f3af 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -955,10 +955,8 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in wasChange = FALSE; dm = dm_deform_recalc(scene, ob); dm->getVert(dm, index, &m); - oldPos[0] = m.co[0]; - oldPos[1] = m.co[1]; - oldPos[2] = m.co[2]; - distToStart = norm[0]*oldPos[0] + norm[1]*oldPos[1] + norm[2]*oldPos[2] + d; + copy_v3_v3(oldPos, m.co); + distToStart = dot_v3v3(norm, oldPos) + d; if(distToBe == originalDistToBe) { distToBe += distToStart - distToStart*strength; @@ -1123,18 +1121,14 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength, if(count >= 3) { float d /*, dist */ /* UNUSED */, mag; - float coord[3] = {0}; - float norm[3] = {0}; + float coord[3]; + float norm[3]; getSingleCoordinate(p, count, coord); dm->getVert(dm, i, &m); - norm[0] = m.co[0]-coord[0]; - norm[1] = m.co[1]-coord[1]; - norm[2] = m.co[2]-coord[2]; - mag = sqrt(norm[0]*norm[0] + norm[1]*norm[1] + norm[2]*norm[2]); - if(mag) {// zeros fix - mul_v3_fl(norm, 1.0f/mag); - - d = -norm[0]*coord[0] -norm[1]*coord[1] -norm[2]*coord[2]; + sub_v3_v3v3(norm, m.co, coord); + mag= normalize_v3(norm); + if(mag) { /* zeros fix */ + d = -dot_v3v3(norm, coord); /* dist = (norm[0]*m.co[0] + norm[1]*m.co[1] + norm[2]*m.co[2] + d); */ /* UNUSED */ moveCloserToDistanceFromPlane(scene, ob, me, i, norm, coord, d, distToBe, strength, cp); } -- cgit v1.2.3 From 68a9450dd19a228312756c7a653255c6f34d1913 Mon Sep 17 00:00:00 2001 From: Morten Mikkelsen Date: Thu, 22 Sep 2011 05:36:52 +0000 Subject: addendum to prev bugfix on texture space bump --- source/blender/gpu/intern/gpu_material.c | 9 +++++++-- source/blender/render/intern/source/render_texture.c | 12 ++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 40186c5a187..c3cbcb61622 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1091,6 +1091,9 @@ static void do_material_tex(GPUShadeInput *shi) float ima_x, ima_y; float hScale = 0.1f; // compatibility adjustment factor for all bumpspace types float hScaleTex = 13.0f; // factor for scaling texspace bumps + + float imag_tspace_dimension_x = 1024.0f; // only used for texture space variant + float aspect = 1.0f; GPUNodeLink *surf_pos = GPU_builtin(GPU_VIEW_POSITION); GPUNodeLink *vR1, *vR2; @@ -1154,6 +1157,7 @@ static void do_material_tex(GPUShadeInput *shi) if(ibuf) { ima_x= ibuf->x; ima_y= ibuf->y; + aspect = ((float) ima_y) / ima_x; } } @@ -1174,10 +1178,11 @@ static void do_material_tex(GPUShadeInput *shi) if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { - + float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x; GPU_link( mat, "mtex_bump_apply_texspace", fDet, dBs, dBt, vR1, vR2, - GPU_image(tex->ima, &tex->iuser), texco, GPU_uniform(&ima_x), GPU_uniform(&ima_y), vNacc, + GPU_image(tex->ima, &tex->iuser), texco, + GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc, &vNacc, &shi->vn ); } else GPU_link( mat, "mtex_bump_apply", diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 641fec90cf3..0e9e274f256 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1906,6 +1906,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T const int fromrgb = ((tex->type == TEX_IMAGE) || ((tex->flag & TEX_COLORBAND)!=0)); 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; // 2 channels for 2D texture and 3 for 3D textures. const int nr_channels = (mtex->texco == TEXCO_UV)? 2 : 3; @@ -1938,6 +1940,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T if (ibuf) { dimx = ibuf->x; dimy = ibuf->y; + aspect = ((float) dimy) / dimx; } } @@ -2111,12 +2114,13 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T if(tex->ima) { // crazy hack solution that gives results similar to normal mapping - part 2 float vec[2]; + const float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x; - vec[0] = dimx*dxt[0]; - vec[1] = dimy*dxt[1]; + vec[0] = imag_tspace_dimension_x*dxt[0]; + vec[1] = imag_tspace_dimension_y*dxt[1]; dHdx *= 1.0f/len_v2(vec); - vec[0] = dimx*dyt[0]; - vec[1] = dimy*dyt[1]; + vec[0] = imag_tspace_dimension_x*dyt[0]; + vec[1] = imag_tspace_dimension_y*dyt[1]; dHdy *= 1.0f/len_v2(vec); } } -- cgit v1.2.3 From 9166e1ae2fd3a6d32faf4cf168e0c68df85cc871 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 22 Sep 2011 11:16:04 +0000 Subject: Minor: Other UI strings typos and tweaks. --- source/blender/makesrna/intern/rna_material.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 4be8bb4953d..f112a7eb2fc 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -456,7 +456,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "use_from_original", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_OB_DUPLI_ORIG); RNA_def_property_ui_text(prop, "From Original", - "Dupli's derive their object coordinates from the original objects transformation"); + "Dupli's derive their object coordinates from the original object's transformation"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_map_color_diffuse", PROP_BOOLEAN, PROP_NONE); @@ -555,7 +555,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "normal_map_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "normapspace"); RNA_def_property_enum_items(prop, prop_normal_map_space_items); - RNA_def_property_ui_text(prop, "Normal Map Space", "Sets space of normal map image"); + RNA_def_property_ui_text(prop, "Normal Map Space", "Set space of normal map image"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE); @@ -871,7 +871,7 @@ static void rna_def_material_colors(StructRNA *srna) prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec"); RNA_def_property_enum_items(prop, ramp_blend_items); - RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "Blending method of the ramp and the specular color"); + RNA_def_property_ui_text(prop, "Specular Ramp Blend", "Blending method of the ramp and the specular color"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE); @@ -981,7 +981,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) prop= RNA_def_property(srna, "reflect_factor", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "ray_mirror"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Reflectivity", "Sets the amount mirror reflection for raytrace"); + RNA_def_property_ui_text(prop, "Reflectivity", "Amount of mirror reflection for raytrace"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE); @@ -1060,7 +1060,7 @@ static void rna_def_material_raytra(BlenderRNA *brna) prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ang"); RNA_def_property_range(prop, 0.25f, 4.0f); - RNA_def_property_ui_text(prop, "IOR", "Sets angular index of refraction for raytraced refraction"); + RNA_def_property_ui_text(prop, "IOR", "Angular index of refraction for raytraced refraction"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE); @@ -1233,7 +1233,7 @@ static void rna_def_material_volume(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1 ,3); RNA_def_property_ui_text(prop, "Scattering", "Amount of light that gets scattered out by the volume - " - "the more out-scattering, the shallower the light will penetrate "); + "the more out-scattering, the shallower the light will penetrate"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "transmission_color", PROP_FLOAT, PROP_COLOR); -- cgit v1.2.3 From b6bf57e2b0b7a33ee297fe063fc6862b1e27d11e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 22 Sep 2011 11:52:42 +0000 Subject: Minor: Added doxygen file's doc comments in weightvg modifiers. --- source/blender/modifiers/intern/MOD_weightvg_util.c | 7 ++----- source/blender/modifiers/intern/MOD_weightvg_util.h | 2 +- source/blender/modifiers/intern/MOD_weightvgedit.c | 7 ++----- source/blender/modifiers/intern/MOD_weightvgmix.c | 7 ++----- source/blender/modifiers/intern/MOD_weightvgproximity.c | 7 ++----- 5 files changed, 9 insertions(+), 21 deletions(-) (limited to 'source') diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 128e888ca90..2c94c4d1505 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvg_util.c + * \ingroup modifiers */ #include "BLI_math.h" diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index a327bdf969b..ed558e412c5 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -26,7 +26,7 @@ * */ -/** \file blender/modifiers/intern/MOD_util.h +/** \file blender/modifiers/intern/MOD_weightvg_util.h * \ingroup modifiers */ diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 233ad8baf0b..42d628cad09 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvgedit.c + * \ingroup modifiers */ #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 283e812e11c..e3499829371 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvgmix.c + * \ingroup modifiers */ #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 76be25a2b10..109d16f229f 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -26,11 +26,8 @@ * */ -/* - * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this... - * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? - * Or the WeightPaint mode code itself? +/** \file blender/modifiers/intern/MOD_weightvgproximity.c + * \ingroup modifiers */ #include "BLI_editVert.h" -- cgit v1.2.3 From aa809e6f78d5904337038cdaa104cd52a4e7c7d5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 22 Sep 2011 12:00:24 +0000 Subject: Minor: Bah, doxygen file's doc comments were also missing from warp and navmesh modifiers... --- source/blender/modifiers/intern/MOD_navmesh.c | 6 ++++++ source/blender/modifiers/intern/MOD_warp.c | 4 ++++ 2 files changed, 10 insertions(+) (limited to 'source') diff --git a/source/blender/modifiers/intern/MOD_navmesh.c b/source/blender/modifiers/intern/MOD_navmesh.c index cf4e01ad516..946a0948fee 100644 --- a/source/blender/modifiers/intern/MOD_navmesh.c +++ b/source/blender/modifiers/intern/MOD_navmesh.c @@ -25,6 +25,12 @@ * ***** END GPL LICENSE BLOCK ***** * */ + +/** \file blender/modifiers/intern/MOD_navmesh.c + * \ingroup modifiers + */ + + #include #include "DNA_mesh_types.h" diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 723e77cc6bb..36d3dc88b56 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -23,6 +23,10 @@ * */ +/** \file blender/modifiers/intern/MOD_warp.c + * \ingroup modifiers + */ + #include #include "MEM_guardedalloc.h" -- cgit v1.2.3 From 780be0d918fec1fce4ae0ffabaad948a7e12549c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 12:07:02 +0000 Subject: Fix #28695: path/beziercirlce defined surface dissapears when deleting subdv of path until toggling end point option Clamp order when deleting points from nurb curve. Also fixed incorrect free caused by non-initialized knots array when deleting segment from non-cyclic nurb. --- source/blender/editors/curve/editcurve.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source') diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 75188411f41..91c06e0f125 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5777,6 +5777,7 @@ static int delete_exec(bContext *C, wmOperator *op) clamp_nurb_order_u(nu); }*/ } + clamp_nurb_order_u(nu); nurbs_knot_calc_u(nu); } nu= next; @@ -5925,7 +5926,14 @@ static int delete_exec(bContext *C, wmOperator *op) MEM_freeN(nu1->bp); nu1->bp= bp; nu1->pntsu= a; + nu1->knotsu= NULL; nu->pntsu= cut+1; + + clamp_nurb_order_u(nu); + nurbs_knot_calc_u(nu); + + clamp_nurb_order_u(nu1); + nurbs_knot_calc_u(nu1); } } } -- cgit v1.2.3 From 3833cb2e7656fe20ff031dcab686fa182097d3cb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 22 Sep 2011 12:45:25 +0000 Subject: Fix #28585: read full sample layers not working in compositor. --- source/blender/editors/space_node/node_edit.c | 9 +++++---- source/blender/editors/space_node/space_node.c | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 7cb8351cd12..e5719bf9dd9 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2903,12 +2903,13 @@ static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op)) Render *re= RE_NewRender(curscene->id.name); WM_cursor_wait(1); - RE_MergeFullSample(re, bmain, curscene, snode->nodetree); - snode_notify(C, snode); - snode_dag_update(C, snode); - WM_cursor_wait(0); + + /* note we are careful to send the right notifier, as otherwise the + compositor would reexecute and overwrite the full sample result */ + WM_event_add_notifier(C, NC_SCENE|ND_COMPO_RESULT, NULL); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 0990afa4fe6..9c4581a43da 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -178,6 +178,9 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_FRAME: ED_area_tag_refresh(sa); break; + case ND_COMPO_RESULT: + ED_area_tag_redraw(sa); + break; case ND_TRANSFORM_DONE: if(type==NTREE_COMPOSIT) { if(snode->flag & SNODE_AUTO_RENDER) { -- cgit v1.2.3 From 1445ed9f11d3da64956b096d25ef3dbb9d9eff97 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 22 Sep 2011 14:29:15 +0000 Subject: Fix #28651: dopesheet crash when configuring keymap to use translate tool. This doesn't work, needs to be time translate, but we can avoid the crash. --- source/blender/editors/transform/transform.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index f6b4f32adef..fbe0a1864bf 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3296,6 +3296,11 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2])) void initTranslation(TransInfo *t) { + if (t->spacetype == SPACE_ACTION) { + /* this space uses time translate */ + t->state = TRANS_CANCEL; + } + t->mode = TFM_TRANSLATION; t->transform = Translation; -- cgit v1.2.3 From a20bcb4613d5f2f9b47a37c731f70c30c6175756 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Sep 2011 14:42:29 +0000 Subject: clear up some warnings. --- source/blender/blenfont/intern/blf_font.c | 3 +++ source/blender/blenkernel/intern/key.c | 2 +- source/blender/collada/DocumentImporter.cpp | 2 +- source/blender/editors/gpencil/gpencil_paint.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 4 +--- source/blender/editors/space_action/action_draw.c | 2 +- source/blender/editors/space_node/node_header.c | 2 +- source/blender/editors/space_outliner/outliner_tree.c | 7 ++++--- source/blender/editors/space_text/text_draw.c | 7 ++++--- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/render/intern/source/render_texture.c | 2 +- 13 files changed, 21 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 26af3a3fd4f..851c6542de0 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -529,6 +529,9 @@ FontBLF *blf_font_new(const char *name, const char *filename) mfile= blf_dir_metrics_search(filename); if (mfile) { err= FT_Attach_File(font->face, mfile); + if(err) { + fprintf(stderr, "FT_Attach_File failed to load '%s' with error %d\n", filename, (int)err); + } MEM_freeN(mfile); } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 2aef5b39c71..4b8209ab77e 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -807,7 +807,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key int a, ofs[32], *ofsp; int flagdo= 15, flagflo=0, elemsize, poinsize=0; char *k1, *k2, *k3, *k4, *freek1, *freek2, *freek3, *freek4; - char *cp, elemstr[8];; + char *cp, elemstr[8]; /* currently always 0, in future key_pointer_size may assign */ ofs[1]= 0; diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 2387c9a1465..e98f551a097 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -816,7 +816,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) double aspect = camera->getAspectRatio().getValue(); double xfov = aspect*yfov; // xfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens(DEG2RADF(xfov));; + cam->lens = angle_to_lens(DEG2RADF(xfov)); } break; } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 842ab92ae31..1bab362fe55 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1478,7 +1478,7 @@ static void gpencil_draw_apply (wmOperator *op, tGPsdata *p) /* start a new stroke, starting from previous point */ gp_stroke_addpoint(p, p->mvalo, p->opressure); - ok= gp_stroke_addpoint(p, p->mval, p->pressure); + gp_stroke_addpoint(p, p->mval, p->pressure); } else if (ok == GP_STROKEADD_INVALID) { /* the painting operation cannot continue... */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index ec1405f74b8..8ca481655d0 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -798,7 +798,7 @@ static void UNUSED_FUNCTION(special_editmenu)(Scene *scene, View3D *v3d) Object *par= modifiers_isDeformedByArmature(ob); if(par && (par->mode & OB_MODE_POSE)) { - nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2"); +// XXX nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2"); // XXX if(nr==1 || nr==2) // XXX pose_adds_vgroups(ob, (nr == 2)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 11a46bb373b..0c2cb2ee36d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2108,7 +2108,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P if(indexar[index] && indexar[index]<=me->totface) { MFace *mf= me->mface + (indexar[index]-1); - unsigned int fidx= mf->v4 ? 3:2;; + unsigned int fidx= mf->v4 ? 3:2; do { unsigned int vidx= *(&mf->v1 + fidx); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 0bdb027a903..62d6d5f16b8 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -484,13 +484,11 @@ static float integrate_overlap(Brush* br) int i; int m= 10; float g = 1.0f/m; - float overlap; float max; - overlap= 0; max= 0; for(i= 0; i < m; i++) { - overlap = overlapped_curve(br, i*g); + float overlap= overlapped_curve(br, i*g); if (overlap > max) max = overlap; diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index f541423e69d..619e76e9e50 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -189,7 +189,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) /* if in NLA there's a strip active, map the view */ if (ac->datatype == ANIMCONT_ACTION) { - adt= ANIM_nla_mapping_get(ac, NULL); + /* adt= ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */ /* start and end of action itself */ calc_action_range(ac->data, &act_start, &act_end, 0); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 996e05afdef..205dd6bb639 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -93,7 +93,7 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp) else node->flag &= ~NODE_TEST; } - node= node_add_node(snode, bmain, scene, ntemp, snode->mx, snode->my); + /* node= */ node_add_node(snode, bmain, scene, ntemp, snode->mx, snode->my); /* select previous selection before autoconnect */ for(node= snode->edittree->nodes.first; node; node= node->next) { diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 9fe0ed0543f..dda103b971b 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1544,8 +1544,9 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) while(seq) { op= need_add_seq_dup(seq); - if(op==1) - ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); + if(op==1) { + /* ten= */ outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0); + } else if(op==0) { ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0); outliner_add_seq_dup(soops, seq, ten, 0); @@ -1582,7 +1583,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) wmKeyMap *km; for(km= wm->defaultconf->keymaps.first; km; km= km->next) { - ten= outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0); + /* ten= */ outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0); } } else { diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 685b15aed50..4c617115a3d 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -508,7 +508,7 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * { Text *text; TextLine *linep; - int i, j, start, end, chars, max, chop; + int i, j, start, end, max, chop; char ch; *offl= *offc= 0; @@ -546,9 +546,9 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * start= 0; end= max; chop= 1; - chars= 0; *offc= 0; for(i=0, j=0; linep->line[j]!='\0'; j++) { + int chars; /* Mimic replacement of tabs */ ch= linep->line[j]; @@ -557,8 +557,9 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * if(linep==linein && i=max) { diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index dd3255e1140..b1d7ab7f786 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1064,7 +1064,7 @@ static void weld_align_uv(bContext *C, int tool) int itmpl, jtmpl; EditVert *eve; int pass; /* first 2 passes find endpoints, 3rd pass moves middle points, 4th pass is fail-on-face-selected */ - EditFace *startefa, *endefa; + EditFace *startefa, *endefa= NULL; /* endefa shouldnt need to be initialized but just incase */ /* pass 3 variables */ float startx, starty, firstm, firstb, midx, midy; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 0e9e274f256..8d953ccc73d 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -747,7 +747,7 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex { PluginTex *pit; int rgbnor=0; - float result[ 8 ]; + float result[8]= {0.0f}; texres->tin= 0.0; -- cgit v1.2.3 From 232da3741e2c48f06a51aff7469d90e29e5e52ed Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 22 Sep 2011 14:55:39 +0000 Subject: Fix #28593: F6 operator redo could crash when editing buttons that use unit settings, these could get freed with the scene on undo/redo, make a copy now. --- source/blender/editors/interface/interface.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7dac8c6351a..32fe0fb86f9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1935,6 +1935,9 @@ void uiFreeBlock(const bContext *C, uiBlock *block) ui_free_but(C, but); } + if(block->unit) + MEM_freeN(block->unit); + if(block->func_argN) MEM_freeN(block->func_argN); @@ -2010,10 +2013,15 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor block->active= 1; block->dt= dt; block->evil_C= (void*)C; // XXX + if (scn) { block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT); - block->unit= &scn->unit; + + /* copy to avoid crash when scene gets deleted with ui still open */ + block->unit= MEM_mallocN(sizeof(scn->unit), "UI UnitSettings"); + memcpy(block->unit, &scn->unit, sizeof(scn->unit)); } + BLI_strncpy(block->name, name, sizeof(block->name)); if(region) -- cgit v1.2.3 From dd7f52defad2864b3a9adf1716b0bfeb309bd95d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 22 Sep 2011 15:35:25 +0000 Subject: Fix #28365: some macro operators were missing descriptions. --- source/blender/editors/armature/armature_ops.c | 3 +++ source/blender/editors/object/object_ops.c | 3 +++ source/blender/editors/space_action/action_ops.c | 1 + source/blender/editors/space_graph/graph_ops.c | 1 + source/blender/editors/space_node/node_edit.c | 4 ++-- source/blender/editors/space_node/node_ops.c | 5 ++++- 6 files changed, 14 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 81ece9ddc9a..d559aef6fe2 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -173,6 +173,7 @@ void ED_operatormacros_armature(void) ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description= "Make copies of the selected bones within the same armature and move them"; WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); @@ -180,6 +181,7 @@ void ED_operatormacros_armature(void) ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description= "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); RNA_boolean_set(otmacro->ptr, "forked", 0); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); @@ -190,6 +192,7 @@ void ED_operatormacros_armature(void) // that would require fixing a properties bug 19733 ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description= "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); RNA_boolean_set(otmacro->ptr, "forked", 1); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 452d1aded51..a9cb0423739 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -230,6 +230,7 @@ void ED_operatormacros_object(void) ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description = "Duplicate selected objects and move them"; WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF); @@ -238,6 +239,7 @@ void ED_operatormacros_object(void) /* grr, should be able to pass options on... */ ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description = "Duplicate selected objects and move them"; otmacro= WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); RNA_boolean_set(otmacro->ptr, "linked", 1); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); @@ -247,6 +249,7 @@ void ED_operatormacros_object(void) /* XXX */ ot= WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER); if(ot) { + ot->description = "Add named object at cursor"; RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add"); WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d"); diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index 491d436741e..c3af3521918 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -94,6 +94,7 @@ void ED_operatormacros_action(void) ot= WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { + ot->description= "Make a copy of all selected keyframes and move them"; WM_operatortype_macro_define(ot, "ACTION_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 46918407447..fb148a73ed2 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -277,6 +277,7 @@ void ED_operatormacros_graph(void) ot= WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { + ot->description= "Make a copy of all selected keyframes and move them"; WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate"); otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index e5719bf9dd9..916e59eae9c 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1805,7 +1805,7 @@ void NODE_OT_link_viewer(wmOperatorType *ot) { /* identifiers */ ot->name= "Link to Viewer Node"; - ot->description = "Link to Viewer Node"; + ot->description = "Link to viewer node"; ot->idname= "NODE_OT_link_viewer"; /* api callbacks */ @@ -2275,7 +2275,7 @@ void NODE_OT_duplicate(wmOperatorType *ot) { /* identifiers */ ot->name= "Duplicate Nodes"; - ot->description = "Duplicate the nodes"; + ot->description = "Duplicate selected nodes"; ot->idname= "NODE_OT_duplicate"; /* api callbacks */ diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 153d703ddf6..87f98f2bb8d 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -106,19 +106,22 @@ void ED_operatormacros_node(void) wmOperatorTypeMacro *mot; ot= WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + ot->description = "Duplicate selected nodes and move them"; WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); /* modified operator call for duplicating with input links */ ot= WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + ot->description = "Duplicate selected nodes keeping input links and move them"; mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); RNA_boolean_set(mot->ptr, "keep_inputs", 1); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); ot= WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO); + ot->description = "Select node and link it to a viewer node"; WM_operatortype_macro_define(ot, "NODE_OT_select"); WM_operatortype_macro_define(ot, "NODE_OT_link_viewer"); - } +} void node_keymap(struct wmKeyConfig *keyconf) { -- cgit v1.2.3 From 49b518eff89d0fd7cb6923fe4fcb9a4a010462fa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 15:39:31 +0000 Subject: Fix #28489: Wacom Intuos 4 tablet doesn't work with outliner Stylus can produce slight movements when it touches tablet, so CLICK event wasn't triggering. Do not store INBETWEEN_MOUSE as previous event to make CLICK events triggered correct. Thanks to Brecht to pointing on short way to fix this problem. --- source/blender/windowmanager/intern/wm_event_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 75fec6ed705..dad43b4fe69 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1917,7 +1917,7 @@ void wm_event_do_handlers(bContext *C) /* store last event for this window */ /* mousemove and timer events don't overwrite last type */ - if (event->type != MOUSEMOVE && !ISTIMER(event->type)) { + if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) && !ISTIMER(event->type)) { if (wm_action_not_handled(action)) { if (win->eventstate->prevtype == event->type) { /* set click time on first click (press -> release) */ -- cgit v1.2.3 From 1ca02a8d29b2500b324794b5193be92d6cfe6c4d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 15:46:34 +0000 Subject: Fix rest of #28693: Proportional edit hangs on mesh object with high scale Patchy by Juha Maki-Kanto --- source/blender/editors/transform/transform_conversions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 77d2e6e7ff0..83f79eae4f2 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1807,7 +1807,7 @@ void flushTransParticles(TransInfo *t) /* ********************* mesh ****************** */ /* proportional distance based on connectivity */ -#define THRESHOLD 0.0001f +#define THRESHOLDFACTOR (1.0f-0.0001f) static int connectivity_edge(float mtx[][3], EditVert *v1, EditVert *v2) { @@ -1828,10 +1828,10 @@ static int connectivity_edge(float mtx[][3], EditVert *v1, EditVert *v2) if (v1->f2) { if (v2->f2) { - if (v2->tmp.fp + edge_len + THRESHOLD < v1->tmp.fp) { + if (v2->tmp.fp + edge_len < THRESHOLDFACTOR * v1->tmp.fp) { v1->tmp.fp = v2->tmp.fp + edge_len; done = 1; - } else if (v1->tmp.fp + edge_len + THRESHOLD < v2->tmp.fp) { + } else if (v1->tmp.fp + edge_len < THRESHOLDFACTOR * v2->tmp.fp) { v2->tmp.fp = v1->tmp.fp + edge_len; done = 1; } -- cgit v1.2.3 From d3a76bc507f2ca2f5fd80d35408388962cd9a4ea Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 22 Sep 2011 15:46:43 +0000 Subject: Fix #28549: file browser recent directories could include directory that doesn't exist after cancelling make directory. Patch by Sergey. --- source/blender/editors/space_file/file_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index e61d7693d19..fd52c3c4199 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -749,7 +749,9 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); - fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1); + if (BLI_exist(sfile->params->dir)) + fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir, 0, 1); + BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu_get(), filepath); WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); -- cgit v1.2.3 From 9ea32d34c441fba68f7536171351ff386490df8c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 16:28:38 +0000 Subject: Fix #28722: Segfault when reading volumetric clouds example Added checking for voxel data isn't NULL. --- source/blender/blenlib/intern/bpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 654ade8955f..1c5aab7659d 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -244,7 +244,7 @@ static struct Tex *tex_stepdata__internal(struct Tex *tex, const int step_next, tex= tex->id.next; while (tex) { - if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) + if (tex->type == TEX_VOXELDATA && tex->vd && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) break; /* image is not a image with a path, skip it */ tex= tex->id.next; -- cgit v1.2.3 From 799afc1aa4bff22a6aed21a1cfe7da9e55d18a10 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 16:57:16 +0000 Subject: Fix #28226: Selection highlighting is wrong when Solidify Modifier is used Set origindices for edges/faces created for rim to ORIGINDEX_NONE. Also discovered error in recent editmode VBO fix -- it used to crash when comparing faces with ORIGINDEX_NONE original index. --- source/blender/blenkernel/intern/cdderivedmesh.c | 10 +++++++--- source/blender/modifiers/intern/MOD_solidify.c | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index e1939335268..afa310b0b80 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -981,9 +981,13 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us if(!flush && compareDrawOptions) { int next_orig= (index==NULL) ? next_actualFace : index[next_actualFace]; - /* also compare draw options and flush buffer if they're different - need for face selection highlight in edit mode */ - flush|= compareDrawOptions(userData, orig, next_orig) == 0; + if(orig==ORIGINDEX_NONE || next_orig==ORIGINDEX_NONE) { + flush= 1; + } else { + /* also compare draw options and flush buffer if they're different + need for face selection highlight in edit mode */ + flush|= compareDrawOptions(userData, orig, next_orig) == 0; + } } if(flush) { diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index afe6da8b38a..757da28e4b5 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -524,7 +524,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } if(smd->flag & MOD_SOLIDIFY_RIM) { - + int *origindex; /* bugger, need to re-calculate the normals for the new edge faces. * This could be done in many ways, but probably the quickest way is to calculate the average normals for side faces only. @@ -551,18 +551,22 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, {0, 3, 3, 0}}; /* add faces & edges */ + origindex= result->getEdgeDataArray(result, CD_ORIGINDEX); ed= medge + (numEdges * 2); for(i=0; iv1= new_vert_arr[i]; ed->v2= new_vert_arr[i] + numVerts; ed->flag |= ME_EDGEDRAW; + origindex[numEdges * 2 + i]= ORIGINDEX_NONE; + if(crease_rim) ed->crease= crease_rim; } /* faces */ mf= mface + (numFaces * 2); + origindex= result->getFaceDataArray(result, CD_ORIGINDEX); for(i=0; iv1], nor); add_v3_v3(edge_vert_nos[ed->v2], nor); #endif + origindex[numFaces * 2 + i]= ORIGINDEX_NONE; } #ifdef SOLIDIFY_SIDE_NORMALS -- cgit v1.2.3 From 2eb1339e3f53d83f960bf5c07341d91a806bbcc3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 17:52:21 +0000 Subject: Corrected fix for #28722: Segfault when reading volumetric clouds example Looks like with current implementation voxeldata should always be created for voxel textures. Remove recently added NULL check and allocate voxel data when linking a texture. --- source/blender/blenlib/intern/bpath.c | 2 +- source/blender/blenloader/intern/readfile.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 1c5aab7659d..654ade8955f 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -244,7 +244,7 @@ static struct Tex *tex_stepdata__internal(struct Tex *tex, const int step_next, tex= tex->id.next; while (tex) { - if (tex->type == TEX_VOXELDATA && tex->vd && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) + if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) break; /* image is not a image with a path, skip it */ tex= tex->id.next; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c736270533e..ecd3c9b5dad 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3009,6 +3009,9 @@ static void direct_link_texture(FileData *fd, Tex *tex) if(tex->vd) { tex->vd->dataset = NULL; tex->vd->ok = 0; + } else { + if(tex->type == TEX_VOXELDATA) + tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData"); } tex->nodetree= newdataadr(fd, tex->nodetree); -- cgit v1.2.3 From bf7f88566cd6a23d2b180995210d20d433605555 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 17:52:27 +0000 Subject: Remove checks for voxel data when texture type is known. --- source/blender/blenloader/intern/writefile.c | 2 +- source/blender/render/intern/source/voxeldata.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e92ec5dbe6e..cbc312a75e9 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1787,7 +1787,7 @@ static void write_textures(WriteData *wd, ListBase *idbase) if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba); if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve); } - if(tex->type == TEX_VOXELDATA && tex->vd) writestruct(wd, DATA, "VoxelData", 1, tex->vd); + if(tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd); /* nodetree is integral part of texture, no libdata */ if(tex->nodetree) { diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index b63ece80119..464cbf72326 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -389,7 +389,7 @@ int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texre VoxelData *vd = tex->vd; float co[3], offset[3] = {0.5, 0.5, 0.5}; - if ((!vd) || (vd->dataset==NULL)) { + if (vd->dataset==NULL) { texres->tin = 0.0f; return 0; } -- cgit v1.2.3 From 48918130a1566ce8aa4bf66d8b3bda35ec240acb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Sep 2011 18:42:16 +0000 Subject: remove redundant code & use GL_LINE_STRIP for object spiral drawing. --- source/blender/editors/space_view3d/drawobject.c | 57 ++++++++++++++-------- .../blender/editors/space_view3d/view3d_header.c | 6 +-- source/blender/render/intern/source/shadeinput.c | 2 +- source/blender/windowmanager/intern/wm_window.c | 10 ++-- 4 files changed, 46 insertions(+), 29 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 44d68ded679..65267bb481a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5112,6 +5112,7 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star const float tot_inv= (1.0f / (float)CIRCLE_RESOL); int a; char inverse= FALSE; + float x, y, fac; if (start < 0) { inverse = TRUE; @@ -5121,38 +5122,56 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star mul_v3_v3fl(vx, tmat[0], rad); mul_v3_v3fl(vy, tmat[1], rad); - copy_v3_v3(vec, cent); + glBegin(GL_LINE_STRIP); if (inverse==0) { + copy_v3_v3(vec, cent); + glVertex3fv(vec); + for(a=0; a31) + if (a+start>=CIRCLE_RESOL) start=-a + 1; - glBegin(GL_LINES); - glVertex3fv(vec); - vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)a * tot_inv) + cosval[a+start] * (vy[0] * (float)a * tot_inv); - vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)a * tot_inv) + cosval[a+start] * (vy[1] * (float)a * tot_inv); - vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)a * tot_inv) + cosval[a+start] * (vy[2] * (float)a * tot_inv); + + fac= (float)a * tot_inv; + x= sinval[a+start] * fac; + y= cosval[a+start] * fac; + + vec[0]= cent[0] + (x * vx[0] + y * vy[0]); + vec[1]= cent[1] + (x * vx[1] + y * vy[1]); + vec[2]= cent[2] + (x * vx[2] + y * vy[2]); + glVertex3fv(vec); - glEnd(); } } else { - a=0; - vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); - vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); - vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); + a= 0; + + fac= (float)(CIRCLE_RESOL-1) * tot_inv; + x= sinval[start] * fac; + y= cosval[start] * fac; + + vec[0]= cent[0] + (x * vx[0] + y * vy[0]); + vec[1]= cent[1] + (x * vx[1] + y * vy[1]); + vec[2]= cent[2] + (x * vx[2] + y * vy[2]); + + glVertex3fv(vec); + for(a=0; a31) + if (a+start>=CIRCLE_RESOL) start=-a + 1; - glBegin(GL_LINES); - glVertex3fv(vec); - vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); - vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); - vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); + + fac= (float)(-a+(CIRCLE_RESOL-1)) * tot_inv; + x= sinval[a+start] * fac; + y= cosval[a+start] * fac; + + vec[0]= cent[0] + (x * vx[0] + y * vy[0]); + vec[1]= cent[1] + (x * vx[1] + y * vy[1]); + vec[2]= cent[2] + (x * vx[2] + y * vy[2]); glVertex3fv(vec); - glEnd(); } } + + glEnd(); } /* draws a circle on x-z plane given the scaling of the circle, assuming that diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 0776ca752a9..44d85af858c 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -285,14 +285,14 @@ static char *view3d_modeselect_pup(Scene *scene) { Object *ob= OBACT; static char string[256]; - const char *title= N_("Mode: %%t"); + const char *title= N_("Mode: %t"); char *str = string; if(U.transopts&USER_TR_IFACE) title= BLF_gettext(title); - sprintf(str, title); - + BLI_strncpy(str, title, sizeof(string)); + str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA); if(ob==NULL || ob->data==NULL) return string; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index d8231c7e7d4..956a3d4de7c 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1368,7 +1368,7 @@ void shade_samples_do_AO(ShadeSample *ssamp) if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) - for(sample=0, shi= ssamp->shi; sampletot; shi++, sample++) + for(sample=0; sampletot; shi++, sample++) if(!(shi->mode & MA_SHLESS)) ambient_occlusion(shi); /* stores in shi->ao[] */ } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d9ca275c819..405960d0795 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -111,14 +111,12 @@ static void wm_window_check_position(rcti *rect) #endif if(rect->xmin < 0) { - d= rect->xmin; - rect->xmax -= d; - rect->xmin -= d; + rect->xmax -= rect->xmin; + rect->xmin = 0; } if(rect->ymin < 0) { - d= rect->ymin; - rect->ymax -= d; - rect->ymin -= d; + rect->ymax -= rect->ymin; + rect->ymin = 0; } if(rect->xmax > width) { d= rect->xmax - width; -- cgit v1.2.3 From ccdf99de53dd0db0dd763ce2df63022e345e0e72 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 23 Sep 2011 08:33:32 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_material.c | 74 +++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index f112a7eb2fc..6ed2147ce1b 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -1292,118 +1292,118 @@ static void rna_def_material_halo(BlenderRNA *brna) prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "hasize"); RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_text(prop, "Size", "Sets the dimension of the halo"); + RNA_def_property_ui_text(prop, "Size", "Dimension of the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "hardness", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "har"); RNA_def_property_range(prop, 0, 127); - RNA_def_property_ui_text(prop, "Hardness", "Sets the hardness of the halo"); + RNA_def_property_ui_text(prop, "Hardness", "Hardness of the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "add"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Add", "Sets the strength of the add effect"); + RNA_def_property_ui_text(prop, "Add", "Strength of the add effect"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "ring_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ringc"); RNA_def_property_range(prop, 0, 24); - RNA_def_property_ui_text(prop, "Rings", "Sets the number of rings rendered over the halo"); + RNA_def_property_ui_text(prop, "Rings", "Number of rings rendered over the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "line_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "linec"); RNA_def_property_range(prop, 0, 250); - RNA_def_property_ui_text(prop, "Line Number", "Sets the number of star shaped lines rendered over the halo"); + RNA_def_property_ui_text(prop, "Line Number", "Number of star shaped lines rendered over the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "star_tip_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "starc"); RNA_def_property_range(prop, 3, 50); - RNA_def_property_ui_text(prop, "Star Tips", "Sets the number of points on the star shaped halo"); + RNA_def_property_ui_text(prop, "Star Tips", "Number of points on the star shaped halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "seed1"); RNA_def_property_range(prop, 0, 255); - RNA_def_property_ui_text(prop, "Seed", "Randomizes ring dimension and line location"); + RNA_def_property_ui_text(prop, "Seed", "Randomize ring dimension and line location"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_flare_mode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_FLARE); /* use bitflags */ - RNA_def_property_ui_text(prop, "Flare", "Renders halo as a lens flare"); + RNA_def_property_ui_text(prop, "Flare", "Render halo as a lens flare"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "flaresize"); RNA_def_property_range(prop, 0.1f, 25.0f); - RNA_def_property_ui_text(prop, "Flare Size", "Sets the factor by which the flare is larger than the halo"); + RNA_def_property_ui_text(prop, "Flare Size", "Factor by which the flare is larger than the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_subflare_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "subsize"); RNA_def_property_range(prop, 0.1f, 25.0f); - RNA_def_property_ui_text(prop, "Flare Subsize", "Sets the dimension of the sub-flares, dots and circles"); + RNA_def_property_ui_text(prop, "Flare Subsize", "Dimension of the sub-flares, dots and circles"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_boost", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "flareboost"); RNA_def_property_range(prop, 0.1f, 10.0f); - RNA_def_property_ui_text(prop, "Flare Boost", "Gives the flare extra strength"); + RNA_def_property_ui_text(prop, "Flare Boost", "Give the flare extra strength"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_seed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "seed2"); RNA_def_property_range(prop, 0, 255); - RNA_def_property_ui_text(prop, "Flare Seed", "Specifies an offset in the flare seed table"); + RNA_def_property_ui_text(prop, "Flare Seed", "Offset in the flare seed table"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "flare_subflare_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "flarec"); RNA_def_property_range(prop, 1, 32); - RNA_def_property_ui_text(prop, "Flares Sub", "Sets the number of sub-flares"); + RNA_def_property_ui_text(prop, "Flares Sub", "Number of sub-flares"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_ring", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_RINGS); - RNA_def_property_ui_text(prop, "Rings", "Renders rings over halo"); + RNA_def_property_ui_text(prop, "Rings", "Render rings over halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_lines", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_LINES); - RNA_def_property_ui_text(prop, "Lines", "Renders star shaped lines over halo"); + RNA_def_property_ui_text(prop, "Lines", "Render star shaped lines over halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_star", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STAR); - RNA_def_property_ui_text(prop, "Star", "Renders halo as a star"); + RNA_def_property_ui_text(prop, "Star", "Render halo as a star"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOTEX); - RNA_def_property_ui_text(prop, "Texture", "Gives halo a texture"); + RNA_def_property_ui_text(prop, "Texture", "Give halo a texture"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_vertex_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOPUNO); - RNA_def_property_ui_text(prop, "Vertex Normal", "Uses the vertex normal to specify the dimension of the halo"); + RNA_def_property_ui_text(prop, "Vertex Normal", "Use the vertex normal to specify the dimension of the halo"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_extreme_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_XALPHA); - RNA_def_property_ui_text(prop, "Extreme Alpha", "Uses extreme alpha"); + RNA_def_property_ui_text(prop, "Extreme Alpha", "Use extreme alpha"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_shaded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SHADE); - RNA_def_property_ui_text(prop, "Shaded", "Lets halo receive light and shadows from external objects"); + RNA_def_property_ui_text(prop, "Shaded", "Let halo receive light and shadows from external objects"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_soft", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SOFT); - RNA_def_property_ui_text(prop, "Soft", "Softens the edges of halos at intersections with other geometry"); + RNA_def_property_ui_text(prop, "Soft", "Soften the edges of halos at intersections with other geometry"); RNA_def_property_update(prop, 0, "rna_Material_update"); } @@ -1457,7 +1457,7 @@ static void rna_def_material_sss(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "sss_texfac"); RNA_def_property_ui_range(prop, 0, 1, 10, 3); - RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor"); + RNA_def_property_ui_text(prop, "Texture Factor", "Texture scattering blend factor"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "front", PROP_FLOAT, PROP_NONE); @@ -1594,7 +1594,7 @@ static void rna_def_material_strand(BlenderRNA *brna) prop= RNA_def_property(srna, "shape", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "strand_ease"); RNA_def_property_range(prop, -0.9, 0.9); - RNA_def_property_ui_text(prop, "Shape", "Positive values make strands rounder, negative makes strands spiky"); + RNA_def_property_ui_text(prop, "Shape", "Positive values make strands rounder, negative ones make strands spiky"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "width_fade", PROP_FLOAT, PROP_NONE); @@ -1659,7 +1659,7 @@ void RNA_def_material(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface"}, - {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in ray tracing)"}, + {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in raytracing)"}, {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume"}, {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"}, {0, NULL, 0, NULL, NULL}}; @@ -1688,7 +1688,7 @@ void RNA_def_material(BlenderRNA *brna) srna= RNA_def_struct(brna, "Material", "ID"); RNA_def_struct_ui_text(srna, "Material", - "Material datablock to defined the appearance of geometric objects for rendering"); + "Material datablock to define the appearance of geometric objects for rendering"); RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); @@ -1785,17 +1785,17 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRACEBLE); RNA_def_property_ui_text(prop, "Traceable", - "Include this material and geometry that uses it in ray tracing calculations"); + "Include this material and geometry that uses it in raytracing calculations"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW); - RNA_def_property_ui_text(prop, "Shadows", "Allows this material to receive shadows"); + RNA_def_property_ui_text(prop, "Shadows", "Allow this material to receive shadows"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_shadeless", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHLESS); - RNA_def_property_ui_text(prop, "Shadeless", "Makes this material insensitive to light or shadow"); + RNA_def_property_ui_text(prop, "Shadeless", "Make this material insensitive to light or shadow"); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "use_vertex_color_light", PROP_BOOLEAN, PROP_NONE); @@ -1806,30 +1806,30 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_vertex_color_paint", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOLP); RNA_def_property_ui_text(prop, "Vertex Color Paint", - "Replaces object base color with vertex colors (multiplies with " + "Replace object base color with vertex colors (multiply with " "'texture face' face assigned textures)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZINV); - RNA_def_property_ui_text(prop, "Invert Z Depth", "Renders material's faces with an inverted Z buffer (scanline only)"); + RNA_def_property_ui_text(prop, "Invert Z Depth", "Render material's faces with an inverted Z buffer (scanline only)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "offset_z", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zoffs"); - RNA_def_property_ui_text(prop, "Z Offset", "Gives faces an artificial offset in the Z buffer for Z transparency"); + RNA_def_property_ui_text(prop, "Z Offset", "Give faces an artificial offset in the Z buffer for Z transparency"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ENV); RNA_def_property_ui_text(prop, "Sky", - "Renders this material with zero alpha, with sky background in place (scanline only)"); + "Render this material with zero alpha, with sky background in place (scanline only)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYSHADOW); RNA_def_property_ui_text(prop, "Only Shadow", - "Renders shadows as the material's alpha value, making materials " + "Render shadows as the material's alpha value, making the material " "transparent except for shadowed areas"); RNA_def_property_update(prop, 0, "rna_Material_update"); @@ -1842,19 +1842,19 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE); RNA_def_property_ui_text(prop, "Face Textures", - "Replaces the object's base color with color from face assigned image textures"); + "Replace the object's base color with color from face assigned image textures"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_face_texture_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE_ALPHA); RNA_def_property_ui_text(prop, "Face Textures Alpha", - "Replaces the object's base alpha value with alpha from face assigned image textures"); + "Replace the object's base alpha value with alpha from face assigned image textures"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_cast_shadows_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYCAST); RNA_def_property_ui_text(prop, "Cast Shadows Only", - "Makes objects with this material appear invisible, only casting shadows (not rendered)"); + "Make objects with this material appear invisible (not rendered), only casting shadows"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE); @@ -1871,7 +1871,7 @@ void RNA_def_material(BlenderRNA *brna) prop= RNA_def_property(srna, "use_ray_shadow_bias", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYBIAS); RNA_def_property_ui_text(prop, "Ray Shadow Bias", - "Prevents raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)"); + "Prevent raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "use_full_oversampling", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3 From 120895fd240590f428fd68dda4bb4bd5c844cfc3 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 23 Sep 2011 17:44:57 +0000 Subject: Fix [#28729] World units not used for new object creation. Setting PROP_DISTANCE subtype for "size" properties of add mesh operators. --- source/blender/editors/mesh/editmesh_add.c | 36 +++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 0c819cd7649..98cca08fd7a 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1472,6 +1472,8 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) void MESH_OT_primitive_circle_add(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Add Circle"; ot->description= "Construct a circle mesh"; @@ -1487,7 +1489,8 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500); - RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); + prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); + RNA_def_property_subtype(prop, PROP_DISTANCE); RNA_def_boolean(ot->srna, "fill", 0, "Fill", ""); ED_object_add_generic_props(ot, TRUE); @@ -1513,6 +1516,8 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Add Cylinder"; ot->description= "Construct a cylinder mesh"; @@ -1528,8 +1533,10 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500); - RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); - RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); + prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); + RNA_def_property_subtype(prop, PROP_DISTANCE); + prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); + RNA_def_property_subtype(prop, PROP_DISTANCE); RNA_def_boolean(ot->srna, "cap_ends", 1, "Cap Ends", ""); ED_object_add_generic_props(ot, TRUE); @@ -1554,6 +1561,8 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) void MESH_OT_primitive_cone_add(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Add Cone"; ot->description= "Construct a conic mesh (ends filled)"; @@ -1569,8 +1578,10 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500); - RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); - RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); + prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); + RNA_def_property_subtype(prop, PROP_DISTANCE); + prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); + RNA_def_property_subtype(prop, PROP_DISTANCE); RNA_def_boolean(ot->srna, "cap_end", 1, "Cap End", ""); ED_object_add_generic_props(ot, TRUE); @@ -1595,6 +1606,8 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) void MESH_OT_primitive_grid_add(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Add Grid"; ot->description= "Construct a grid mesh"; @@ -1611,7 +1624,8 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "x_subdivisions", 10, 3, INT_MAX, "X Subdivisions", "", 3, 1000); RNA_def_int(ot->srna, "y_subdivisions", 10, 3, INT_MAX, "Y Subdivisions", "", 3, 1000); - RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, FLT_MAX); + prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, FLT_MAX); + RNA_def_property_subtype(prop, PROP_DISTANCE); ED_object_add_generic_props(ot, TRUE); } @@ -1668,6 +1682,8 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Add UV Sphere"; ot->description= "Construct a UV sphere mesh"; @@ -1684,7 +1700,8 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "segments", 32, 3, INT_MAX, "Segments", "", 3, 500); RNA_def_int(ot->srna, "ring_count", 16, 3, INT_MAX, "Rings", "", 3, 500); - RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, 100.00); + prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, 100.00); + RNA_def_property_subtype(prop, PROP_DISTANCE); ED_object_add_generic_props(ot, TRUE); } @@ -1707,6 +1724,8 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Add Ico Sphere"; ot->description= "Construct an Icosphere mesh"; @@ -1722,7 +1741,8 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) /* props */ RNA_def_int(ot->srna, "subdivisions", 2, 1, INT_MAX, "Subdivisions", "", 1, 8); - RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00); + prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00); + RNA_def_property_subtype(prop, PROP_DISTANCE); ED_object_add_generic_props(ot, TRUE); } -- cgit v1.2.3 From a189b71a28d3eddc6b85948ab1063be0a032cde4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 23 Sep 2011 18:29:45 +0000 Subject: some speedup for drawing mesh in texture mode. - only pass if the mesh has vertex colors to drawParams() rather then the mcol its self, this saves a lookup on the color. - drawing textures in editmode with no vertex colors would still lookup vertex colors on each face, instead cache this info for all faces. --- source/blender/blenkernel/BKE_DerivedMesh.h | 2 +- source/blender/blenkernel/intern/DerivedMesh.c | 8 +++---- source/blender/blenkernel/intern/cdderivedmesh.c | 8 +++---- source/blender/blenkernel/intern/subsurf_ccg.c | 6 ++--- source/blender/editors/space_view3d/drawmesh.c | 28 ++++++++++++++---------- 5 files changed, 28 insertions(+), 24 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 6e17b056685..2c3ffc296ba 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -257,7 +257,7 @@ struct DerivedMesh { */ void (*drawFacesTex)(DerivedMesh *dm, int (*setDrawOptions)(struct MTFace *tface, - struct MCol *mcol, int matnr)); + int has_mcol, int matnr)); /* Draw all faces with GLSL materials * o setMaterial is called for every different material nr diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index fddd2809c47..5e462238f31 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -799,7 +799,7 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us } static void emDM_drawFacesTex_common(DerivedMesh *dm, - int (*drawParams)(MTFace *tface, MCol *mcol, int matnr), + int (*drawParams)(MTFace *tface, int has_mcol, int matnr), int (*drawParamsMapped)(void *userData, int index), void *userData) { @@ -827,7 +827,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, int flag; if(drawParams) - flag= drawParams(tf, mcol, efa->mat_nr); + flag= drawParams(tf, (mcol != NULL), efa->mat_nr); else if(drawParamsMapped) flag= drawParamsMapped(userData, i); else @@ -900,7 +900,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, int flag; if(drawParams) - flag= drawParams(tf, mcol, efa->mat_nr); + flag= drawParams(tf, (mcol != NULL), efa->mat_nr); else if(drawParamsMapped) flag= drawParamsMapped(userData, i); else @@ -966,7 +966,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, } } -static void emDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void emDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) { emDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index afa310b0b80..707bf95f9c3 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -647,7 +647,7 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha } static void cdDM_drawFacesTex_common(DerivedMesh *dm, - int (*drawParams)(MTFace *tface, MCol *mcol, int matnr), + int (*drawParams)(MTFace *tface, int has_mcol, int matnr), int (*drawParamsMapped)(void *userData, int index), void *userData) { @@ -673,7 +673,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, unsigned char *cp = NULL; if(drawParams) { - flag = drawParams(tf? &tf[i]: NULL, mcol? &mcol[i*4]: NULL, mf->mat_nr); + flag = drawParams(tf? &tf[i]: NULL, (mcol != NULL), mf->mat_nr); } else { if(index) { @@ -792,7 +792,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, int flag = 1; if(drawParams) { - flag = drawParams(tf? &tf[actualFace]: NULL, mcol? &mcol[actualFace*4]: NULL, mf[actualFace].mat_nr); + flag = drawParams(tf? &tf[actualFace]: NULL, (mcol != NULL), mf[actualFace].mat_nr); } else { if(index) { @@ -835,7 +835,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, } } -static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) { cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 36263746228..3d3806f7c02 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1583,7 +1583,7 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns } static void ccgDM_drawFacesTex_common(DerivedMesh *dm, - int (*drawParams)(MTFace *tface, MCol *mcol, int matnr), + int (*drawParams)(MTFace *tface, int has_mcol, int matnr), int (*drawParamsMapped)(void *userData, int index), void *userData) { @@ -1619,7 +1619,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } if(drawParams) - flag = drawParams(tf, mcol, mat_nr); + flag = drawParams(tf, (mcol != NULL), mat_nr); else if (index != ORIGINDEX_NONE) flag= (drawParamsMapped)? drawParamsMapped(userData, index): 1; else @@ -1722,7 +1722,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } } -static void ccgDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void ccgDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) { ccgDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index b6e76885719..bf4bd7f1d93 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -362,7 +362,7 @@ static void draw_textured_end(void) glPopMatrix(); } -static int draw_tface__set_draw_legacy(MTFace *tface, MCol *mcol, int matnr) +static int draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr) { Material *ma= give_current_material(Gtexdraw.ob, matnr+1); int validtexture=0; @@ -377,7 +377,7 @@ static int draw_tface__set_draw_legacy(MTFace *tface, MCol *mcol, int matnr) } else if (ma && ma->shade_flag&MA_OBCOLOR) { glColor3ubv(Gtexdraw.obcol); return 2; /* Don't set color */ - } else if (!mcol) { + } else if (!has_mcol) { if (tface) glColor3f(1.0, 1.0, 1.0); else { if(ma) { @@ -394,7 +394,7 @@ static int draw_tface__set_draw_legacy(MTFace *tface, MCol *mcol, int matnr) return 1; /* Set color from mcol */ } } -static int draw_tface__set_draw(MTFace *tface, MCol *mcol, int matnr) +static int draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr) { Material *ma= give_current_material(Gtexdraw.ob, matnr+1); @@ -404,7 +404,7 @@ static int draw_tface__set_draw(MTFace *tface, MCol *mcol, int matnr) return 2; /* Don't set color */ } else if (tface && tface->mode&TF_OBCOL) { return 2; /* Don't set color */ - } else if (!mcol) { + } else if (!has_mcol) { return 1; /* Don't set color */ } else { return 1; /* Set color from mcol */ @@ -491,28 +491,26 @@ static int draw_tface_mapped__set_draw(void *userData, int index) Mesh *me = (Mesh*)userData; MTFace *tface = (me->mtface)? &me->mtface[index]: NULL; MFace *mface = &me->mface[index]; - MCol *mcol = (me->mcol)? &me->mcol[index]: NULL; const int matnr = mface->mat_nr; if (mface->flag & ME_HIDE) return 0; - return draw_tface__set_draw(tface, mcol, matnr); + return draw_tface__set_draw(tface, (me->mcol != NULL), matnr); } static int draw_em_tf_mapped__set_draw(void *userData, int index) { - EditMesh *em = userData; + struct {EditMesh *em; short has_mcol; short has_mtface;} *data = userData; + EditMesh *em = data->em; EditFace *efa= EM_get_face_for_index(index); MTFace *tface; - MCol *mcol; int matnr; if (efa->h) return 0; - tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL); + tface = data->has_mtface ? CustomData_em_get(&em->fdata, efa->data, CD_MTFACE) : NULL; matnr = efa->mat_nr; - return draw_tface__set_draw_legacy(tface, mcol, matnr); + return draw_tface__set_draw_legacy(tface, data->has_mcol, matnr); } static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) @@ -632,7 +630,13 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o glColor4f(1.0f,1.0f,1.0f,1.0f); if(ob->mode & OB_MODE_EDIT) { - dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh); + struct {EditMesh *em; short has_mcol; short has_mtface;} data; + + data.em= me->edit_mesh; + data.has_mcol= CustomData_has_layer(&me->edit_mesh->fdata, CD_MCOL); + data.has_mtface= CustomData_has_layer(&me->edit_mesh->fdata, CD_MTFACE); + + dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, &data); } else if(faceselect) { if(ob->mode & OB_MODE_WEIGHT_PAINT) -- cgit v1.2.3 From a043133bab034480f05eae16135560228e67fe30 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 23 Sep 2011 19:33:04 +0000 Subject: Fix for recent Campbell's commit. --- source/blender/modifiers/intern/MOD_navmesh.c | 2 +- .../Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/modifiers/intern/MOD_navmesh.c b/source/blender/modifiers/intern/MOD_navmesh.c index 946a0948fee..c259239a003 100644 --- a/source/blender/modifiers/intern/MOD_navmesh.c +++ b/source/blender/modifiers/intern/MOD_navmesh.c @@ -139,7 +139,7 @@ static void drawNavMeshColored(DerivedMesh *dm) glEnable(GL_LIGHTING); } -static void navDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void navDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) { (void) setDrawOptions; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index d9039a2a68d..d99a23c28b5 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -829,7 +829,7 @@ static int CheckTexfaceDM(void *mcol, int index) } */ -static int CheckTexDM(MTFace *tface, MCol *mcol, int matnr) +static int CheckTexDM(MTFace *tface, int has_mcol, int matnr) { // index is the original face index, retrieve the polygon @@ -844,7 +844,7 @@ static int CheckTexDM(MTFace *tface, MCol *mcol, int matnr) // don't use mcol return 2; } - if (!mcol) { + if (!has_mcol) { // we have to set the color from the material unsigned char rgba[4]; current_polymat->GetMaterialRGBAColor(rgba); -- cgit v1.2.3 From 37cd3368da39d5b93a80f9999c5838556b7ae214 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 24 Sep 2011 09:57:47 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo --- source/blender/makesrna/intern/rna_mesh.c | 76 +++++++++++++++++++---------- source/blender/makesrna/intern/rna_object.c | 28 +++++------ 2 files changed, 64 insertions(+), 40 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 1bbdc7cc853..67bb7bffcfb 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1226,7 +1226,8 @@ static void rna_def_mvert(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); 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_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_def_property_struct_type(prop, "VertexGroupElement"); RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of"); @@ -1392,7 +1393,8 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); - RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", "rna_MeshTextureFaceLayer_active_render_set"); + RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", + "rna_MeshTextureFaceLayer_active_render_set"); RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); @@ -1405,7 +1407,9 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); 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_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); srna= RNA_def_struct(brna, "MeshTextureFace", NULL); RNA_def_struct_sdna(srna, "MTFace"); @@ -1480,7 +1484,8 @@ static void rna_def_mtface(BlenderRNA *brna) 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_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); @@ -1589,7 +1594,9 @@ static void rna_def_mcol(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshColor"); 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_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); srna= RNA_def_struct(brna, "MeshColor", NULL); RNA_def_struct_sdna(srna, "MCol"); @@ -1644,7 +1651,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshFloatProperty"); 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_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); srna= RNA_def_struct(brna, "MeshFloatProperty", NULL); RNA_def_struct_sdna(srna, "MFloatProperty"); @@ -1670,7 +1679,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshIntProperty"); 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_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); srna= RNA_def_struct(brna, "MeshIntProperty", NULL); RNA_def_struct_sdna(srna, "MIntProperty"); @@ -1696,7 +1707,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshStringProperty"); 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_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); srna= RNA_def_struct(brna, "MeshStringProperty", NULL); RNA_def_struct_sdna(srna, "MStringProperty"); @@ -1853,7 +1866,8 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range"); + RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", + "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range"); RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); } @@ -1911,7 +1925,8 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Clone UV Texture", "UV texture to be used as cloning source"); prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range"); + RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get", + "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range"); RNA_def_property_ui_text(prop, "Clone UV Texture Index", "Clone UV texture index"); prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED); @@ -1953,7 +1968,9 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH); - RNA_def_property_ui_text(prop, "Auto Smooth", "Treats all set-smoothed faces with angles less than the specified angle as 'smooth' during render"); + RNA_def_property_ui_text(prop, "Auto Smooth", + "Treat all set-smoothed faces with angles less than the " + "specified angle as 'smooth' during render"); #if 1 /* expose as radians */ prop= RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE); @@ -1964,7 +1981,8 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "smoothresh"); RNA_def_property_range(prop, 1, 80); #endif - RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); + RNA_def_property_ui_text(prop, "Auto Smooth Angle", + "Maximum angle between face normals that 'Auto Smooth' will operate on"); prop= RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED); @@ -1983,7 +2001,8 @@ static void rna_def_mesh(BlenderRNA *brna) /* texture space */ prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE); - RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjusts active object's texture space automatically when transforming object"); + RNA_def_property_ui_text(prop, "Auto Texture Space", + "Adjust active object's texture space automatically when transforming object"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Mesh_texspace_set"); prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); @@ -2018,62 +2037,66 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES); - RNA_def_property_ui_text(prop, "Draw Edges", "Displays selected edges using highlights in the 3D view and UV editor"); + RNA_def_property_ui_text(prop, "Draw Edges", "Display selected edges using highlights in the 3D view and UV editor"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_ALLEDGES); - RNA_def_property_ui_text(prop, "All Edges", "Displays all edges for wireframe in all view modes in the 3D view"); + RNA_def_property_ui_text(prop, "All Edges", "Display all edges for wireframe in all view modes in the 3D view"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES); - RNA_def_property_ui_text(prop, "Draw Faces", "Displays all faces as shades in the 3D view and UV editor"); + RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWNORMALS); - RNA_def_property_ui_text(prop, "Draw Normals", "Displays face normals as lines"); + RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_normal_vertex", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_VNORMALS); - RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Displays vertex normals as lines"); + RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES); - RNA_def_property_ui_text(prop, "Draw Creases", "Displays creases created for subsurf weighting"); + RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for subsurf weighting"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWBWEIGHTS); - RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Displays weights created for the Bevel modifier"); + RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSEAMS); - RNA_def_property_ui_text(prop, "Draw Seams", "Displays UV unwrapping seams"); + RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSHARP); - RNA_def_property_ui_text(prop, "Draw Sharp", "Displays sharp edges, used with the EdgeSplit modifier"); + RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the EdgeSplit modifier"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN); - RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths, Using global values when set in the transform panel"); + RNA_def_property_ui_text(prop, "Edge Length", + "Display selected edge lengths, using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG); - RNA_def_property_ui_text(prop, "Faces Angles", "Displays the angles in the selected edges in degrees, Using global values when set in the transform panel"); + RNA_def_property_ui_text(prop, "Faces Angles", + "Display the angles between the selected edges in degrees, using " + "global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEAREA); - RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel"); + RNA_def_property_ui_text(prop, "Face Area", + "Display the area of selected faces, using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); /* editflag */ @@ -2093,7 +2116,8 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO); - RNA_def_property_ui_text(prop, "Topology Mirror", "Use topology based mirroring. For when both sides of mesh have matching, unique topology"); + RNA_def_property_ui_text(prop, "Topology Mirror", + "Use topology based mirroring (for when both sides of mesh have matching, unique topology)"); prop= RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 720fea682ce..6c273ff9f2e 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1760,9 +1760,9 @@ static void rna_def_object(BlenderRNA *brna) static EnumPropertyItem drawtype_items[] = { {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"}, {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"}, - {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (If solid drawing is enabled in the viewport)"}, + {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"}, // disabled {OB_SHADED, "SHADED", 0, "Shaded", ""}, - {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (If textures are enabled in the viewport)"}, + {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (if textures are enabled in the viewport)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem boundtype_items[] = { @@ -1785,13 +1785,13 @@ static void rna_def_object(BlenderRNA *brna) // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable static EnumPropertyItem prop_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"}, - {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock. (Default)"}, - {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"}, - {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_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"}, + {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"}, + {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"}, {0, NULL, 0, NULL, NULL}}; static float default_quat[4] = {1,0,0,0}; /* default quaternion values */ @@ -1841,8 +1841,8 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_multi_array(prop, 2, boundbox_dimsize); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Bound Box", - "Objects bound box in object-space coordinates, all values are -1.0 when not available"); + RNA_def_property_ui_text(prop, "Bounding Box", + "Object's bounding box in object-space coordinates, all values are -1.0 when not available"); /* parent */ prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); @@ -1861,7 +1861,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "par1"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation"); + RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE); @@ -2123,13 +2123,13 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "FieldSettings"); RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation"); + RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the object as a field in physics simulation"); prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "CollisionSettings"); RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation"); + RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the object as a collider in physics simulation"); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "soft"); -- cgit v1.2.3 From 8247bf6fa68bec20a76e613f77f3b49c3194ace8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Sep 2011 11:10:53 +0000 Subject: svn merge ^/branches/bmesh/blender -r40512:40513 --- source/blender/editors/space_view3d/view3d_view.c | 28 +++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 8227ba87021..df4f615e5f1 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -713,7 +713,7 @@ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, } #endif -/* use above call to get projecting mat */ +/* use view3d_get_object_project_mat to get projecting mat */ void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4]) { float vec4[4]; @@ -732,6 +732,26 @@ void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], floa } } +/* use view3d_get_object_project_mat to get projecting mat */ +void ED_view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4]) +{ + float vec4[4]; + + copy_v3_v3(vec4, vec); + vec4[3]= 1.0; + adr[0]= IS_CLIPPED; + + mul_m4_v4(mat, vec4); + + if( vec4[3]>FLT_EPSILON ) { + adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3]; + adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3]; + adr[2] = vec4[2]/vec4[3]; + } else { + adr[0] = adr[1] = adr[2] = 0.0f; + } +} + int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) { /* return 1: draw */ @@ -803,9 +823,9 @@ void project_int(ARegion *ar, const float vec[3], int adr[2]) RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; - adr[0]= (int)2140000000.0f; copy_v3_v3(vec4, vec); vec4[3]= 1.0; + adr[0]= (int)2140000000.0f; mul_m4_v4(rv3d->persmat, vec4); @@ -851,9 +871,9 @@ void project_short_noclip(ARegion *ar, const float vec[3], short adr[2]) RegionView3D *rv3d= ar->regiondata; float fx, fy, vec4[4]; - adr[0]= IS_CLIPPED; copy_v3_v3(vec4, vec); vec4[3]= 1.0; + adr[0]= IS_CLIPPED; mul_m4_v4(rv3d->persmat, vec4); @@ -877,9 +897,9 @@ void project_float(ARegion *ar, const float vec[3], float adr[2]) RegionView3D *rv3d= ar->regiondata; float vec4[4]; - adr[0]= IS_CLIPPED; copy_v3_v3(vec4, vec); vec4[3]= 1.0; + adr[0]= IS_CLIPPED; mul_m4_v4(rv3d->persmat, vec4); -- cgit v1.2.3 From e63c124e2bbb6725d513dd8e06795b8a9ec90139 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Sep 2011 11:24:34 +0000 Subject: fix [#28736] FaceMask crash on Weight Paint --- source/blender/editors/space_view3d/drawmesh.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index bf4bd7f1d93..546e5ccba5d 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -517,10 +517,8 @@ static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmoot { Mesh *me = (Mesh*)userData; - if (me->mface) { - short matnr= me->mface[index].mat_nr; - Material *ma= me->mat[matnr]; - + if (me->mat && me->mface) { + Material *ma= me->mat[me->mface[index].mat_nr]; if (ma && (ma->game.flag & GEMAT_INVISIBLE)) { return 0; } -- cgit v1.2.3 From cb6255fdf84aa54a63c607aabeaa092962c11cdc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Sep 2011 14:34:24 +0000 Subject: edits to internal renderer - no functional changes. - move some larger vars into a nested scope. - replace memset with zero initializer. - rempace VECCOPY macros with copy_v3v3 - change function args to give the float array length. --- source/blender/render/intern/include/rendercore.h | 12 +- source/blender/render/intern/include/shading.h | 4 +- .../blender/render/intern/source/convertblender.c | 10 +- source/blender/render/intern/source/envmap.c | 6 +- source/blender/render/intern/source/rayshade.c | 241 +++++++++++---------- source/blender/render/intern/source/rendercore.c | 2 +- source/blender/render/intern/source/shadeinput.c | 6 +- source/blender/render/intern/source/shadeoutput.c | 50 +++-- source/blender/render/intern/source/strand.c | 4 +- source/blender/render/intern/source/zbuf.c | 9 +- 10 files changed, 178 insertions(+), 166 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index f9486b5d5c0..7f804c9311d 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -76,12 +76,12 @@ typedef struct PixStrMain void calc_view_vector(float *view, float x, float y); -float mistfactor(float zcor, float *co); /* dist and height, return alpha */ +float mistfactor(float zcor, const float co[3]); /* dist and height, return alpha */ -void renderspothalo(struct ShadeInput *shi, float *col, float alpha); +void renderspothalo(struct ShadeInput *shi, float col[4], float alpha); void add_halo_flare(Render *re); -void calc_renderco_zbuf(float co[3], float *view, int z); +void calc_renderco_zbuf(float co[3], const float view[3], int z); void calc_renderco_ortho(float co[3], float x, float y, int z); int count_mask(unsigned short mask); @@ -103,9 +103,9 @@ extern void freeraytree(Render *re); extern void makeraytree(Render *re); struct RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi); -extern void ray_shadow(ShadeInput *, LampRen *, float *); -extern void ray_trace(ShadeInput *, ShadeResult *); -extern void ray_ao(ShadeInput *, float *, float *); +extern void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4]); +extern void ray_trace(ShadeInput *shi, ShadeResult *); +extern void ray_ao(ShadeInput *shi, float ao[3], float env[3]); extern void init_jitter_plane(LampRen *lar); extern void init_ao_sphere(struct World *wrld); extern void init_render_qmcsampler(Render *re); diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 91507ef3f98..df5578dad7a 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -96,8 +96,8 @@ void ambient_occlusion(struct ShadeInput *shi); void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr); ListBase *get_lights(struct ShadeInput *shi); -float lamp_get_visibility(struct LampRen *lar, const float co[3], float *lv, float *dist); -void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real); +float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist); +void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real); float fresnel_fac(float *view, float *vn, float fresnel, float fac); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index a15662f86f4..27c825ebdeb 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5304,11 +5304,13 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq, static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen *obi, StrandSurface *mesh) { - float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq), (*winspeed)[4]; /* int's can wrap on large images */ - float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; - int a; - if(mesh->co && mesh->prevco && mesh->nextco) { + float winsq= (float)re->winx*(float)re->winy; /* int's can wrap on large images */ + float winroot= sqrt(winsq); + float (*winspeed)[4]; + float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; + int a; + if(obi->flag & R_TRANSFORMED) mul_m4_m4m4(winmat, obi->mat, re->winmat); else diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index e2b3b23b9c9..25895b81dd7 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -689,9 +689,9 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe env->ima= tex->ima; if(env->ima && env->ima->ok) { if(env->cube[1]==NULL) { - ImBuf *ibuf= BKE_image_get_ibuf(env->ima, NULL); - if(ibuf) - envmap_split_ima(env, ibuf); + ImBuf *ibuf_ima= BKE_image_get_ibuf(env->ima, NULL); + if(ibuf_ima) + envmap_split_ima(env, ibuf_ima); else env->ok= 0; } diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index e82e969d502..8fa90a51442 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -334,7 +334,6 @@ static void makeraytree_single(Render *re) for(obi=re->instancetable.first; obi; obi=obi->next) if(is_raytraceable(re, obi)) { - int v; ObjectRen *obr = obi->obr; obs++; @@ -344,6 +343,7 @@ static void makeraytree_single(Render *re) } else { + int v; for(v=0;vtotvlak;v++) { VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255); @@ -539,7 +539,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) VlakRen *vlr= (VlakRen*)is->hit.face; /* set up view vector */ - VECCOPY(shi->view, is->dir); + copy_v3_v3(shi->view, is->dir); /* render co */ shi->co[0]= is->start[0]+is->dist*(shi->view[0]); @@ -594,16 +594,16 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) } /* raytrace likes to separate the spec color */ - VECSUB(shr->diff, shr->combined, shr->spec); + sub_v3_v3v3(shr->diff, shr->combined, shr->spec); } } -static int refraction(float *refract, float *n, float *view, float index) +static int refraction(float refract[3], const float n[3], const float view[3], float index) { float dot, fac; - VECCOPY(refract, view); + copy_v3_v3(refract, view); dot= view[0]*n[0] + view[1]*n[1] + view[2]*n[2]; @@ -626,26 +626,26 @@ static int refraction(float *refract, float *n, float *view, float index) return 1; } +static void reflection_simple(float ref[3], float n[3], const float view[3]) +{ + const float f1= -2.0f * dot_v3v3(n, view); + madd_v3_v3v3fl(ref, view, n, f1); +} + /* orn = original face normal */ -static void reflection(float *ref, float *n, float *view, float *orn) +static void reflection(float ref[3], float n[3], const float view[3], const float orn[3]) { float f1; - - f1= -2.0f*(n[0]*view[0]+ n[1]*view[1]+ n[2]*view[2]); - - ref[0]= (view[0]+f1*n[0]); - ref[1]= (view[1]+f1*n[1]); - ref[2]= (view[2]+f1*n[2]); - if(orn) { - /* test phong normals, then we should prevent vector going to the back */ - f1= ref[0]*orn[0]+ ref[1]*orn[1]+ ref[2]*orn[2]; - if(f1>0.0f) { - f1+= .01f; - ref[0]-= f1*orn[0]; - ref[1]-= f1*orn[1]; - ref[2]-= f1*orn[2]; - } + reflection_simple(ref, n, view); + + /* test phong normals, then we should prevent vector going to the back */ + f1= dot_v3v3(ref, orn); + if(f1>0.0f) { + f1+= 0.01f; + ref[0]-= f1*orn[0]; + ref[1]-= f1*orn[1]; + ref[2]-= f1*orn[2]; } } @@ -672,8 +672,7 @@ static void color_combine(float *result, float fac1, float fac2, float *col1, fl static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) { - float dx, dy, dz, d, p; - + float d; if (0 == (shi->mat->mode & MA_TRANSP)) return -1; @@ -681,10 +680,12 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) d= 1.0f; } else { + float p; + /* shi.co[] calculated by shade_ray() */ - dx= shi->co[0] - is->start[0]; - dy= shi->co[1] - is->start[1]; - dz= shi->co[2] - is->start[2]; + const float dx= shi->co[0] - is->start[0]; + const float dy= shi->co[1] - is->start[1]; + const float dz= shi->co[2] - is->start[2]; d= sqrt(dx*dx+dy*dy+dz*dz); if (d > shi->mat->tx_limit) d= shi->mat->tx_limit; @@ -701,13 +702,13 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) return d; } -static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, float *vec) +static void ray_fadeout_endcolor(float col[3], ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, const float vec[3]) { /* un-intersected rays get either rendered material color or sky color */ if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) { - VECCOPY(col, shr->combined); + copy_v3_v3(col, shr->combined); } else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) { - VECCOPY(shi->view, vec); + copy_v3_v3(shi->view, vec); normalize_v3(shi->view); shadeSkyView(col, isec->start, shi->view, NULL, shi->thread); @@ -715,7 +716,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh } } -static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, float dist_mir) +static void ray_fadeout(Isect *is, ShadeInput *shi, float col[3], const float blendcol[3], float dist_mir) { /* if fading out, linear blend against fade color */ float blendfac; @@ -729,14 +730,14 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, /* the main recursive tracer itself * note: 'col' must be initialized */ -static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, float *start, float *dir, float *col, ObjectInstanceRen *obi, VlakRen *vlr, int traflag) +static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, const float start[3], const float dir[3], float col[4], ObjectInstanceRen *obi, VlakRen *vlr, int traflag) { ShadeInput shi= {0}; Isect isec; float dist_mir = origshi->mat->dist_mir; - VECCOPY(isec.start, start); - VECCOPY(isec.dir, dir ); + copy_v3_v3(isec.start, start); + copy_v3_v3(isec.dir, dir ); isec.dist = dist_mir > 0 ? dist_mir : RE_RAYTRACE_MAXDIST; isec.mode= RE_RAY_MIRROR; isec.check = RE_CHECK_VLR_RENDER; @@ -752,8 +753,8 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo float d= 1.0f; /* for as long we don't have proper dx/dy transform for rays we copy over original */ - VECCOPY(shi.dxco, origshi->dxco); - VECCOPY(shi.dyco, origshi->dyco); + copy_v3_v3(shi.dxco, origshi->dxco); + copy_v3_v3(shi.dyco, origshi->dyco); shi.mask= origshi->mask; shi.osatex= origshi->osatex; @@ -845,7 +846,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo float mircol[4]; float ref[3]; - reflection(ref, shi.vn, shi.view, NULL); + reflection_simple(ref, shi.vn, shi.view); traceray(origshi, origshr, depth-1, shi.co, ref, mircol, shi.obi, shi.vlr, 0); f1= 1.0f-f; @@ -896,7 +897,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo /* calc distributed planar energy */ -static void DP_energy(float *table, float *vec, int tot, float xsize, float ysize) +static void DP_energy(float *table, float vec[2], int tot, float xsize, float ysize) { int x, y, a; float *fp, force[3], result[3]; @@ -950,7 +951,7 @@ static void jitter_plane_offset(float *jitter1, float *jitter2, int tot, float s void init_jitter_plane(LampRen *lar) { float *fp; - int x, iter=12, tot= lar->ray_totsamp; + int x, tot= lar->ray_totsamp; /* test if already initialized */ if(lar->jitter) return; @@ -962,7 +963,8 @@ void init_jitter_plane(LampRen *lar) /* if 1 sample, we leave table to be zero's */ if(tot>1) { - + int iter=12; + /* set per-lamp fixed seed */ BLI_srandom(tot); @@ -1125,7 +1127,7 @@ static void QMC_getSample(double *s, QMCSampler *qsa, int thread, int num) } /* phong weighted disc using 'blur' for exponent, centred on 0,0 */ -static void QMC_samplePhong(float *vec, QMCSampler *qsa, int thread, int num, float blur) +static void QMC_samplePhong(float vec[3], QMCSampler *qsa, int thread, int num, float blur) { double s[2]; float phi, pz, sqr; @@ -1142,7 +1144,7 @@ static void QMC_samplePhong(float *vec, QMCSampler *qsa, int thread, int num, fl } /* rect of edge lengths sizex, sizey, centred on 0.0,0.0 i.e. ranging from -sizex/2 to +sizey/2 */ -static void QMC_sampleRect(float *vec, QMCSampler *qsa, int thread, int num, float sizex, float sizey) +static void QMC_sampleRect(float vec[3], QMCSampler *qsa, int thread, int num, float sizex, float sizey) { double s[2]; @@ -1154,7 +1156,7 @@ static void QMC_sampleRect(float *vec, QMCSampler *qsa, int thread, int num, flo } /* disc of radius 'radius', centred on 0,0 */ -static void QMC_sampleDisc(float *vec, QMCSampler *qsa, int thread, int num, float radius) +static void QMC_sampleDisc(float vec[3], QMCSampler *qsa, int thread, int num, float radius) { double s[2]; float phi, sqr; @@ -1170,7 +1172,7 @@ static void QMC_sampleDisc(float *vec, QMCSampler *qsa, int thread, int num, flo } /* uniform hemisphere sampling */ -static void QMC_sampleHemi(float *vec, QMCSampler *qsa, int thread, int num) +static void QMC_sampleHemi(float vec[3], QMCSampler *qsa, int thread, int num) { double s[2]; float phi, sqr; @@ -1187,7 +1189,7 @@ static void QMC_sampleHemi(float *vec, QMCSampler *qsa, int thread, int num) #if 0 /* currently not used */ /* cosine weighted hemisphere sampling */ -static void QMC_sampleHemiCosine(float *vec, QMCSampler *qsa, int thread, int num) +static void QMC_sampleHemiCosine(float vec[3], QMCSampler *qsa, int thread, int num) { double s[2]; float phi, sqr; @@ -1238,10 +1240,9 @@ static void release_thread_qmcsampler(Render *UNUSED(re), int UNUSED(thread), QM void free_render_qmcsampler(Render *re) { - QMCSampler *qsa, *next; - int a; - if(re->qmcsamplers) { + QMCSampler *qsa, *next; + int a; for(a=0; aqmcsamplers[a].first; qsa; qsa=next) { next= qsa->next; @@ -1256,7 +1257,7 @@ void free_render_qmcsampler(Render *re) } } -static int adaptive_sample_variance(int samples, float *col, float *colsq, float thresh) +static int adaptive_sample_variance(int samples, const float col[3], const float colsq[3], float thresh) { float var[3], mean[3]; @@ -1306,7 +1307,7 @@ static float get_avg_speed(ShadeInput *shi) /* ***************** main calls ************** */ -static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) +static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr) { QMCSampler *qsa=NULL; int samp_type; @@ -1345,7 +1346,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) if((shi->vlr->flag & R_SMOOTH)) reflection(v_refract, shi->vn, shi->view, shi->facenor); else - reflection(v_refract, shi->vn, shi->view, NULL); + reflection_simple(v_refract, shi->vn, shi->view); /* can't blur total external reflection */ max_samples = 1; @@ -1366,7 +1367,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) normalize_v3(v_refract_new); } else { /* no blurriness, use the original normal */ - VECCOPY(v_refract_new, v_refract); + copy_v3_v3(v_refract_new, v_refract); } sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; @@ -1406,7 +1407,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) release_thread_qmcsampler(&R, shi->thread, qsa); } -static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float fresnelfac) +static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float fresnelfac) { QMCSampler *qsa=NULL; int samp_type; @@ -1445,7 +1446,7 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f * if tangent shading enabled */ if (shi->mat->mode & (MA_TANGENT_V)) { cross_v3_v3v3(orthx, shi->vn, shi->tang); // bitangent - VECCOPY(orthy, shi->tang); + copy_v3_v3(orthy, shi->tang); mul_v3_fl(orthx, samp3d[0]); mul_v3_fl(orthy, samp3d[1]*aniso); } else { @@ -1460,13 +1461,13 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f normalize_v3(v_nor_new); } else { /* no blurriness, use the original normal */ - VECCOPY(v_nor_new, shi->vn); + copy_v3_v3(v_nor_new, shi->vn); } if((shi->vlr->flag & R_SMOOTH)) reflection(v_reflect, v_nor_new, shi->view, shi->facenor); else - reflection(v_reflect, v_nor_new, shi->view, NULL); + reflection_simple(v_reflect, v_nor_new, shi->view); sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; @@ -1517,7 +1518,7 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f /* extern call from render loop */ void ray_trace(ShadeInput *shi, ShadeResult *shr) { - float i, f, f1, fr, fg, fb; + float f1, fr, fg, fb; float mircol[4], tracol[4]; float diff[3]; int do_tra, do_mir; @@ -1527,12 +1528,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) /* raytrace mirror amd refract like to separate the spec color */ if(shi->combinedflag & SCE_PASS_SPEC) - VECSUB(diff, shr->combined, shr->spec) /* no ; */ + sub_v3_v3v3(diff, shr->combined, shr->spec); else - VECCOPY(diff, shr->combined); + copy_v3_v3(diff, shr->combined); if(do_tra) { - float olddiff[3]; + float olddiff[3], f; trace_refract(tracol, shi, shr); @@ -1542,24 +1543,23 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) fb= 1.0f+ shi->mat->filter*(shi->b-1.0f); /* for refract pass */ - VECCOPY(olddiff, diff); + copy_v3_v3(olddiff, diff); diff[0]= f*diff[0] + f1*fr*tracol[0]; diff[1]= f*diff[1] + f1*fg*tracol[1]; diff[2]= f*diff[2] + f1*fb*tracol[2]; if(shi->passflag & SCE_PASS_REFRACT) - VECSUB(shr->refr, diff, olddiff); + sub_v3_v3v3(shr->refr, diff, olddiff); if(!(shi->combinedflag & SCE_PASS_REFRACT)) - VECSUB(diff, diff, shr->refr); + sub_v3_v3v3(diff, diff, shr->refr); shr->alpha= MIN2(1.0f, tracol[3]); } if(do_mir) { - - i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir); + const float i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir); if(i!=0.0f) { trace_reflect(mircol, shi, shr, i); @@ -1597,12 +1597,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) if(shi->combinedflag & SCE_PASS_SPEC) VECADD(shr->combined, diff, shr->spec) /* no ; */ else - VECCOPY(shr->combined, diff); + copy_v3_v3(shr->combined, diff); } /* color 'shadfac' passes through 'col' with alpha and filter */ /* filter is only applied on alpha defined transparent part */ -static void addAlphaLight(float *shadfac, float *col, float alpha, float filter) +static void addAlphaLight(float shadfac[4], const float col[3], float alpha, float filter) { float fr, fg, fb; @@ -1621,19 +1621,20 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int { /* ray to lamp, find first face that intersects, check alpha properties, if it has col[3]>0.0f continue. so exit when alpha is full */ - ShadeInput shi; - ShadeResult shr; - float initial_dist = is->dist; - + const float initial_dist = is->dist; + if(RE_rayobject_raycast(R.raytree, is)) { - float d= 1.0f; - /* we got a face */ - - /* Warning, This is not that nice, and possibly a bit slow for every ray, - however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ - memset(&shi, 0, sizeof(ShadeInput)); + /* Warning regarding initializing to zero's, This is not that nice, + * and possibly a bit slow for every ray, however some variables were + * not initialized properly in, unless using + * shade_input_initialize(...), we need to zero them. */ + ShadeInput shi= {NULL}; /* end warning! - Campbell */ - + + ShadeResult shr; + + /* we got a face */ + shi.depth= origshi->depth + 1; /* only used to indicate tracing */ shi.mask= origshi->mask; shi.thread= origshi->thread; @@ -1647,9 +1648,9 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int shade_ray(is, &shi, &shr); if (shi.mat->material_type == MA_TYPE_SURFACE) { - if (traflag & RAY_TRA) - d= shade_by_transmission(is, &shi, &shr); - + const float d= (traflag & RAY_TRA) ? + shade_by_transmission(is, &shi, &shr) : + 1.0f; /* mix colors based on shadfac (rgb + amount of light factor) */ addAlphaLight(col, shr.diff, shr.alpha, d*shi.mat->filter); } else if (shi.mat->material_type == MA_TYPE_VOLUME) { @@ -1665,7 +1666,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int if(depth>0 && col[3]>0.0f) { /* adapt isect struct */ - VECCOPY(is->start, shi.co); + copy_v3_v3(is->start, shi.co); is->dist = initial_dist-is->dist; is->orig.ob = shi.obi; is->orig.face = shi.vlr; @@ -1702,7 +1703,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * isec.orig.face = ship->vlr; isec.hint = 0; - VECCOPY(isec.start, ship->co); + copy_v3_v3(isec.start, ship->co); RE_RC_INIT(isec, shi); @@ -1710,14 +1711,14 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * counter+=3; counter %= 768; - VECCOPY(vec, hashvectf+counter); + copy_v3_v3(vec, hashvectf+counter); if(ship->vn[0]*vec[0]+ship->vn[1]*vec[1]+ship->vn[2]*vec[2]>0.0f) { vec[0]-= vec[0]; vec[1]-= vec[1]; vec[2]-= vec[2]; } - VECCOPY(isec.dir, vec ); + copy_v3_v3(isec.dir, vec ); isec.dist = RE_RAYTRACE_MAXDIST; if(RE_rayobject_raycast(R.raytree, &isec)) { @@ -1751,7 +1752,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * } /* aolight: function to create random unit sphere vectors for total random sampling */ -static void RandomSpherical(float *v) +static void RandomSpherical(float v[3]) { float r; v[2] = 2.f*BLI_frand()-1.f; @@ -1765,7 +1766,7 @@ static void RandomSpherical(float *v) } /* calc distributed spherical energy */ -static void DS_energy(float *sphere, int tot, float *vec) +static void DS_energy(float *sphere, int tot, float vec[3]) { float *fp, fac, force[3], res[3]; int a; @@ -1863,13 +1864,15 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in } else { float *sphere; - float cosfi, sinfi, cost, sint; - float ang, *vec1; - int a; + float *vec1; // returns table if xs and ys were equal to last call, and not resetting sphere= (reset)? NULL: threadsafe_table_sphere(1, thread, xs, ys, tot); if(sphere==NULL) { + float cosfi, sinfi, cost, sint; + float ang; + int a; + sphere= threadsafe_table_sphere(0, thread, xs, ys, tot); // random rotation @@ -1890,7 +1893,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in } } -static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) +static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3]) { Isect isec; RayHint point_hint; @@ -1924,7 +1927,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) isec.mode= (R.wrld.aomode & WO_AODIST)?RE_RAY_SHADOW_TRA:RE_RAY_SHADOW; isec.lay= -1; - VECCOPY(isec.start, shi->co); + copy_v3_v3(isec.start, shi->co); RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start ); isec.hint = &point_hint; @@ -1943,10 +1946,10 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } if(shi->vlr->flag & R_SMOOTH) { - VECCOPY(nrm, shi->vn); + copy_v3_v3(nrm, shi->vn); } else { - VECCOPY(nrm, shi->facenor); + copy_v3_v3(nrm, shi->facenor); } ortho_basis_v3v3_v3( up, side,nrm); @@ -1990,7 +1993,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } else if(envcolor!=WO_AOPLAIN) { float skycol[4]; - float skyfac, view[3]; + float view[3]; view[0]= -dir[0]; view[1]= -dir[1]; @@ -1998,7 +2001,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - skyfac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + const float skyfac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); env[0]+= (1.0f-skyfac)*R.wrld.horr + skyfac*R.wrld.zenr; env[1]+= (1.0f-skyfac)*R.wrld.horg + skyfac*R.wrld.zeng; env[2]+= (1.0f-skyfac)*R.wrld.horb + skyfac*R.wrld.zenb; @@ -2039,7 +2042,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } /* extern call from shade_lamp_loop, ambient occlusion calculus */ -static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) +static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3]) { Isect isec; RayHint point_hint; @@ -2063,7 +2066,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) isec.mode= (R.wrld.aomode & WO_AODIST)?RE_RAY_SHADOW_TRA:RE_RAY_SHADOW; isec.lay= -1; - VECCOPY(isec.start, shi->co); + copy_v3_v3(isec.start, shi->co); RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start ); isec.hint = &point_hint; @@ -2128,7 +2131,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) } else if(envcolor!=WO_AOPLAIN) { float skycol[4]; - float fac, view[3]; + float view[3]; view[0]= -vec[0]; view[1]= -vec[1]; @@ -2136,7 +2139,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - fac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + const float fac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); env[0]+= (1.0f-fac)*R.wrld.horr + fac*R.wrld.zenr; env[1]+= (1.0f-fac)*R.wrld.horg + fac*R.wrld.zeng; env[2]+= (1.0f-fac)*R.wrld.horb + fac*R.wrld.zenb; @@ -2167,7 +2170,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) copy_v3_v3(env, ao); } -void ray_ao(ShadeInput *shi, float *ao, float *env) +void ray_ao(ShadeInput *shi, float ao[3], float env[3]) { /* Unfortunately, the unusual way that the sphere sampler calculates roughly twice as many * samples as are actually traced, and skips them based on bias and OSA settings makes it very difficult @@ -2214,12 +2217,12 @@ static void ray_shadow_jittered_coords(ShadeInput *shi, int max, float jitco[RE_ *totjitco= tot; } else { - VECCOPY(jitco[0], shi->co); + copy_v3_v3(jitco[0], shi->co); *totjitco= 1; } } -static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float *shadfac, Isect *isec) +static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3], float shadfac[4], Isect *isec) { QMCSampler *qsa=NULL; int samples=0; @@ -2276,7 +2279,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * isec->hint = &bb_hint; isec->check = RE_CHECK_VLR_RENDER; isec->skip = RE_SKIP_VLR_NEIGHBOUR; - VECCOPY(vec, lampco); + copy_v3_v3(vec, lampco); while (samples < max_samples) { @@ -2294,9 +2297,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * float ru[3], rv[3], v[3], s[3]; /* calc tangent plane vectors */ - v[0] = co[0] - lampco[0]; - v[1] = co[1] - lampco[1]; - v[2] = co[2] - lampco[2]; + sub_v3_v3v3(v, co, lampco); normalize_v3(v); ortho_basis_v3v3_v3( ru, rv,v); @@ -2308,7 +2309,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * s[1] = samp3d[0]*ru[1] + samp3d[1]*rv[1]; s[2] = samp3d[0]*ru[2] + samp3d[1]*rv[2]; - VECCOPY(samp3d, s); + copy_v3_v3(samp3d, s); } else { /* sampling, returns quasi-random vector in [sizex,sizey]^2 plane */ @@ -2321,7 +2322,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * end[1] = vec[1]+samp3d[1]; end[2] = vec[2]+samp3d[2]; } else { - VECCOPY(end, vec); + copy_v3_v3(end, vec); } if(shi->strand) { @@ -2329,7 +2330,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * float jitbias= 0.5f*(len_v3(shi->dxco) + len_v3(shi->dyco)); float v[3]; - VECSUB(v, co, end); + sub_v3_v3v3(v, co, end); normalize_v3(v); co[0] -= jitbias*v[0]; @@ -2337,7 +2338,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * co[2] -= jitbias*v[2]; } - VECCOPY(isec->start, co); + copy_v3_v3(isec->start, co); isec->dir[0] = end[0]-isec->start[0]; isec->dir[1] = end[1]-isec->start[1]; isec->dir[2] = end[2]-isec->start[2]; @@ -2393,7 +2394,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * release_thread_qmcsampler(&R, shi->thread, qsa); } -static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, float *shadfac, Isect *isec) +static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[3], float shadfac[4], Isect *isec) { /* area soft shadow */ float *jitlamp; @@ -2416,7 +2417,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, floa if(a==4) mask |= (mask>>4)|(mask>>8); else if(a==9) mask |= (mask>>9); - VECCOPY(isec->start, shi->co); + copy_v3_v3(isec->start, shi->co); isec->orig.ob = shi->obi; isec->orig.face = shi->vlr; RE_rayobject_hint_bb( R.raytree, &point_hint, isec->start, isec->start ); @@ -2477,7 +2478,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, floa } } /* extern call from shade_lamp_loop */ -void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) +void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4]) { Isect isec; float lampco[3]; @@ -2520,7 +2521,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) lampco[2]= shi->co[2] - R.maxdist*lar->vec[2]; } else { - VECCOPY(lampco, lar->co); + copy_v3_v3(lampco, lar->co); } if (ELEM(lar->ray_samp_method, LA_SAMP_HALTON, LA_SAMP_HAMMERSLEY)) { @@ -2536,8 +2537,8 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) shadfac[3]= 1.0f; // 1.0=full light /* set up isec.dir */ - VECCOPY(isec.start, shi->co); - VECSUB(isec.dir, lampco, isec.start); + copy_v3_v3(isec.start, shi->co); + sub_v3_v3v3(isec.dir, lampco, isec.start); isec.dist = normalize_v3(isec.dir); if(isec.mode==RE_RAY_SHADOW_TRA) { @@ -2545,7 +2546,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) float col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; ray_trace_shadow_tra(&isec, shi, DEPTH_SHADOW_TRA, 0, col); - QUATCOPY(shadfac, col); + copy_v4_v4(shadfac, col); } else if(RE_rayobject_raycast(R.raytree, &isec)) shadfac[3]= 0.0f; @@ -2584,15 +2585,15 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float lampco[2]= shi->co[2] - RE_RAYTRACE_MAXDIST*lar->vec[2]; } else { - VECCOPY(lampco, lar->co); + copy_v3_v3(lampco, lar->co); } isec.orig.ob = shi->obi; isec.orig.face = shi->vlr; /* set up isec.dir */ - VECCOPY(isec.start, shi->co); - VECCOPY(isec.end, lampco); + copy_v3_v3(isec.start, shi->co); + copy_v3_v3(isec.end, lampco); if(RE_rayobject_raycast(R.raytree, &isec)) { /* we got a face */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index bc5e7f23e21..fd824cee8a4 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -142,7 +142,7 @@ void calc_renderco_ortho(float co[3], float x, float y, int z) co[2]= R.winmat[3][2]/( R.winmat[2][3]*zco - R.winmat[2][2] ); } -void calc_renderco_zbuf(float co[3], float *view, int z) +void calc_renderco_zbuf(float co[3], const float view[3], int z) { float fac, zco; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 956a3d4de7c..5963c4c8ffd 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1355,16 +1355,14 @@ void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl /* Do AO or (future) GI */ void shade_samples_do_AO(ShadeSample *ssamp) { - ShadeInput *shi; - int sample; - if(!(R.r.mode & R_SHADOW)) return; if(!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX)) return; if(R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) { - shi= &ssamp->shi[0]; + ShadeInput *shi= &ssamp->shi[0]; + int sample; if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index c808d930e7c..66ae219a80a 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -119,7 +119,7 @@ static void fogcolor(float *colf, float *rco, float *view) #endif /* zcor is distance, co the 3d coordinate in eye space, return alpha */ -float mistfactor(float zcor, float *co) +float mistfactor(float zcor, float const co[3]) { float fac, hi; @@ -162,8 +162,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) double t0, t1 = 0.0f, t2= 0.0f, t3; float p1[3], p2[3], ladist, maxz = 0.0f, maxy = 0.0f, haint; int snijp, doclip=1, use_yco=0; - int ok1=0, ok2=0; - + *intens= 0.0f; haint= lar->haint; @@ -243,6 +242,8 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) } } if(snijp==2) { + int ok1=0, ok2=0; + /* sort */ if(t1>t2) { a= t1; t1= t2; t2= a; @@ -345,7 +346,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) } } -void renderspothalo(ShadeInput *shi, float *col, float alpha) +void renderspothalo(ShadeInput *shi, float col[4], float alpha) { ListBase *lights; GroupObject *go; @@ -891,12 +892,11 @@ void shade_color(ShadeInput *shi, ShadeResult *shr) static void ramp_diffuse_result(float *diff, ShadeInput *shi) { Material *ma= shi->mat; - float col[4], fac=0; + float col[4]; if(ma->ramp_col) { if(ma->rampin_col==MA_RAMP_IN_RESULT) { - - fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; + float fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; do_colorband(ma->ramp_col, fac, col); /* blending method */ @@ -911,8 +911,7 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi) static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, float g, float b) { Material *ma= shi->mat; - float col[4], colt[3], fac=0; - + if(ma->ramp_col && (ma->mode & MA_RAMP_COL)) { /* MA_RAMP_IN_RESULT is exceptional */ @@ -923,6 +922,9 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa diff[2] += b * shi->b; } else { + float colt[3], col[4]; + float fac; + /* input */ switch(ma->rampin_col) { case MA_RAMP_IN_ENERGY: @@ -934,6 +936,9 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa case MA_RAMP_IN_NOR: fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; break; + default: + fac= 0.0f; + break; } do_colorband(ma->ramp_col, fac, col); @@ -962,11 +967,11 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInput *shi) { Material *ma= shi->mat; - float col[4]; - float fac; - + if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { - fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb); + float col[4]; + float fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb); + do_colorband(ma->ramp_spec, fac, col); /* blending method */ @@ -978,19 +983,19 @@ static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInpu } /* is = dot product shade, t = spec energy */ -static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec) +static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3]) { Material *ma= shi->mat; - float col[4]; - float fac=0.0f; - + spec[0]= shi->specr; spec[1]= shi->specg; spec[2]= shi->specb; /* MA_RAMP_IN_RESULT is exception */ if(ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) { - + float fac; + float col[4]; + /* input */ switch(ma->rampin_spec) { case MA_RAMP_IN_ENERGY: @@ -1002,6 +1007,9 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec) case MA_RAMP_IN_NOR: fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; break; + default: + fac= 0.0f; + break; } do_colorband(ma->ramp_spec, fac, col); @@ -1086,7 +1094,7 @@ static void indirect_lighting_apply(ShadeInput *shi, ShadeResult *shr) } /* result written in shadfac */ -void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real) +void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real) { LampShadowSubSample *lss= &(lar->shadsamp[shi->thread].s[shi->sample]); @@ -1115,7 +1123,7 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float *shadfac, i } /* lampdistance and spot angle, writes in lv and dist */ -float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) +float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *dist) { if(lar->type==LA_SUN || lar->type==LA_HEMI) { *dist= 1.0f; @@ -1621,7 +1629,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) } /* let's map negative light as if it mirrors positive light, otherwise negative values disappear */ -static void wrld_exposure_correct(float *diff) +static void wrld_exposure_correct(float diff[3]) { diff[0]= R.wrld.linfac*(1.0f-exp( diff[0]*R.wrld.logfac) ); diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 840e5444ff0..15226493977 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -92,7 +92,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) Material *ma; StrandBuffer *strandbuf; float *simplify; - float p[4][3], data[4], cross[3], crosslen, w, dx, dy, t; + float p[4][3], data[4], cross[3], w, dx, dy, t; int type; strandbuf= sseg->buffer; @@ -164,7 +164,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) if(w > 0.0f) { if(strandbuf->flag & R_STRAND_B_UNITS) { - crosslen= len_v3(cross); + const float crosslen= len_v3(cross); w= 2.0f*crosslen*strandbuf->minwidth/w; if(spoint->width < w) { diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index f36994e0969..62a54a51102 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -1747,13 +1747,14 @@ static void zbuf_project_cache_clear(ZbufProjectCache *cache, int size) static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[][4], float *co, float *ho) { - int clipflag, cindex= index & 255; + int cindex= index & 255; if(cache[cindex].index == index) { QUATCOPY(ho, cache[cindex].ho); return cache[cindex].clip; } else { + int clipflag; projectvert(co, winmat, ho); clipflag= testclip(ho); @@ -1775,14 +1776,16 @@ static void zbuffer_part_bounds(int winx, int winy, RenderPart *pa, float *bound static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][4], float *bounds, float *co, float *ho) { - float vec[3], wco; - int clipflag= 0, cindex= index & 255; + float vec[3]; + int cindex= index & 255; if(cache[cindex].index == index) { QUATCOPY(ho, cache[cindex].ho); return cache[cindex].clip; } else { + float wco; + int clipflag= 0; VECCOPY(vec, co) projectvert(co, winmat, ho); -- cgit v1.2.3 From 1ddb64817dadf02d006a6db5ea4ad230484b5aca Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 24 Sep 2011 16:17:23 +0000 Subject: Minor: Added PROP_DISTANCE sub-type to min/max dstances of WeightVG Proximity, and Radius of Warp modifiers. --- source/blender/makesrna/intern/rna_modifier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 33f5e41b2cc..00ac371f929 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -805,7 +805,7 @@ static void rna_def_modifier_warp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Falloff Type", ""); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE); RNA_def_property_ui_text(prop, "Radius", "Radius to apply"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -2775,13 +2775,13 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); - prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0); RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0 (or weight 1.0 if above Highest Dist)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0); RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0 (or weight 0.0 if below Lowest Dist)"); -- cgit v1.2.3 From 3b40eea3cd88f2e927d95c8f1197195ebc7e600e Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 24 Sep 2011 22:15:37 +0000 Subject: removing texface rna - changelog.rst update soon --- source/blender/makesrna/intern/rna_mesh.c | 73 ------------------------------- 1 file changed, 73 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 67bb7bffcfb..a43aa709dd6 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1424,79 +1424,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); -- cgit v1.2.3 From 51555877b0e041e779cb59517ce978e81f924498 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 24 Sep 2011 23:50:00 +0000 Subject: manual update on changelog (python API) Change as suggested by Campbell. I'm not sure if this is the way to do for enums, I will check with him later --- source/blender/makesrna/intern/rna_mesh.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index a43aa709dd6..00c79c32b3a 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1366,12 +1366,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); -- cgit v1.2.3 From 81f7e361d290a595a40f5811422e03f7560ff9f3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 02:49:46 +0000 Subject: make new rna variables more consistant with existing names. --- source/blender/makesrna/intern/rna_armature.c | 2 +- source/blender/makesrna/intern/rna_object.c | 2 +- source/blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/makesrna/intern/rna_sound.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index ec928415876..a834fcf820b 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -867,7 +867,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", ""); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 6c273ff9f2e..1f3a134f14d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1524,7 +1524,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) 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"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 86682af189c..96e6eea22af 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1421,7 +1421,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"); 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"); -- cgit v1.2.3 From e3c9986b7c229c35133d2b887b596320dcf81f36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 04:47:46 +0000 Subject: fix [#28459] Fly mode problem: "Precision enable" not working in 2.59 also added back freelook (from 2.4x) - so you can loop about without changing direction. --- source/blender/editors/space_view3d/view3d_fly.c | 130 +++++++++++++---------- 1 file changed, 73 insertions(+), 57 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 30d1a508888..1ce246a5542 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -62,49 +62,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 +130,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 +152,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 +169,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 */ @@ -289,7 +301,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; @@ -516,10 +529,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 +547,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 +612,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 +718,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 +900,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 +908,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 +985,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; -- cgit v1.2.3 From 2d5dd02db86813fcf984dbb9d2a90c8bf2ee5f24 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 04:55:04 +0000 Subject: correction to armature drawing code, was implicitly casting the bone flag to a short when it contains flags in the int range. also was converting pose bone constflag to an int which is harmless but may as well not to it. --- source/blender/editors/space_view3d/drawarmature.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index fc35ab93f70..210d6d344cd 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: @@ -752,7 +752,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]; @@ -861,7 +861,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 +991,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 +1125,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 +1238,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 +1288,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 +1659,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 +1880,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 +1902,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 +1936,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); -- cgit v1.2.3 From 0f21ecdb166d73e0b4786cd9eb625f901d48c1bb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 05:48:16 +0000 Subject: added bone envelope to the editbone UI, also use more BLI_math functions for armature drawing. --- source/blender/editors/space_view3d/drawarmature.c | 52 ++++++++-------------- .../blender/editors/space_view3d/view3d_buttons.c | 1 + 2 files changed, 19 insertions(+), 34 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 210d6d344cd..3f45e32937d 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -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); @@ -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(); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 6c69e816b30..117dfda4551 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -986,6 +986,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) -- cgit v1.2.3 From 58a74bc87faf30b036d3088b8f741b353296b6a4 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 25 Sep 2011 07:03:20 +0000 Subject: BGE Animations: Fixing various Action Actuator compatibility issues reported by Dalai in issue #28723. --- source/gameengine/Converter/BL_ActionActuator.cpp | 31 ++++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'source') 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; } -- cgit v1.2.3 From 3379099a6ea212eb9bb08b9271940658b85fdcd4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 07:42:43 +0000 Subject: patch [#28616] Multiple particle systems support from Andrea Rugliancich (andrearu01) --- source/blender/makesrna/intern/rna_particle.c | 57 +++++++++++++++------------ 1 file changed, 31 insertions(+), 26 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 77fa975761f..5dc2f2ccac5 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -145,33 +145,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; itotpart; 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) -- cgit v1.2.3 From 9931c9442e16867ac2117a60b5a41839df76a454 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 25 Sep 2011 09:55:13 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_object.c | 94 +++++++++++++++-------- source/blender/makesrna/intern/rna_object_force.c | 21 ++--- source/blender/makesrna/intern/rna_scene.c | 20 ++--- 3 files changed, 84 insertions(+), 51 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 1f3a134f14d..f271673d278 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -387,7 +387,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 +419,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; @@ -889,7 +891,8 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int 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; @@ -1172,7 +1175,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 +1357,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 +1376,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"); @@ -1399,7 +1405,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "body_type"); RNA_def_property_enum_items(prop, body_type_items); - RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); + RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", + "rna_GameObjectSettings_physics_type_set", NULL); RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1475,7 +1482,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 +1491,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 +1506,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,7 +1528,8 @@ 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"); @@ -1678,7 +1689,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 +1714,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 +1806,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 +1891,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 */ @@ -1908,7 +1928,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 +1996,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 +2040,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 +2278,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 +2293,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 +2305,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 +2316,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..c046c222898 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1049,18 +1049,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[] = { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 774e21297da..a9460429c0b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1392,7 +1392,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}}; @@ -1506,7 +1506,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); @@ -2380,7 +2380,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); @@ -2431,7 +2433,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 */ @@ -2590,19 +2592,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); @@ -2646,7 +2648,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); @@ -2669,7 +2671,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"); -- cgit v1.2.3 From 558b646216feaa43abf44eb332d2449c68bf1b39 Mon Sep 17 00:00:00 2001 From: Alex Fraser Date: Sun, 25 Sep 2011 11:51:28 +0000 Subject: Committing patch #27442: Adaptive time step for fluid particles. The number of subframes can now be altered automatically while an SPH (fluid particle) simulation is running. --- source/blender/blenkernel/BKE_particle.h | 4 + source/blender/blenkernel/intern/particle.c | 1 + source/blender/blenkernel/intern/particle_system.c | 124 ++++++++++++++++++--- source/blender/blenloader/intern/readfile.c | 9 +- source/blender/makesdna/DNA_particle_types.h | 12 +- source/blender/makesrna/intern/rna_particle.c | 27 ++++- 6 files changed, 156 insertions(+), 21 deletions(-) (limited to 'source') 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/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 82a2436a010..06fb2d3927c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3488,6 +3488,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..c0f1e3dd697 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -26,6 +26,9 @@ * * Contributor(s): Raul Fernandez Hernandez (Farsthary), Stephen Swhitehorn. * + * Adaptive time step + * Copyright 2011 AutoCRC + * * ***** END GPL LICENSE BLOCK ***** */ @@ -2321,6 +2324,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 +2335,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 +2356,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 +2413,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 +2423,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 +2497,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 +2517,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 +2526,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 +3611,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 +3669,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 +3807,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 +3817,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 +4029,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 +4135,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/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ecd3c9b5dad..d62f6657e41 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12066,7 +12066,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ { - + { + /* Adaptive time step for particle systems */ + ParticleSettings *part; + for (part = main->particle.first; part; part = part->id.next) { + part->courant_target = 0.2; + part->time_flag &= ~PART_TIME_AUTOSF; + } + } } //set defaults for obstacle avoidance, recast data 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/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 5dc2f2ccac5..56738dd9f11 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 ***** */ @@ -2049,12 +2052,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); @@ -2862,6 +2876,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"); } -- cgit v1.2.3 From 274b9c8fb88ff6499ac3b13a081c1e60965e459e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2011 12:31:21 +0000 Subject: whitespace cleanup --- source/blender/blenkernel/intern/implicit.c | 4 ++-- source/blender/blenkernel/intern/ipo.c | 2 +- source/blender/blenkernel/intern/material.c | 4 ++-- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/collada/AnimationImporter.cpp | 22 +++++++++--------- source/blender/collada/MeshImporter.cpp | 2 +- .../blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/animation/keyframing.c | 4 ++-- source/blender/editors/include/ED_anim_api.h | 2 +- source/blender/editors/interface/view2d_ops.c | 2 +- source/blender/editors/screen/area.c | 4 ++-- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/space_info/info_draw.c | 2 +- .../blender/editors/space_outliner/outliner_draw.c | 2 +- source/blender/editors/transform/transform.h | 4 ++-- .../editors/transform/transform_conversions.c | 4 ++-- source/blender/gpu/intern/gpu_buffers.c | 2 +- source/blender/gpu/intern/gpu_draw.c | 2 +- source/blender/imbuf/intern/indexer.c | 4 ++-- source/blender/makesdna/DNA_cloth_types.h | 2 +- source/blender/makesdna/DNA_constraint_types.h | 2 +- source/blender/makesdna/DNA_ipo_types.h | 2 +- source/blender/makesdna/DNA_modifier_types.h | 2 +- source/blender/makesdna/DNA_scene_types.h | 10 ++++----- source/blender/makesrna/intern/rna_userdef.c | 2 +- .../nodes/composite/nodes/node_composite_image.c | 2 +- source/blender/nodes/intern/node_common.c | 4 ++-- .../blender/render/intern/raytrace/rayobject.cpp | 2 +- .../render/intern/raytrace/rayobject_qbvh.cpp | 4 ++-- .../render/intern/raytrace/rayobject_svbvh.cpp | 4 ++-- .../render/intern/raytrace/rayobject_vbvh.cpp | 4 ++-- .../blender/render/intern/source/convertblender.c | 2 +- source/creator/creator.c | 2 +- source/gameengine/Converter/BL_ArmatureChannel.cpp | 26 +++++++++++----------- .../Converter/BL_BlenderDataConversion.cpp | 2 +- source/gameengine/Expressions/KX_HashedPtr.cpp | 2 +- source/gameengine/Expressions/ListValue.cpp | 14 ++++++------ source/gameengine/Expressions/PyObjectPlus.h | 2 +- .../gameengine/GameLogic/SCA_JoystickManager.cpp | 6 ++--- source/gameengine/Ketsji/KX_CameraActuator.cpp | 2 +- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 10 ++++----- source/gameengine/Ketsji/KX_MouseFocusSensor.h | 2 +- source/gameengine/Ketsji/KX_NearSensor.cpp | 4 ++-- source/gameengine/Ketsji/KX_ObjectActuator.h | 2 +- source/gameengine/Ketsji/KX_ParentActuator.h | 6 ++--- source/gameengine/Ketsji/KX_PythonSeq.cpp | 6 ++--- source/gameengine/Ketsji/KX_SCA_DynamicActuator.h | 8 +++---- source/gameengine/Network/NG_NetworkMessage.h | 2 +- source/gameengine/SceneGraph/SG_Node.cpp | 4 ++-- 50 files changed, 108 insertions(+), 108 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 099661f7914..295669c98c0 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -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..71ca79706db 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -317,7 +317,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)) { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f5df6efd622..f27046fe603 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1283,7 +1283,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; @@ -1772,7 +1772,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 */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 1454b3f0ce3..6741ff2d018 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -428,7 +428,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; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d62f6657e41..f80607a41b7 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9985,7 +9985,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; diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index a176b6eb4cd..9d96814c403 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -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 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::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::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/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_edit.c b/source/blender/editors/animation/anim_channels_edit.c index d58d51c8e08..7f05a7c2b1a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -366,7 +366,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/keyframing.c b/source/blender/editors/animation/keyframing.c index 58e1549c0ed..b52550832c3 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 */ diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index b730913a368..3c810f7da2d 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -426,7 +426,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/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/screen/area.c b/source/blender/editors/screen/area.c index 8951df9221e..041cb9091d9 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1375,9 +1375,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/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index eb919261127..5fe47f836d7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3702,7 +3702,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; 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_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/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..b7a5f4bd979 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5314,7 +5314,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 +5327,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/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index ce3a378ea00..0aaddf0dea5 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) { diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 4f79d577ae5..120c203e7bd 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, 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/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..229f14dbaf3 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -808,7 +808,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_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 9f176a22848..f0f346fb759 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -236,8 +236,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: */ @@ -479,8 +479,8 @@ typedef struct GameData { } 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 @@ -838,7 +838,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/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 44d645f970f..b81b370a890 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2777,7 +2777,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); 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..8225c986409 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); 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 27c825ebdeb..195b037727e 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1349,7 +1349,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++); diff --git a/source/creator/creator.c b/source/creator/creator.c index 56108f6c251..d25b0be30d8 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -483,7 +483,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); 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/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..d3b2eacbb4d 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -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_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/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_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_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_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/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/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) -- cgit v1.2.3 From 7c46f1c4b77873c27485bc278e04195611237602 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Sun, 25 Sep 2011 12:33:51 +0000 Subject: Fix some MSVC 2010 warnings (including one apparent bug in intern/elbeem/intern/solver_relax.h) --- source/blender/avi/intern/options.c | 6 ++++-- source/blender/blenlib/intern/pbvh.c | 2 +- source/blender/blenlib/intern/storage.c | 4 ++-- source/blender/blenloader/intern/readfile.c | 4 ++-- source/blender/editors/include/UI_interface_icons.h | 4 ++-- source/blender/editors/space_console/space_console.c | 2 +- source/blender/editors/space_file/file_draw.c | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) (limited to 'source') 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/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..f088c5e2787 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -478,12 +478,12 @@ 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"); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f80607a41b7..6163fa015a8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12070,7 +12070,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* Adaptive time step for particle systems */ ParticleSettings *part; for (part = main->particle.first; part; part = part->id.next) { - part->courant_target = 0.2; + part->courant_target = 0.2f; part->time_flag &= ~PART_TIME_AUTOSF; } } @@ -12089,7 +12089,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) 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; + 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) 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/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..f7abb01546f 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -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; } -- cgit v1.2.3 From a932f93098ae64edbfd79ff3debe9712a55f2421 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 25 Sep 2011 15:37:06 +0000 Subject: Commented and tagged some unused vars (gcc warnings...). --- .../editors/animation/anim_channels_defines.c | 4 +- source/blender/editors/animation/fmodifier_ui.c | 10 ++-- .../editors/armature/editarmature_retarget.c | 16 ++++-- source/blender/editors/mesh/editmesh_mods.c | 4 +- source/blender/editors/mesh/editmesh_tools.c | 60 +++++++++++----------- 5 files changed, 51 insertions(+), 43 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 373d351fb6c..e8af5a8f290 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3051,7 +3051,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; @@ -3060,7 +3060,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/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/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/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 8c035ca46fd..3f9d793cd70 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 c8e3075ac60..40d3ccb015c 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; -- cgit v1.2.3 From 4b273f013e043d2f64997bc60f0058e0898e49b8 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 26 Sep 2011 05:26:04 +0000 Subject: cmake files for bundling blenderplayer in OSX this is working fine. The only problem is described in the XXX there. While Blender is linked to the right place during `make` time (~/bin/blender.app/Content/MacOS/blender) blenderplayer is in the top bin folder (~/bin/blenderplayer). That means it will be correct only after you run `make install` (we are moving it to the right place inside the bundle). I couldn't find the place to fix this properly. I will see with Jens Verwiebe how we can address that. --- source/creator/CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 0b5d9f7c15c..87fd880ee72 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -709,6 +709,63 @@ elseif(APPLE) \${TARGETDIR_VER} ) endif() + + # install blenderplayer bundle - copy of blender.app above. re-using macros et al + if(WITH_GAMEENGINE AND WITH_PLAYER) + set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) + set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) + set(TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION}) + + # setup Info.plist + execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + + # important to make a clean install each time else old scripts get loaded. + install( + CODE + "file(REMOVE_RECURSE ${TARGETDIR_VER})" + ) + + # message after building. + add_custom_command( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}' + ) + + install( + FILES ${SOURCEDIR}/Contents/PkgInfo + DESTINATION ${TARGETDIR}/blenderplayer.app/Contents + ) + + install_dir( + ${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 + \${TARGETDIR_VER} + ) + endif() + + # This is a hack. Blender is linked to the right place (inside the .app) + # blenderplayer not ... that also means blenderplayer is in the right place + # only when we do make install. XXX to be fixed. + install( + CODE + "file(RENAME ${TARGETDIR}/blenderplayer ${TARGETDIR}/blenderplayer.app/Contents/MacOS/blenderplayer)" + ) + + endif() endif() unset(BLENDER_TEXT_FILES) -- cgit v1.2.3 From 11a0e008199a98c3e5863a6e5cc5357f2b949c55 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 26 Sep 2011 06:39:19 +0000 Subject: BGE Material settings renaming Back Culling to Backface Culling and make it on by default under suggestion of Mitchell Stokes (Moguri) --- source/blender/blenkernel/intern/material.c | 2 +- source/blender/makesrna/intern/rna_material.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f27046fe603..a25da56d573 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -193,7 +193,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; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 6ed2147ce1b..54631da7bca 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, "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); -- cgit v1.2.3 From 8f302f7ffde9f44d7016bae3d74c20b41869b6c7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 07:39:29 +0000 Subject: bugfix [#28744] Object mapped textures (decals) in linked files are not rendered properly --- source/blender/render/intern/source/convertblender.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 195b037727e..b972569fdf6 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4852,8 +4852,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); -- cgit v1.2.3 From aeafb960b198788b0836e16a70622a4c8863d268 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 26 Sep 2011 07:54:30 +0000 Subject: OSX - cmake: blenderplayer part 2: Jens Verwiever co-patch Using OSX Bundle (in oppose to Blender dummy .app) as start point for binary. That way we don't need to move the blenderplayer after the bundle is finished and we can rebuild it without doing `make install` I will test more tomorrow, but it should be working now --- source/blenderplayer/CMakeLists.txt | 2 ++ source/creator/CMakeLists.txt | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index c8bf3b002f1..3ab1b4a3cdd 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -63,6 +63,8 @@ if(WIN32 AND NOT UNIX) endif() add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc) +elseif(APPLE) + add_executable(blenderplayer MACOSX_BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/dna.c) else() add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c) endif() diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 87fd880ee72..0bd2763c7d2 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -711,6 +711,7 @@ elseif(APPLE) 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(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) @@ -719,6 +720,11 @@ elseif(APPLE) # setup Info.plist execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + set_target_properties(blender PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${SOURCEINFO} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION} + MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}") + # important to make a clean install each time else old scripts get loaded. install( CODE @@ -756,14 +762,6 @@ elseif(APPLE) \${TARGETDIR_VER} ) endif() - - # This is a hack. Blender is linked to the right place (inside the .app) - # blenderplayer not ... that also means blenderplayer is in the right place - # only when we do make install. XXX to be fixed. - install( - CODE - "file(RENAME ${TARGETDIR}/blenderplayer ${TARGETDIR}/blenderplayer.app/Contents/MacOS/blenderplayer)" - ) endif() endif() -- cgit v1.2.3 From b3d21088aa924a8930b6577d4f9e9639f7779371 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 08:33:51 +0000 Subject: workaround/fix for [#28379] Shift+F problem when using Ortho Camera temp switch to perspective mode since fly mode doesnt really make sense for otho view. --- source/blender/editors/space_view3d/view3d_fly.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 1ce246a5542..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" @@ -199,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 */ @@ -330,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)) { @@ -433,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 */ -- cgit v1.2.3 From f0cceedd7ac61464ffea0ede7893c03d998ac7e6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Sep 2011 08:51:02 +0000 Subject: Fix #28747: Crash in Node Editor Setting of transform flags happened with NULL edittree --- source/blender/editors/transform/transform_conversions.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index b7a5f4bd979..54ab93b5fcf 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5227,6 +5227,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))) -- cgit v1.2.3 From 0aa19de52ff0b65352268f1d3728922be48e1c47 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 09:31:24 +0000 Subject: add missing imports to wm.py and remove "." from rna descriptions. --- source/blender/makesrna/intern/rna_particle.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 56738dd9f11..1d8a91861d6 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -2068,7 +2068,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) 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_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); @@ -2881,7 +2881,7 @@ static void rna_def_particle_system(BlenderRNA *brna) * 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_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"); @@ -2903,4 +2903,3 @@ void RNA_def_particle(BlenderRNA *brna) } #endif - -- cgit v1.2.3 From 573ed73be85d7f6342567bdaebbd0662c7428800 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 10:35:47 +0000 Subject: change define INTERNATIONAL --> WITH_INTERNATIONAL also rename backface_culling --> use_backface_culling (which is used elsewhere in rna) --- source/blender/blenfont/BLF_translation.h | 2 +- source/blender/blenfont/CMakeLists.txt | 2 +- source/blender/blenfont/SConscript | 2 +- source/blender/blenfont/intern/blf_lang.c | 6 +++--- source/blender/blenfont/intern/blf_translation.c | 6 +++--- source/blender/editors/interface/CMakeLists.txt | 2 +- source/blender/editors/interface/SConscript | 2 +- source/blender/editors/interface/interface.c | 10 +++++----- source/blender/editors/interface/interface_draw.c | 4 ++-- source/blender/editors/interface/interface_handlers.c | 8 ++++---- source/blender/editors/interface/interface_layout.c | 4 ++-- source/blender/editors/interface/interface_panel.c | 2 +- source/blender/editors/interface/interface_style.c | 2 +- source/blender/makesrna/SConscript | 2 +- source/blender/makesrna/intern/CMakeLists.txt | 2 +- source/blender/makesrna/intern/SConscript | 2 +- source/blender/makesrna/intern/rna_access.c | 6 +++--- source/blender/makesrna/intern/rna_material.c | 2 +- source/blender/python/SConscript | 2 +- source/blender/python/intern/CMakeLists.txt | 2 +- source/blender/python/intern/bpy_rna.c | 6 +++--- source/blender/windowmanager/CMakeLists.txt | 2 +- source/blender/windowmanager/SConscript | 2 +- source/blender/windowmanager/intern/wm_init_exit.c | 2 +- source/gameengine/GamePlayer/ghost/CMakeLists.txt | 2 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 2 +- source/gameengine/GamePlayer/ghost/SConscript | 2 +- 27 files changed, 44 insertions(+), 44 deletions(-) (limited to 'source') 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..838a36d9fe2 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -55,7 +55,7 @@ if(WITH_INTERNATIONAL) list(APPEND INC_SYS ${GETTEXT_INC} ) - 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..b5c6b5bd68c 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 @@ -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 -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include #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/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..8f440f7b61a 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 @@ -2741,7 +2741,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 diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index a1275e237c1..fd437d2b0e5 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -500,7 +500,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 +670,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) } } -#endif // INTERNATIONAL +#endif // WITH_INTERNATIONAL #endif static void draw_scope_end(rctf *rect, GLint *scissor) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 125928c136b..e4776cdb5f2 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; @@ -3924,7 +3924,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 */ @@ -4584,7 +4584,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; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3c02f7d4bd2..ae66d649a06 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 } @@ -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 } 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_style.c b/source/blender/editors/interface/interface_style.c index 3a9879384a3..2a183e3d994 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -322,7 +322,7 @@ void uiStyleInit(void) 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; diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index d0002eda30b..da186a57c8b 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -63,6 +63,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 966bc8f100c..99c7a0e2476 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -220,7 +220,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/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b7709416a75..b52de6a49b6 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 @@ -1160,7 +1160,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; diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 54631da7bca..80a418a0047 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -767,7 +767,7 @@ 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, "backface_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, "Backface Culling", "Hide Back of the face in Game Engine "); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index f00d49fe8dd..3f47038687a 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -41,7 +41,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/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index e628ea10e9c..0d5b980acba 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -96,7 +96,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_rna.c b/source/blender/python/intern/bpy_rna.c index 013eac7fd58..3175c0d088e 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 @@ -1523,11 +1523,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 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/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index cf3f12da767..3d7737830eb 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 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']) -- cgit v1.2.3 From c23bc0338295cc328534e2a045eee343e248ee69 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 26 Sep 2011 12:08:04 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_scene.c | 192 +++++++++++++++++++---------- 1 file changed, 127 insertions(+), 65 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index a9460429c0b..5332d7b1657 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -628,7 +628,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, "", ""}; @@ -669,7 +670,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, "", ""}; @@ -740,7 +742,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; @@ -1112,7 +1115,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}}; @@ -1165,7 +1169,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); @@ -1228,7 +1233,8 @@ 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 */ @@ -1257,11 +1263,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 */ @@ -1372,11 +1381,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"); } @@ -1790,8 +1801,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}}; @@ -1904,7 +1917,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 */ @@ -1962,35 +1976,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 */ @@ -2007,7 +2030,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); @@ -2016,7 +2041,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); @@ -2149,13 +2175,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); @@ -2692,21 +2720,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); @@ -2730,7 +2759,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); @@ -2741,12 +2771,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); @@ -2768,7 +2801,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); @@ -2829,7 +2864,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); @@ -2860,31 +2896,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); @@ -2894,7 +2932,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); @@ -2904,12 +2943,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); @@ -2920,7 +2962,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); @@ -2942,7 +2985,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); @@ -2953,13 +2997,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); @@ -2970,7 +3018,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 */ @@ -2996,11 +3046,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); @@ -3018,7 +3071,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"); @@ -3037,7 +3090,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); @@ -3057,7 +3110,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); @@ -3077,17 +3130,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); @@ -3142,14 +3196,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"); @@ -3159,7 +3212,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); @@ -3198,7 +3252,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); @@ -3334,7 +3388,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); } @@ -3360,7 +3415,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); } @@ -3388,7 +3444,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); @@ -3396,7 +3453,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); @@ -3485,7 +3542,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); @@ -3506,7 +3564,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) */ @@ -3516,7 +3574,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 */ @@ -3558,9 +3617,11 @@ 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", 0, 0, 0); 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); @@ -3613,7 +3674,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); -- cgit v1.2.3 From 3cff99c9a17aa20273c48afe45266c45608b118c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 26 Sep 2011 13:24:42 +0000 Subject: Commented and tagged some unused vars (gcc warnings...). Also fixed some uninitialized warnings. --- source/blender/blenkernel/intern/BME_conversions.c | 14 +++++++------- source/blender/editors/armature/reeb.c | 4 ++-- source/blender/editors/object/object_vgroup.c | 2 +- source/blender/editors/space_text/text_python.c | 4 ++-- source/blender/editors/util/undo.c | 2 +- source/blender/editors/uvedit/uvedit_parametrizer.c | 10 +++++----- 6 files changed, 18 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index 4f83d25409a..9a3c9462934 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -353,7 +353,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; @@ -410,14 +410,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; @@ -539,7 +539,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; @@ -567,7 +567,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/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/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 5265261f3af..e55a99ae2ab 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -939,7 +939,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"); 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/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); -- cgit v1.2.3 From dc19877a09e307b91378565cca6e42aca6f68d9e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Sep 2011 14:29:39 +0000 Subject: Remove PROP_TRANSLATE flag from labels for operators, menus and panels. This flag lead to storing translated label for templates and instant language switching became impossible. This labels are display-time translated. --- source/blender/makesrna/intern/rna_ui.c | 4 ++-- source/blender/makesrna/intern/rna_wm.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 587e56443ff..52c359d79dd 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", @@ -785,7 +785,7 @@ static void rna_def_menu(BlenderRNA *brna) "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the " "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_wm.c b/source/blender/makesrna/intern/rna_wm.c index c6805206051..8fa780de498 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -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"); -- cgit v1.2.3 From fbdfdfefd814128520198c033866cc50298f1758 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 16:53:04 +0000 Subject: use BLI_snprintf rather than sprintf for interface functions --- source/blender/editors/interface/interface.c | 6 +++--- source/blender/editors/interface/interface_draw.c | 3 ++- .../blender/editors/interface/interface_handlers.c | 8 ++++---- .../blender/editors/interface/interface_layout.c | 2 +- .../blender/editors/interface/interface_regions.c | 24 ++++++++++++---------- source/blender/editors/interface/interface_style.c | 2 +- .../editors/interface/interface_templates.c | 15 ++++++-------- source/blender/editors/interface/interface_utils.c | 3 ++- 8 files changed, 32 insertions(+), 31 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 8f440f7b61a..49156d3cf4a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2143,8 +2143,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 +2157,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) { diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index fd437d2b0e5..b65be48f7ee 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" @@ -835,7 +836,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 e4776cdb5f2..568eaf358e5 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -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); } @@ -4367,7 +4367,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); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ae66d649a06..ab07cb4bbf6 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -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); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4221f7c30ff..c0d6a07bdde 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -230,9 +230,11 @@ void ui_set_name_menu(uiBut *but, int value) int i; md= decompose_menu_string(but->str); - for (i=0; initems; i++) - if (md->items[i].retval==value) - strcpy(but->drawstr, md->items[i].str); + for (i=0; initems; i++) { + if (md->items[i].retval==value) { + BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr)); + } + } menudata_free(md); } @@ -1798,7 +1800,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 +1988,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 +2060,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); @@ -2369,7 +2371,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 +2469,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 +2509,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); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 2a183e3d994..3009d4fea09 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -315,7 +315,7 @@ 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; } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index bec9e6a7664..a4622f50725 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -412,7 +412,7 @@ 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"))); @@ -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)) @@ -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); 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; -- cgit v1.2.3 From dc76be62d99f4da1983cfa84aa9c6d86124064ab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 17:30:56 +0000 Subject: replace strnlen with BLI_strnlen, make some args const - no functional changes. --- source/blender/editors/include/UI_interface.h | 2 +- source/blender/editors/interface/interface.c | 22 +++++++++++----------- source/blender/editors/interface/interface_anim.c | 2 +- .../blender/editors/interface/interface_intern.h | 6 +++--- .../blender/editors/interface/interface_regions.c | 19 ++++++++----------- .../blender/editors/interface/interface_widgets.c | 4 ++-- 6 files changed, 26 insertions(+), 29 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index f5abebbebd5..67b17a891ca 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -576,7 +576,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); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 49156d3cf4a..aad67b6b0be 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1528,7 +1528,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 +1576,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; @@ -2176,7 +2176,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 +2194,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 +2226,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 +2242,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 */ } @@ -2822,12 +2822,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_intern.h b/source/blender/editors/interface/interface_intern.h index 72eb869dea0..94eb180bd06 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -364,8 +364,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); @@ -517,7 +517,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_regions.c b/source/blender/editors/interface/interface_regions.c index c0d6a07bdde..4a9eb8113fe 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); @@ -1613,7 +1613,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); @@ -2154,7 +2154,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); } @@ -2204,8 +2204,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; @@ -2277,10 +2275,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); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 45829646145..62bb93055b5 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); @@ -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]); -- cgit v1.2.3 From e897c8e83e1277767d9a44cb0ecb6f8a279dddc3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 17:32:50 +0000 Subject: fix [#28742] UILayout.menu() with icon misbehaves in headers --- source/blender/editors/interface/interface_widgets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 62bb93055b5..0215cc05d36 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -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; -- cgit v1.2.3 From 58587a38818b0dba25886c97d584285fef4e9249 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2011 18:51:10 +0000 Subject: replace strncpy with BLI_strncpy, in some cases strncpy was being misused since it doesnt ensure \0 termination. also dont call CTX_data_scene() twice when checking for function arguments. --- source/blender/blenfont/intern/blf_lang.c | 2 +- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenkernel/intern/ipo.c | 2 +- source/blender/blenkernel/intern/key.c | 6 +-- source/blender/blenkernel/intern/node.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 5 +- source/blender/blenkernel/intern/sequencer.c | 2 +- source/blender/blenloader/intern/readfile.c | 8 ++-- source/blender/editors/armature/poselib.c | 2 +- source/blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/sculpt_paint/paint_undo.c | 3 +- .../editors/space_sequencer/sequencer_select.c | 8 ++-- source/blender/editors/space_text/text_draw.c | 3 +- source/blender/editors/util/editmode_undo.c | 2 +- source/blender/modifiers/intern/MOD_armature.c | 3 +- source/blender/modifiers/intern/MOD_bevel.c | 2 +- source/blender/modifiers/intern/MOD_cast.c | 3 +- source/blender/modifiers/intern/MOD_curve.c | 3 +- source/blender/modifiers/intern/MOD_displace.c | 5 +- source/blender/modifiers/intern/MOD_hook.c | 5 +- source/blender/modifiers/intern/MOD_lattice.c | 3 +- source/blender/modifiers/intern/MOD_smooth.c | 3 +- source/blender/modifiers/intern/MOD_warp.c | 5 +- source/blender/modifiers/intern/MOD_wave.c | 3 +- source/blender/nodes/intern/node_common.c | 2 +- .../blender/python/generic/bpy_internal_import.c | 2 +- .../blender/render/intern/source/convertblender.c | 2 +- source/blender/render/intern/source/pipeline.c | 2 +- source/creator/creator.c | 53 +++++++++++----------- 30 files changed, 79 insertions(+), 68 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index b5c6b5bd68c..0a102884969 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -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, ':'); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 73ddcbecf94..8d18a1c27e7 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -270,7 +270,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/blender.c b/source/blender/blenkernel/intern/blender.c index 27ea1585e4b..1c729470da4 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -518,7 +518,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/ipo.c b/source/blender/blenkernel/intern/ipo.c index 71ca79706db..b885e608b15 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1103,7 +1103,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..656bb3ef853 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1445,10 +1445,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/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/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index e5d74177c91..70b44792b30 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) { diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index a3237da6234..743111b925f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3653,7 +3653,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/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6163fa015a8..f1f055b4004 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -516,7 +516,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; @@ -5614,7 +5614,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)); } } } @@ -5623,7 +5623,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); } } @@ -12240,7 +12240,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/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/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/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/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index a6cc65017bb..c0919ef3043 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -169,11 +169,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 +389,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); } } 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/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/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_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_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_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/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 8225c986409..fa5a3c727c2 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -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/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 67ed90c79eb..90260100c83 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -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/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b972569fdf6..f06707c94fe 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5026,7 +5026,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 05bcc32a90a..7835ae6dcd3 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1198,7 +1198,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/creator/creator.c b/source/creator/creator.c index d25b0be30d8..3ce469de4e8 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -520,8 +520,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"); @@ -546,17 +546,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; @@ -573,10 +573,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 @@ -612,6 +610,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"); @@ -638,8 +639,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') { @@ -721,9 +722,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); @@ -763,9 +764,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); @@ -782,9 +783,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 { @@ -796,8 +797,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); @@ -815,8 +816,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); @@ -834,8 +835,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); -- cgit v1.2.3 From 217030120463276043fa977656d3cd5bc13cd411 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 27 Sep 2011 01:28:15 +0000 Subject: [#28681] Switching transform type doesn't register correct operator for 'repeat'. Reported by Nicholas Rishel Part of a potential fix, see discussion in tracker. --- source/blender/editors/transform/transform.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index fbe0a1864bf..c77f7620326 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1358,6 +1358,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)) { -- cgit v1.2.3 From f4dec97cef4b320c6f3ffd2ddc39d429da4fd4d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 01:32:27 +0000 Subject: fix for building on windows, clear some warnings too --- source/blender/blenkernel/intern/writeframeserver.c | 4 ++++ source/blender/blenlib/intern/storage.c | 2 +- source/blender/blenlib/intern/winstuff.c | 10 +++++----- source/blender/editors/include/UI_interface.h | 1 + source/blender/editors/space_node/node_intern.h | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index d13d15d1269..15cb3b66db7 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -257,7 +257,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/intern/storage.c b/source/blender/blenlib/intern/storage.c index f088c5e2787..8be86a4b407 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -488,7 +488,7 @@ LinkNode *BLI_read_file_as_lines(const char *name) 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/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 66080ed2a85..bf816a91fb3 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -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/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 67b17a891ca..4a895472b33 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" 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 /* for size_t */ #include "UI_interface.h" /* internal exports only */ -- cgit v1.2.3 From d98bcb8a77c0a06dc35669dd8898f1f9f2ad85c6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 04:07:48 +0000 Subject: fix for py/rna api bug: PyC_UnicodeAsByte(), used for getting python strings as bytes wasnt clearning utf-8 conversion errors. this would raise an error when getting an operators filepath. --- source/blender/python/generic/py_capi_utils.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index d5bd44fc288..17fda6d08a7 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -363,12 +363,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))); + } } } -- cgit v1.2.3 From 928e2784c6596f64ca5201eed269959865d15970 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 05:28:06 +0000 Subject: py api - use Py_ssize_t when dealing with python sequence sizes - dont call PySequence_Size(py_b) in a loop (its slow). - use faster sequence/float parsing in aud.Factory.filter --- source/blender/python/generic/IDProp.c | 2 +- source/blender/python/generic/bgl.c | 4 ++-- source/blender/python/intern/bpy_rna.c | 4 ++-- source/blender/python/intern/bpy_rna_array.c | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source') 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/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 3175c0d088e..bcbd7670e2c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1718,7 +1718,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 +1736,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } seq_len= PySequence_Size(value); - for(i=0; itp_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. * -- cgit v1.2.3 From a25c7f647e3050239d0c0ea35db37a3e48f84e4c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 09:09:43 +0000 Subject: navmesh: convert object_navmesh.cpp to plain c. --- source/blender/editors/object/CMakeLists.txt | 4 +- source/blender/editors/object/SConscript | 4 +- source/blender/editors/object/object_navmesh.c | 684 +++++++++++++++++++++ source/blender/editors/object/object_navmesh.cpp | 628 ------------------- source/blender/editors/space_view3d/view3d_edit.c | 2 +- .../blender/windowmanager/intern/wm_event_system.c | 3 - 6 files changed, 689 insertions(+), 636 deletions(-) create mode 100644 source/blender/editors/object/object_navmesh.c delete mode 100644 source/blender/editors/object/object_navmesh.cpp (limited to 'source') diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index b9b8ddc6305..b0b4f9dc0eb 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -60,11 +60,11 @@ set(SRC if(WITH_GAMEENGINE) list(APPEND INC - ../../../../extern/recastnavigation/Recast/Include + ../../../../extern/recastnavigation ) list(APPEND SRC - object_navmesh.cpp + object_navmesh.c ) 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_navmesh.c b/source/blender/editors/object/object_navmesh.c new file mode 100644 index 00000000000..413d8757be2 --- /dev/null +++ b/source/blender/editors/object/object_navmesh.c @@ -0,0 +1,684 @@ +/** +* $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 + +#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 "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 "RNA_access.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "recast-capi.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); + +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; iv4) + ntris+=1; + } + } + + //create data + verts = MEM_mallocN(sizeof(float)*3*nverts, "verts"); + tris = 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; ico); + 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; iv1; 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 minRegionSize, mergeRegionSize, maxEdgeLen; + float detailSampleDist, detailSampleMaxError; + + recast_calcBounds(verts, nverts, bmin, bmax); + + // + // Step 1. Initialize build config. + // + { +/* + 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; +*/ +#if 0 + 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; +#endif + } + + walkableHeight = (int)ceilf(recastParams->agentheight/ recastParams->cellheight); + walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); + walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize); + minRegionSize = (int)(recastParams->regionminsize * recastParams->regionminsize); + mergeRegionSize = (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, "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_filterLedgeSpans(walkableHeight, walkableClimb, solid); + recast_filterWalkableLowHeightSpans(walkableHeight, solid); + + // + // Step 4. Partition walkable surface to simple regions. + // + + chf = recast_newCompactHeightfield(); + if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, RECAST_WALKABLE, solid, chf)) { + recast_destroyHeightfield(solid); + recast_destroyCompactHeightfield(chf); + + return 0; + } + + recast_destroyHeightfield(solid); + + // 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, walkableRadius, 0, minRegionSize, mergeRegionSize)) { + 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]; + Main *bmain = CTX_data_main(C); + Scene *scene= CTX_data_scene(C); + Object* obedit; + int createob = base==NULL; + int nverts, nmeshes, nvp; + unsigned short *verts, *meshes, *polys; + float bmin[3], cs, ch, *dverts; + unsigned char *tris; + ModifierData *md; + + 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, "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; itotvert; + unsigned short 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; jfdata, 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"); + } + + 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 *UNUSED(op)) +{ + Scene* scene = CTX_data_scene(C); + int nverts, ntris; + float* verts; + int* tris; + struct recast_polyMesh *pmesh; + struct recast_polyMeshDetail *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 *UNUSED(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 = 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; ifreeIdx) + break; + } + + MEM_freeN(indices); + + return freeIdx; +} + +static int assign_new_navpolygon_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 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_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 -#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; iv4) - 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; ico); - 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; iv1; 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; inmeshes; 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; jverts[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; jtris[4*(tribase+j)]; - EditFace* newFace; - for (k=0; k<3; k++) - { - if (tri[k]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; ifreeIdx) - 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/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0854f9f3685..d3d7b1b1505 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3226,7 +3226,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve else WM_event_add_notifier(C, NC_SCENE|NA_EDITED, scene); - return OPERATOR_FINISHED; + return OPERATOR_PASS_THROUGH; } void VIEW3D_OT_cursor3d(wmOperatorType *ot) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index dad43b4fe69..cfeaee18416 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1270,10 +1270,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 */ - if(retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH)) - return WM_HANDLER_HANDLED; /* Modal unhandled, break */ if(retval == (OPERATOR_PASS_THROUGH|OPERATOR_RUNNING_MODAL)) -- cgit v1.2.3 From dcccf3fc1f915d0c8a3f2f8763170b6ff9394b8a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 09:09:52 +0000 Subject: navmesh: solve bad level calls to edit mesh functions Move navmesh operators from editors/object to editors/mesh --- source/blender/editors/mesh/CMakeLists.txt | 12 + source/blender/editors/mesh/SConscript | 6 + source/blender/editors/mesh/mesh_intern.h | 12 +- source/blender/editors/mesh/mesh_navmesh.c | 674 ++++++++++++++++++++++++ source/blender/editors/mesh/mesh_ops.c | 6 + source/blender/editors/object/CMakeLists.txt | 10 - source/blender/editors/object/object_intern.h | 5 - source/blender/editors/object/object_navmesh.c | 684 ------------------------- source/blender/editors/object/object_ops.c | 6 - 9 files changed, 707 insertions(+), 708 deletions(-) create mode 100644 source/blender/editors/mesh/mesh_navmesh.c delete mode 100644 source/blender/editors/object/object_navmesh.c (limited to 'source') 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..24c63a5dc54 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -15,4 +15,10 @@ if env['OURPLATFORM'] == 'linux': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] +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), [], libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 4d620424b0a..6dce92bf07b 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); @@ -169,7 +170,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); @@ -185,7 +186,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 */ @@ -256,5 +257,10 @@ 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_create_navmesh(struct wmOperatorType *ot); +void MESH_OT_assign_navpolygon(struct wmOperatorType *ot); +void MESH_OT_assign_new_navpolygon(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..2b64fb24e78 --- /dev/null +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -0,0 +1,674 @@ +/** +* $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 + +#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 "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; iv4) + 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; ico); + 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; iv1; 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 minRegionSize, mergeRegionSize, maxEdgeLen; + float detailSampleDist, detailSampleMaxError; + + recast_calcBounds(verts, nverts, bmin, bmax); + + // + // Step 1. Initialize build config. + // + { +/* + 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; +*/ +#if 0 + 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; +#endif + } + + walkableHeight = (int)ceilf(recastParams->agentheight/ recastParams->cellheight); + walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); + walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize); + minRegionSize = (int)(recastParams->regionminsize * recastParams->regionminsize); + mergeRegionSize = (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_filterLedgeSpans(walkableHeight, walkableClimb, solid); + recast_filterWalkableLowHeightSpans(walkableHeight, solid); + + // + // Step 4. Partition walkable surface to simple regions. + // + + chf = recast_newCompactHeightfield(); + if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, RECAST_WALKABLE, solid, chf)) { + recast_destroyHeightfield(solid); + recast_destroyCompactHeightfield(chf); + + return 0; + } + + recast_destroyHeightfield(solid); + + // 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, walkableRadius, 0, minRegionSize, mergeRegionSize)) { + 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]; + Main *bmain = CTX_data_main(C); + Scene *scene= CTX_data_scene(C); + Object* obedit; + int createob = base==NULL; + int nverts, nmeshes, nvp; + unsigned short *verts, *meshes, *polys; + float bmin[3], cs, ch, *dverts; + unsigned char *tris; + ModifierData *md; + + 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, "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; itotvert; + unsigned short 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; jfdata, 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"); + } + + 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 *UNUSED(op)) +{ + Scene* scene = CTX_data_scene(C); + int nverts, ntris; + float* verts; + int* tris; + struct recast_polyMesh *pmesh; + struct recast_polyMeshDetail *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); + + MEM_freeN(verts); + MEM_freeN(tris); + + return OPERATOR_FINISHED; +} + +void MESH_OT_create_navmesh(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Create navigation mesh"; + ot->description= "Create navigation mesh for selected objects"; + ot->idname= "MESH_OT_create_navmesh"; + + /* api callbacks */ + ot->exec= create_navmesh_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(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 MESH_OT_assign_navpolygon(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Assign polygon index"; + ot->description= "Assign polygon index to face by active face"; + ot->idname= "MESH_OT_assign_navpolygon"; + + /* api callbacks */ + ot->poll= ED_operator_editmesh; + 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 = 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; ifreeIdx) + break; + } + + MEM_freeN(indices); + + return freeIdx; +} + +static int assign_new_navpolygon_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_assign_new_navpolygon(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Assign new polygon index"; + ot->description= "Assign new polygon index to face"; + ot->idname= "MESH_OT_assign_new_navpolygon"; + + /* api callbacks */ + ot->poll= ED_operator_editmesh; + ot->exec= assign_new_navpolygon_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 282eeef906f..f44f7fbb8d5 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -151,6 +151,12 @@ 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_create_navmesh); + WM_operatortype_append(MESH_OT_assign_navpolygon); + WM_operatortype_append(MESH_OT_assign_new_navpolygon); +#endif } #if 0 /* UNUSED, remove? */ diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index b0b4f9dc0eb..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 - ) - - list(APPEND SRC - object_navmesh.c - ) -endif() - if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() 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.c b/source/blender/editors/object/object_navmesh.c deleted file mode 100644 index 413d8757be2..00000000000 --- a/source/blender/editors/object/object_navmesh.c +++ /dev/null @@ -1,684 +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 - -#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 "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 "RNA_access.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "recast-capi.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); - -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; iv4) - ntris+=1; - } - } - - //create data - verts = MEM_mallocN(sizeof(float)*3*nverts, "verts"); - tris = 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; ico); - 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; iv1; 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 minRegionSize, mergeRegionSize, maxEdgeLen; - float detailSampleDist, detailSampleMaxError; - - recast_calcBounds(verts, nverts, bmin, bmax); - - // - // Step 1. Initialize build config. - // - { -/* - 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; -*/ -#if 0 - 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; -#endif - } - - walkableHeight = (int)ceilf(recastParams->agentheight/ recastParams->cellheight); - walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); - walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize); - minRegionSize = (int)(recastParams->regionminsize * recastParams->regionminsize); - mergeRegionSize = (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, "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_filterLedgeSpans(walkableHeight, walkableClimb, solid); - recast_filterWalkableLowHeightSpans(walkableHeight, solid); - - // - // Step 4. Partition walkable surface to simple regions. - // - - chf = recast_newCompactHeightfield(); - if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, RECAST_WALKABLE, solid, chf)) { - recast_destroyHeightfield(solid); - recast_destroyCompactHeightfield(chf); - - return 0; - } - - recast_destroyHeightfield(solid); - - // 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, walkableRadius, 0, minRegionSize, mergeRegionSize)) { - 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]; - Main *bmain = CTX_data_main(C); - Scene *scene= CTX_data_scene(C); - Object* obedit; - int createob = base==NULL; - int nverts, nmeshes, nvp; - unsigned short *verts, *meshes, *polys; - float bmin[3], cs, ch, *dverts; - unsigned char *tris; - ModifierData *md; - - 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, "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; itotvert; - unsigned short 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; jfdata, 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"); - } - - 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 *UNUSED(op)) -{ - Scene* scene = CTX_data_scene(C); - int nverts, ntris; - float* verts; - int* tris; - struct recast_polyMesh *pmesh; - struct recast_polyMeshDetail *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 *UNUSED(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 = 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; ifreeIdx) - break; - } - - MEM_freeN(indices); - - return freeIdx; -} - -static int assign_new_navpolygon_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 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 } -- cgit v1.2.3 From b66f219687cc55b731017cc6602c079166bf1462 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 09:09:55 +0000 Subject: navmesh: code clean-up, should be no functional changes. --- source/blender/editors/mesh/mesh_navmesh.c | 499 ++++++++++++----------------- 1 file changed, 211 insertions(+), 288 deletions(-) (limited to 'source') diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 2b64fb24e78..b0d15a0dc68 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -17,12 +17,13 @@ * 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 +* The Original Code is Copyright (C) 2011 by Blender Foundation * All rights reserved. * * The Original Code is: all of this file. * -* Contributor(s): none yet. +* Contributor(s): Benoit Bolsee, +* Nick Samarin * * ***** END GPL LICENSE BLOCK ***** */ @@ -67,89 +68,95 @@ 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; + 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; + 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); + 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; + nverts+= dm->getNumVerts(dm); + nfaces= dm->getNumFaces(dm); + ntris+= nfaces; - //resolve quad faces - mface = dm->getFaceArray(dm); - for (i=0; iv4) + /* resolve quad faces */ + mface= dm->getFaceArray(dm); + for(i= 0; iv4) 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; inext, dmlink= dmlink->next) { + ob= (Object*) oblink->link; + dm= (DerivedMesh*) dmlink->link; + + curnverts= dm->getNumVerts(dm); + mvert= dm->getVertArray(dm); + + /* copy verts */ + for(i= 0; ico); 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]; + + 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; iv1; tri[1]= basenverts + mf->v3; tri[2]= basenverts + mf->v2; + /* create tris */ + curnfaces= dm->getNumFaces(dm); + mface= dm->getFaceArray(dm); + + for(i= 0; iv1; + 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; + + if(mf->v4) { + tri[0]= basenverts + mf->v1; + tri[1]= basenverts + mf->v4; + tri[2]= basenverts + mf->v3; tri += 3; } } - basenverts += curnverts; + + basenverts+= curnverts; } - //release derived mesh - for (dmlink = dms; dmlink; dmlink = dmlink->next) - { - dm = (DerivedMesh*) dmlink->link; + /* 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; @@ -172,101 +179,46 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts recast_calcBounds(verts, nverts, bmin, bmax); - // - // Step 1. Initialize build config. - // - { -/* - 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; -*/ -#if 0 - 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; -#endif - } - - walkableHeight = (int)ceilf(recastParams->agentheight/ recastParams->cellheight); - walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); - walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize); - minRegionSize = (int)(recastParams->regionminsize * recastParams->regionminsize); - mergeRegionSize = (int)(recastParams->regionmergesize * recastParams->regionmergesize); - maxEdgeLen = (int)(recastParams->edgemaxlen/recastParams->cellsize); - detailSampleDist = recastParams->detailsampledist< 0.9f ? 0 : + /* ** 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); + minRegionSize= (int)(recastParams->regionminsize * recastParams->regionminsize); + mergeRegionSize= (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; + detailSampleMaxError= recastParams->cellheight * recastParams->detailsamplemaxerror; - // Set the area where the navigation will be build. + /* 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(); + /* ** 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)) { + 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"); + /* 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. + /* 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. - // + /* ** Step 3: Filter walkables surfaces ** */ recast_filterLedgeSpans(walkableHeight, walkableClimb, solid); recast_filterWalkableLowHeightSpans(walkableHeight, solid); - // - // Step 4. Partition walkable surface to simple regions. - // + /* ** Step 4: Partition walkable surface to simple regions ** */ - chf = recast_newCompactHeightfield(); - if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, RECAST_WALKABLE, solid, chf)) { + chf= recast_newCompactHeightfield(); + if(!recast_buildCompactHeightfield(walkableHeight, walkableClimb, RECAST_WALKABLE, solid, chf)) { recast_destroyHeightfield(solid); recast_destroyCompactHeightfield(chf); @@ -275,38 +227,34 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts recast_destroyHeightfield(solid); - // Prepare for region partitioning, by calculating distance field along the walkable surface. - if (!recast_buildDistanceField(chf)) { + /* 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, walkableRadius, 0, minRegionSize, mergeRegionSize)) { + /* Partition the walkable surface into simple regions without holes */ + if(!recast_buildRegions(chf, walkableRadius, 0, minRegionSize, mergeRegionSize)) { recast_destroyCompactHeightfield(chf); return 0; } - // - // Step 5. Trace and simplify region contours. - // - // Create contours. - cset = recast_newContourSet(); + /* ** Step 5: Trace and simplify region contours ** */ + /* Create contours */ + cset= recast_newContourSet(); - if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) { + 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)) { + /* ** 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); @@ -315,12 +263,10 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts } - // - // Step 7. Create detail mesh which allows to access approximate height on each polygon. - // + /* ** 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)) { + *dmesh= recast_newPolyMeshDetail(); + if(!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) { recast_destroyCompactHeightfield(chf); recast_destroyContourSet(cset); recast_destroyPolyMesh(*pmesh); @@ -342,10 +288,10 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, int i,j, k; unsigned short* v; int face[3]; - Main *bmain = CTX_data_main(C); + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object* obedit; - int createob = base==NULL; + int createob= base==NULL; int nverts, nmeshes, nvp; unsigned short *verts, *meshes, *polys; float bmin[3], cs, ch, *dverts; @@ -355,98 +301,92 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, zero_v3(co); zero_v3(rot); - if (createob) - { - //create new object - obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); + if(createob) { + /* create new object */ + obedit= ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1); } - else - { - obedit = base->object; + 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)); + em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); - if (!createob) - { - //clear + 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); + /* 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; + for(i= 0; ifdata, CD_RECAST, CD_CALLOC, NULL, 0, "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; itotvert; - unsigned short 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; + /* 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; itotvert; + unsigned short 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; jfdata, newFace->data, CD_RECAST); - *polygonIdx = i+1; //add 1 to avoid zero idx + /* 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(); @@ -464,17 +404,15 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, 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; + if(createob) { + obedit->gameflag&= ~OB_COLLISION; + obedit->gameflag|= OB_NAVMESH; + obedit->body_type= OB_BODY_TYPE_NAVMESH; rename_id((ID *)obedit, "Navmesh"); } md= modifiers_findByType(obedit, eModifierType_NavMesh); - if (!md) - { + if(!md) { ED_object_modifier_add(NULL, bmain, scene, obedit, NULL, eModifierType_NavMesh); } @@ -483,33 +421,25 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, static int create_navmesh_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene* scene = CTX_data_scene(C); + Scene* scene= CTX_data_scene(C); int nverts, ntris; float* verts; int* tris; struct recast_polyMesh *pmesh; struct recast_polyMeshDetail *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; + 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==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); @@ -540,28 +470,25 @@ static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(op)) Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - //do work here - int targetPolyIdx = -1; + /* 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; + 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; + ef= ef->prev; } } } @@ -571,6 +498,7 @@ static int assign_navpolygon_exec(bContext *C, wmOperator *UNUSED(op)) WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); BKE_mesh_end_editmesh((Mesh*)obedit->data, em); + return OPERATOR_FINISHED; } @@ -595,29 +523,27 @@ static int compare(const void * a, const void * 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; + /* 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; + ef= ef->prev; } qsort(indices, numfaces, sizeof(int), compare); - //search first free index - freeIdx = 1; - for (i=0; ifreeIdx) + else if(indices[i]>freeIdx) break; } @@ -630,26 +556,23 @@ static int assign_new_navpolygon_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; + + 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; + ef= ef->prev; } } - } + } DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); -- cgit v1.2.3 From a1857b407c422163482ac1db727fa21ac8a12a82 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 09:21:17 +0000 Subject: Fixing typo in comment - no functional changes --- source/blender/editors/sculpt_paint/sculpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') 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; -- cgit v1.2.3 From 1d202ba90c54435f83ab3a506aea1b7f9c36b8c6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 09:40:53 +0000 Subject: Fix for recent commit: mistake in sconscript --- source/blender/editors/mesh/SConscript | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 24c63a5dc54..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' @@ -21,4 +23,4 @@ if env['WITH_BF_GAMEENGINE']: else: sources.remove('mesh_navmesh.c') -env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), [], libtype=['core'], priority=[45] ) +env.BlenderLib ( 'bf_editors_mesh', sources, Split(incs), defs, libtype=['core'], priority=[45] ) -- cgit v1.2.3 From 7fbfca48d2f7efd8e8072beb65475de8b4e0e797 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 27 Sep 2011 10:37:02 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_space.c | 105 ++++++++++++++++++----------- 1 file changed, 67 insertions(+), 38 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 36c45cfa59e..e561065cb09 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); @@ -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 */ @@ -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 */ @@ -2123,7 +2150,8 @@ static void rna_def_space_nla(BlenderRNA *brna) /* 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}}; -- cgit v1.2.3 From 768806adc08e2dd5b1fccb4baafec8129076e659 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 10:43:45 +0000 Subject: bpy.app.handlers.frame_change_pre/post handlers. --- source/blender/blenkernel/intern/scene.c | 7 +++++++ source/blender/blenlib/BLI_callbacks.h | 2 ++ source/blender/python/intern/bpy_app_handlers.c | 2 ++ 3 files changed, 11 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 6741ff2d018..d8ae36b4ab5 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -56,6 +56,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" @@ -1022,6 +1023,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 */ @@ -1048,6 +1052,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/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/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index b909a0d5f55..6aaeb4d9807 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}, -- cgit v1.2.3 From 7ba71fff8c0158e1d3fe7e0ee5f6e8caee808d8e Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Tue, 27 Sep 2011 10:51:57 +0000 Subject: OSX: fix player bundle_creation --- source/blenderplayer/CMakeLists.txt | 12 ++++++- source/creator/CMakeLists.txt | 72 +++++++++++++++++++++++++------------ 2 files changed, 60 insertions(+), 24 deletions(-) (limited to 'source') diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index 3ab1b4a3cdd..82847cb8079 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -63,8 +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 MACOSX_BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/dna.c) + 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/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 0bd2763c7d2..a2cd7c23c06 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -713,40 +713,66 @@ elseif(APPLE) # 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(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) - set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) - set(TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION}) + 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}) - # setup Info.plist - execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) - set_target_properties(blender PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${SOURCEINFO} - MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION} - MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}") - - # important to make a clean install each time else old scripts get loaded. + # important to make a clean install each time else old scripts get loaded. install( CODE - "file(REMOVE_RECURSE ${TARGETDIR_VER})" - ) - - # message after building. - add_custom_command( - TARGET blender POST_BUILD MAIN_DEPENDENCY blender - COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}' + "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})" ) + + # handy install macro to exclude files, we use \$ escape for the "to" + # argument when calling so ${BUILD_TYPE} does not get expanded + macro(install_dir from to) + install( + DIRECTORY ${from} + DESTINATION ${to} + PATTERN ".svn" EXCLUDE + PATTERN "*.pyc" EXCLUDE + PATTERN "*.pyo" EXCLUDE + PATTERN "*.orig" EXCLUDE + PATTERN "*.rej" EXCLUDE + PATTERN "__pycache__" EXCLUDE + PATTERN "__MACOSX" EXCLUDE + PATTERN ".DS_Store" EXCLUDE + ) + endmacro() + install( - FILES ${SOURCEDIR}/Contents/PkgInfo + FILES ${PLAYER_SOURCEDIR}/Contents/PkgInfo DESTINATION ${TARGETDIR}/blenderplayer.app/Contents ) - + install_dir( - ${SOURCEDIR}/Contents/Resources + ${PLAYER_SOURCEDIR}/Contents/Resources \${TARGETDIR}/blenderplayer.app/Contents/ ) + install( + FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf + DESTINATION ${PLAYER_TARGETDIR_VER} + ) + + # localization + if(WITH_INTERNATIONAL) + install( + FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages + DESTINATION ${PLAYER_TARGETDIR_VER}/datafiles + ) + + install( + DIRECTORY + ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts + ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale + DESTINATION ${PLAYER_TARGETDIR_VER}/datafiles + PATTERN ".svn" EXCLUDE + ) + endif() + # python if(WITH_PYTHON) add_custom_command( @@ -759,10 +785,10 @@ elseif(APPLE) # copy extracted python files install_dir( ${CMAKE_CURRENT_BINARY_DIR}/python - \${TARGETDIR_VER} + \${PLAYER_TARGETDIR_VER} ) endif() - + endif() endif() -- cgit v1.2.3 From 6b825e67986c77fd114441553c364c1430e2e91d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 27 Sep 2011 11:02:19 +0000 Subject: Commented and tagged some unused vars (gcc warnings...) --- source/blender/blenkernel/intern/BME_structure.c | 8 ++--- source/blender/blenkernel/intern/BME_tools.c | 38 +++++++++++----------- .../blender/editors/space_view3d/view3d_buttons.c | 4 +-- source/blender/editors/space_view3d/view3d_view.c | 4 +-- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'source') 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/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 117dfda4551..7bc25fcf1cc 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1224,7 +1224,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; @@ -1252,7 +1252,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_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); -- cgit v1.2.3 From e4c299d9753d5493719a7e21fc9d23371e6f14ef Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 12:08:35 +0000 Subject: comment warnings as errors for MSVC - it too easily made small problems like unused vars into errors which gets annoying for non developers. with GCC we have *some* warnings as errors which works out better. --- source/blender/blenkernel/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 93ab29c5f49..91749143008 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -361,8 +361,9 @@ if(WITH_GAMEENGINE) ) endif() -if(MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") -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}") -- cgit v1.2.3 From 4b24951ff1660237bf26d13528f5b7f5f73becfa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 13:11:19 +0000 Subject: Return back nice eye icon to constraints header (instead of speaker which not so nice in this context, imo) --- source/blender/editors/interface/interface_templates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a4622f50725..44aa6d1e090 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1040,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); -- cgit v1.2.3 From cb7b7b3b9ee18bc574bffab71b01195a5cc8651d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 13:33:32 +0000 Subject: Silence some gcc warnings. --- source/blender/editors/mesh/mesh_navmesh.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index b0d15a0dc68..1cd5dcdb241 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -422,11 +422,11 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, static int create_navmesh_exec(bContext *C, wmOperator *UNUSED(op)) { Scene* scene= CTX_data_scene(C); - int nverts, ntris; - float* verts; - int* tris; - struct recast_polyMesh *pmesh; - struct recast_polyMeshDetail *dmesh; + 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; -- cgit v1.2.3 From aaae90af33aa2bdf585c75fa9dcf5f2dd4d205bd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 16:23:40 +0000 Subject: fix [#28751] Item in Enum propertie is grayed out was infact a very old bug where an empty title took the following word for the title, eg: "%t|First Item|Second Item" the first item would be evaluated as a title. --- source/blender/editors/interface/interface_regions.c | 2 +- source/blender/python/intern/bpy_props.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4a9eb8113fe..4ecaec61053 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -174,7 +174,7 @@ static MenuData *decompose_menu_string(const char *str) *s= '\0'; s++; } else if (s[1]=='t') { - nitem_is_title= 1; + nitem_is_title= (s[2] != '|'); /* check for empty title */ *s= '\0'; s++; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index a3d5bc99ad8..04c64bcbd3c 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -973,7 +973,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; } } -- cgit v1.2.3 From 3abfb2af43722bef5933c957ee1d38054f16911d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 16:39:41 +0000 Subject: fix [#28752] Brush Icons do not scale correctly with DPI --- source/blender/editors/interface/interface_icons.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index c3a0f438fbe..5ea013ded59 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -953,7 +953,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al Icon *icon = NULL; DrawInfo *di = NULL; IconImage *iimg; - float fdraw_size= UI_DPI_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); -- cgit v1.2.3 From 3bcbefa558ac9661f6ac8fc936c20c95e73c53ee Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Sep 2011 17:04:38 +0000 Subject: minor changes to interface code (no functional changes) - made 2 loops on menu items break out of the loop when the item is found. - include function names in error prints. --- .../blender/editors/interface/interface_handlers.c | 4 ++-- source/blender/editors/interface/interface_icons.c | 14 +++++++------- source/blender/editors/interface/interface_regions.c | 20 ++++++++++++-------- source/blender/editors/interface/interface_style.c | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 568eaf358e5..082ddb5b060 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1684,7 +1684,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); } } @@ -5914,7 +5914,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 5ea013ded59..fbad34252e7 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,7 +948,7 @@ 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; @@ -960,7 +960,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al 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; } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4ecaec61053..bd77ab8065a 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -213,11 +213,13 @@ static MenuData *decompose_menu_string(const char *str) nicon= 0; } - if (c=='\0') + if (c=='\0') { break; - } else if (!nitem) + } + } else if (!nitem) { nitem= s; - + } + s++; } @@ -233,6 +235,7 @@ void ui_set_name_menu(uiBut *but, int value) for (i=0; initems; i++) { if (md->items[i].retval==value) { BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr)); + break; } } @@ -1647,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; anitems; a++, b++) { - entry= &md->items[a]; - - if(entry->sepr && entry->str[0]) + entry= md->items; + for(a=0; anitems; a++, entry++) { + if(entry->sepr && entry->str[0]) { block->flag |= UI_BLOCK_NO_FLIP; + break; + } } /* create items */ @@ -2555,7 +2559,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 3009d4fea09..938fb27e017 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -357,7 +357,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? -- cgit v1.2.3 From c927e374107a7d4b8ecb443656ef548f89684131 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 27 Sep 2011 17:06:10 +0000 Subject: OSX CMake bundle - blenderplayer doesn't need locale, data, .. also blenderplayer is a subset of Blender, so no need to repeat the macros here. --- source/creator/CMakeLists.txt | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index a2cd7c23c06..28a621c923c 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -723,24 +723,6 @@ elseif(APPLE) CODE "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})" ) - - - # handy install macro to exclude files, we use \$ escape for the "to" - # argument when calling so ${BUILD_TYPE} does not get expanded - macro(install_dir from to) - install( - DIRECTORY ${from} - DESTINATION ${to} - PATTERN ".svn" EXCLUDE - PATTERN "*.pyc" EXCLUDE - PATTERN "*.pyo" EXCLUDE - PATTERN "*.orig" EXCLUDE - PATTERN "*.rej" EXCLUDE - PATTERN "__pycache__" EXCLUDE - PATTERN "__MACOSX" EXCLUDE - PATTERN ".DS_Store" EXCLUDE - ) - endmacro() install( FILES ${PLAYER_SOURCEDIR}/Contents/PkgInfo @@ -752,27 +734,6 @@ elseif(APPLE) \${TARGETDIR}/blenderplayer.app/Contents/ ) - install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf - DESTINATION ${PLAYER_TARGETDIR_VER} - ) - - # localization - if(WITH_INTERNATIONAL) - install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages - DESTINATION ${PLAYER_TARGETDIR_VER}/datafiles - ) - - install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts - ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale - DESTINATION ${PLAYER_TARGETDIR_VER}/datafiles - PATTERN ".svn" EXCLUDE - ) - endif() - # python if(WITH_PYTHON) add_custom_command( -- cgit v1.2.3 From f2c2ba7ef39544b38afe7e0b8972b707f9445038 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Tue, 27 Sep 2011 17:47:41 +0000 Subject: Detour: fix bug with steering actuator: object pointer not removed. --- source/blender/blenkernel/intern/sca.c | 6 ++++++ source/blender/editors/space_logic/logic_window.c | 1 + 2 files changed, 7 insertions(+) (limited to 'source') 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/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; } } -- cgit v1.2.3 From ac166d5eb65ec0f9992bb9c0a2caae1763d79110 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 27 Sep 2011 19:04:27 +0000 Subject: Fix for MSVC. --- source/blender/editors/interface/interface_style.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source') diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 938fb27e017..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" -- cgit v1.2.3 From 2bc2752374ce18d78068765782a1c7214965ade6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 02:02:57 +0000 Subject: correct own fix for #28751 --- source/blender/editors/interface/interface_regions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index bd77ab8065a..c898ba983c7 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -174,7 +174,7 @@ static MenuData *decompose_menu_string(const char *str) *s= '\0'; s++; } else if (s[1]=='t') { - nitem_is_title= (s[2] != '|'); /* check for empty title */ + nitem_is_title= (s != instr); /* check for empty title */ *s= '\0'; s++; -- cgit v1.2.3 From 4208eed25ba1596d79f15ac33442b552ad796161 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 05:20:14 +0000 Subject: use __func__ rather than function names in rna prints, some were incorrect. also replace use of strlen() where checking first char is enough. --- source/blender/makesrna/intern/rna_access.c | 74 +++++----- source/blender/makesrna/intern/rna_animation.c | 2 +- source/blender/makesrna/intern/rna_define.c | 192 ++++++++++++------------- source/blender/makesrna/intern/rna_fcurve.c | 4 +- source/blender/makesrna/intern/rna_text.c | 2 +- 5 files changed, 138 insertions(+), 136 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b52de6a49b6..b995b5ab731 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1111,7 +1111,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; } @@ -2511,7 +2511,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 +2530,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 +2663,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 +2722,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; } @@ -3999,7 +3999,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 +4011,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 +4021,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 +4031,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 +4042,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 +4054,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 +4064,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 +4074,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 +4085,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 +4097,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 +4107,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 +4117,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 +4128,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 +4140,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 +4152,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 +4175,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 +4228,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 +4241,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 +4254,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 +4266,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 +4277,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 +4291,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 +4302,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 +4312,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 +4322,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 +4332,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 +4343,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 +4360,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_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_define.c b/source/blender/makesrna/intern/rna_define.c index 63b3aed4a3b..63a41762f4c 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; } } @@ -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,7 +2041,7 @@ 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; } @@ -2052,7 +2052,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con 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; } @@ -2070,7 +2070,7 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con 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 +2280,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 +2300,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 +2530,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 +2561,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 +2578,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 +2592,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..a08e030215c 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; } 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; -- cgit v1.2.3 From 018fa1540eaef603b28c04fd5b8533d21122e36f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 05:53:40 +0000 Subject: whitespace edits, make formatting for functions consustent at least within the file. --- source/blender/avi/intern/avirgb.c | 6 ++++-- source/blender/blenkernel/intern/boids.c | 3 ++- source/blender/blenkernel/intern/collision.c | 3 ++- source/blender/blenkernel/intern/constraint.c | 3 ++- source/blender/blenkernel/intern/displist.c | 3 ++- source/blender/blenkernel/intern/idcode.c | 3 ++- source/blender/blenkernel/intern/object.c | 6 ++++-- source/blender/blenkernel/intern/pointcache.c | 3 ++- source/blender/blenkernel/intern/sequencer.c | 3 ++- source/blender/blenkernel/intern/text.c | 9 +++++--- source/blender/blenkernel/intern/writeffmpeg.c | 3 ++- source/blender/blenlib/intern/BLI_args.c | 3 ++- source/blender/blenlib/intern/BLI_dynstr.c | 9 +++++--- source/blender/blenlib/intern/BLI_kdopbvh.c | 3 ++- source/blender/blenlib/intern/bpath.c | 12 +++++++---- source/blender/blenlib/intern/math_base.c | 3 ++- source/blender/blenlib/intern/path_util.c | 18 ++++++++++------ source/blender/blenlib/intern/storage.c | 3 ++- source/blender/blenlib/intern/string.c | 18 ++++++++++------ source/blender/blenlib/intern/threads.c | 3 ++- source/blender/blenloader/intern/readblenentry.c | 3 ++- source/blender/collada/AnimationImporter.cpp | 2 +- source/blender/collada/AnimationImporter.h | 2 +- source/blender/editors/curve/editcurve.c | 10 +++++---- source/blender/editors/interface/interface.c | 3 ++- source/blender/editors/object/object_bake.c | 3 ++- source/blender/editors/object/object_vgroup.c | 24 ++++++++++++++-------- source/blender/editors/screen/glutil.c | 9 +++++--- source/blender/editors/sculpt_paint/paint_image.c | 9 +++++--- source/blender/editors/space_file/filelist.c | 3 ++- source/blender/editors/space_node/node_edit.c | 3 ++- .../editors/space_sequencer/sequencer_select.c | 3 ++- source/blender/editors/space_view3d/drawobject.c | 3 ++- .../blender/editors/transform/transform_generics.c | 3 ++- source/blender/editors/transform/transform_input.c | 12 +++++++---- source/blender/editors/transform/transform_snap.c | 9 +++++--- source/blender/gpu/intern/gpu_buffers.c | 9 +++++--- source/blender/imbuf/intern/bmp.c | 8 ++++---- source/blender/imbuf/intern/imageprocess.c | 6 ++++-- source/blender/imbuf/intern/indexer_dv.c | 3 ++- source/blender/imbuf/intern/jpeg.c | 4 ++-- source/blender/imbuf/intern/targa.c | 3 ++- source/blender/modifiers/intern/MOD_explode.c | 3 ++- .../blender/modifiers/intern/MOD_weightvg_util.c | 6 ++++-- .../nodes/composite/nodes/node_composite_common.c | 3 ++- source/blender/python/generic/py_capi_utils.c | 6 ++++-- source/blender/python/intern/bpy_rna.c | 4 ++-- source/blender/windowmanager/intern/wm_cursors.c | 4 ++-- source/blender/windowmanager/intern/wm_operators.c | 3 ++- 49 files changed, 182 insertions(+), 98 deletions(-) (limited to 'source') 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/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 3966caa1fa9..f9f210fbae4 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -908,7 +908,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/collision.c b/source/blender/blenkernel/intern/collision.c index d8b51973948..32d78a4d306 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; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a59092784dd..75e137bc9fb 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3937,7 +3937,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/displist.c b/source/blender/blenkernel/intern/displist.c index b19ea93a1b8..acc900d0b71 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1406,7 +1406,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/idcode.c b/source/blender/blenkernel/intern/idcode.c index e84a2a04ded..063b5e961e0 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -109,7 +109,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/object.c b/source/blender/blenkernel/intern/object.c index 94be1a7a7b5..eae317b97fc 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2829,7 +2829,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 { @@ -2837,7 +2838,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; 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/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 743111b925f..08848c35add 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -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) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 2c507370288..02cffcec249 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2792,7 +2792,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 +2842,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 +2868,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/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 13875ff19f7..3cb32f9ad12 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -808,7 +808,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/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 654ade8955f..485b8137a02 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -644,7 +644,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; } @@ -699,7 +700,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 */ @@ -718,7 +720,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]; @@ -886,7 +889,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//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/storage.c b/source/blender/blenlib/intern/storage.c index 8be86a4b407..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)); } 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; ido_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/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/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 9d96814c403..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* curves , char* rna_path , int array_index ) +void AnimationImporter::modify_fcurve(std::vector* curves , const char* rna_path , int array_index ) { std::vector::iterator it; int i; 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* curves , char* rna_path , int array_index ); + void modify_fcurve(std::vector* 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/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/interface/interface.c b/source/blender/editors/interface/interface.c index aad67b6b0be..286906402b9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2804,7 +2804,8 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x1, i * otherwise return -1. * (1<derivedDeform && (ob->derivedDeform)==dm) { ob->derivedDeform->needsFree = 1; ob->derivedDeform->release(ob->derivedDeform); @@ -919,7 +925,8 @@ 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); } @@ -931,7 +938,8 @@ 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; 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 5fe47f836d7..add269c0877 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1857,11 +1857,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); } @@ -3686,7 +3688,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]; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index c7ada4a5801..c2e45c5ad8a 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_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_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index c0919ef3043..3ea27899128 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -530,7 +530,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; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 65267bb481a..63a1d7f7b4f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1757,7 +1757,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(); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 38776b51c62..b6651ebd1ff 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1270,7 +1270,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/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 0aaddf0dea5..2bf62b73424 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -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/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_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/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/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 3d01661bc79..cbf079bccef 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); 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/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 17fda6d08a7..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, ""); @@ -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; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index bcbd7670e2c..cbd6affb117 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4140,8 +4140,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)) 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_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 68cd95c1b99..841198c0664 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"}, -- cgit v1.2.3 From ba58bc51fda66daf84e8a5dd8b54fd0e9834e6b2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 06:26:46 +0000 Subject: fix [#28725] No way to control fluid simulator from Python API? now exec() blocks while doing fluid bake, invoke starts a background job (texture bake also works this way). --- source/blender/editors/physics/physics_fluid.c | 48 ++++++++++++++++++-------- 1 file changed, 34 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 11796d01620..2f62e55bcd8 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; - 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; } -- cgit v1.2.3 From bc593cac2354c863f074d9d51cffb3dca9f499a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 06:48:17 +0000 Subject: fix for incorrect use of strlen() with the sequencer rna (no need for strlen()+1) --- source/blender/makesrna/intern/rna_sequencer.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 96e6eea22af..d7e0113f56e 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) -- cgit v1.2.3 From 4158cee688f4a63f8f3a4ff5e20fa3c6b3f95719 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 08:03:02 +0000 Subject: color strip was showing image crop and and offset twice, also made 'Make Metastrip' key shortcut Ctrl+G (so shift+G can be used for select group like object mode) --- source/blender/editors/space_sequencer/sequencer_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 5c13b57cca8..ecc8fe7f967 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -165,7 +165,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); -- cgit v1.2.3 From 2d151cda1cb0b2c8be01c26e392f077f6807579a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 28 Sep 2011 08:31:02 +0000 Subject: Fix crash when starting baking fluid when baking thread is already started. --- source/blender/editors/physics/physics_fluid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 2f62e55bcd8..918adcac138 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -1145,7 +1145,7 @@ 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), TRUE)) return OPERATOR_CANCELLED; -- cgit v1.2.3 From 3a4b6da67405ccba605f62ef8f67fe04e2024c28 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 28 Sep 2011 08:56:40 +0000 Subject: Fix #28601: SEGFAULT: Regression in free_imbuf_seq Actually, it's NULL-pointer dereference in rna_Sequence_update caused by RNA cache. Discussed with Joshua and he thought it's acceptable for now to add extra NULL-check here. --- source/blender/makesrna/intern/rna_sequencer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index d7e0113f56e..e585c530402 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -559,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) -- cgit v1.2.3 From 5e3110af059b328e8ddcffbc07e403cd7817fa5f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 09:18:20 +0000 Subject: add support for a 4th item for rna property enums in python so the numeric value can be passed, this is so you can animate the enum and keep the values even if you add items in the middle of the enum. - request from ZanQdo. --- source/blender/python/intern/bpy_props.c | 35 ++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 04c64bcbd3c..88383ce84d5 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -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 Date: Wed, 28 Sep 2011 09:47:30 +0000 Subject: transform sequencer update was checking against the wrong transform mode. --- source/blender/editors/transform/transform_conversions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 54ab93b5fcf..8dd877eaf1d 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2275,7 +2275,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; -- cgit v1.2.3 From c8b0d25794be3dc98375fb4042746bd31a4ba961 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 10:05:56 +0000 Subject: fix [#28158] Image crop keyframes/fcurves do not 'stick' to strip --- .../blender/editors/transform/transform_conversions.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 8dd877eaf1d..db9be369761 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -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); @@ -3827,6 +3837,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 +3856,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count *count= 1; /* ignore the selection for nested */ *recursive = 0; } +#endif } } } -- cgit v1.2.3 From d0e7be242bae4abebbda1e7e183b4a5c4f9f9e1d Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 28 Sep 2011 11:56:50 +0000 Subject: OSX: solve weaklinking for non-apple compilers by using Xlinker, build also QTKit with apple gcc, to be more compatible to distributed gnu-gcc compilers without objC, objC++ capabilities --- source/blender/quicktime/SConscript | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript index 24dfab13fd9..d2a42ddf7b3 100644 --- a/source/blender/quicktime/SConscript +++ b/source/blender/quicktime/SConscript @@ -35,5 +35,7 @@ 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) +if env['WITH_GHOST_COCOA'] and env['CC'].endswith('4.6.1'): + 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/gcc-4.2') +else: + env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities) -- cgit v1.2.3 From c0a89e48cc62fb4895f621d2a48774a2d60b4c74 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 28 Sep 2011 14:08:56 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_space.c | 6 +- source/blender/makesrna/intern/rna_texture.c | 121 +++++++++++++-------- source/blender/makesrna/intern/rna_userdef.c | 152 ++++++++++++++++++--------- 3 files changed, 180 insertions(+), 99 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index e561065cb09..fa98e07da20 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2068,7 +2068,7 @@ 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"); + "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 */ @@ -2144,7 +2144,7 @@ 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 */ @@ -2516,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_texture.c b/source/blender/makesrna/intern/rna_texture.c index e2beabf789d..504e0bed978 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); @@ -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); @@ -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_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index b81b370a890..6aab5af056d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2003,10 +2003,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}}; @@ -2036,7 +2042,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); @@ -2055,34 +2061,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); @@ -2090,7 +2102,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); @@ -2102,17 +2115,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); @@ -2121,30 +2139,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); @@ -2182,7 +2200,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... @@ -2190,7 +2209,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"); } @@ -2210,7 +2230,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}}; @@ -2224,12 +2244,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); @@ -2252,22 +2274,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); @@ -2280,12 +2306,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); @@ -2306,7 +2336,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); @@ -2459,10 +2490,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[] = { @@ -2536,7 +2571,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); @@ -2563,7 +2598,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); @@ -2580,16 +2616,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 converts 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"); @@ -2615,12 +2655,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_ui_text(prop, "VBOs", + "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering"); prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA); @@ -2630,7 +2672,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", + "The 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); @@ -2642,12 +2685,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"); @@ -2769,7 +2815,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); @@ -2850,7 +2897,8 @@ static void rna_def_userdef_input(BlenderRNA *brna) 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", + "Emulates 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); @@ -2945,7 +2993,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); @@ -2976,11 +3026,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); -- cgit v1.2.3 From 113d556295a84603b95e5bc318e2cb28a27097ed Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 14:12:27 +0000 Subject: patch [#28571] from Bastien Montagne (mont29) Only applied Sequencer Select Grouped functionality - similar to the one in object mode, select strips based on type, time, data etc. --- .../editors/space_sequencer/sequencer_intern.h | 2 +- .../editors/space_sequencer/sequencer_ops.c | 5 +- .../editors/space_sequencer/sequencer_select.c | 266 +++++++++++++++++++++ 3 files changed, 271 insertions(+), 2 deletions(-) (limited to 'source') 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 ecc8fe7f967..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); @@ -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 3ea27899128..f1c1e21758d 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" @@ -882,3 +883,268 @@ 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; + 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; + + seq->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", ""); +} + -- cgit v1.2.3 From 35f881b44dfed78290770f929405b63f480d78cb Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 28 Sep 2011 15:22:13 +0000 Subject: Commented and tagged some unused vars, added some var init (gcc warnings...) --- source/blender/blenkernel/intern/cloth.c | 4 ++-- source/blender/blenkernel/intern/collision.c | 6 +++--- source/blender/editors/animation/anim_filter.c | 16 ++++++++++------ .../blender/editors/space_sequencer/sequencer_select.c | 10 ++++++---- source/blender/gpu/intern/gpu_material.c | 2 +- source/blender/imbuf/intern/anim_movie.c | 4 ++-- source/blender/modifiers/intern/MOD_explode.c | 4 +++- 7 files changed, 27 insertions(+), 19 deletions(-) (limited to 'source') 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 32d78a4d306..26ee62e035b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -2364,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; @@ -2375,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; //////////////////////////////////////////////////////////// @@ -2477,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/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index bd5935c893c..f55d67fed41 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -344,15 +344,19 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) * keep expander channels with no sub-data out, as those cases should get * dealt with by the recursive detection idiom in place. */ +/* XXX Commented most of that macro, since it seems that _doSubChannels var is never used... + * mont29. + */ #define BEGIN_ANIMFILTER_SUBCHANNELS(expanded_check) \ { \ int _filter = filter_mode; \ - short _doSubChannels = 0; \ - if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) \ - _doSubChannels=1; \ - else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) \ - _doSubChannels=2; \ - else {\ +/* short _doSubChannels = 0; \*/ \ +/* if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) \*/ \ +/* _doSubChannels=1; \*/ \ +/* else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) \*/ \ +/* _doSubChannels=2; \*/ \ +/* else {\*/ \ + if (!(!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check) || !(filter_mode & ANIMFILTER_LIST_CHANNELS))) { \ filter_mode |= ANIMFILTER_TMP_PEEK; \ } /* ... standard sub-channel filtering can go on here now ... */ diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index f1c1e21758d..232c112ee21 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -889,11 +889,13 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) 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)"}, + {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"}, + {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} }; @@ -1033,7 +1035,7 @@ static short select_grouped_time_overlap(Editing *ed, Sequence *actseq) static short select_grouped_effect_link(Editing *ed, Sequence *actseq) { - Sequence *seq; + Sequence *seq = NULL; short changed = FALSE; short is_audio = ((actseq->type == SEQ_META) || SEQ_IS_SOUND(actseq)); int startdisp = actseq->startdisp; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index c3cbcb61622..f435b507a2a 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; 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/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index cbf079bccef..0f3822f8cb6 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -558,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(); -- cgit v1.2.3 From b88776ba5a1d58d87b1a70ed73337c2e04e068f8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 15:42:55 +0000 Subject: fix for crash with demo mode addon, modal operator loading a blend file would free all window data which was then accessed, causing a crash. --- source/blender/python/intern/bpy_rna.c | 12 +++- .../blender/windowmanager/intern/wm_event_system.c | 70 ++++++++++++---------- 2 files changed, 48 insertions(+), 34 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index cbd6affb117..271e4c72a25 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6238,7 +6238,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. */ + const char is_valid_screen= (CTX_wm_screen(C) != NULL); PropertyRNA *pret_single= NULL; void *retdata_single= NULL; @@ -6498,7 +6502,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_screen == (CTX_wm_screen(C) != NULL)) + { wmOperator *op= ptr->data; reports= op->reports; } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index cfeaee18416..596fa35d597 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; + } } } -- cgit v1.2.3 From a4032683310f406161852d435ecd759275f8db1c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 28 Sep 2011 16:13:36 +0000 Subject: Fix #28185: Regression test: outlinertest blend Added notifier handler to outliner. --- source/blender/editors/space_outliner/space_outliner.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source') 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; } -- cgit v1.2.3 From bee8e456f6da9d08ab2a1caa6cf452b9c2a95d36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 16:25:50 +0000 Subject: dont give an error on when texface conversion fails on load. give a warning instead. this is needed because python converts report errors to exceptions (as if the file load operator couldn't complete), but infact it does load the file so rather then stopping the script, just report this as a warning. --- source/blender/blenloader/intern/readfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f1f055b4004..ce4fb85fef3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7058,7 +7058,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 -- cgit v1.2.3 From 416885aad44b0b0e3577f8f8f28c75ee5f669263 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 28 Sep 2011 17:15:28 +0000 Subject: OSX: always compile GHOST and Quicktime with Apple-gcc-4.2, simplifies for non-apple compilers --- source/blender/quicktime/SConscript | 1 - 1 file changed, 1 deletion(-) (limited to 'source') diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript index d2a42ddf7b3..6dbba3ea868 100644 --- a/source/blender/quicktime/SConscript +++ b/source/blender/quicktime/SConscript @@ -35,7 +35,6 @@ defs=['WITH_QUICKTIME'] if env['WITH_GHOST_COCOA']: defs.append('GHOST_COCOA') -if env['WITH_GHOST_COCOA'] and env['CC'].endswith('4.6.1'): 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/gcc-4.2') else: env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities) -- cgit v1.2.3 From 6088d460efd48728cb3fc58254557766b79ef6d4 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 28 Sep 2011 17:28:37 +0000 Subject: OSX: Give clear commenting and more up-to-date defaults --- source/blender/quicktime/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript index 6dbba3ea868..d80a414898f 100644 --- a/source/blender/quicktime/SConscript +++ b/source/blender/quicktime/SConscript @@ -35,6 +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, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/gcc-4.2') + 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/gcc-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers don´t support it fully yet else: env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities) -- cgit v1.2.3 From ce714341b9730375d20359ee040ebd777748f037 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 28 Sep 2011 17:45:32 +0000 Subject: Using non ASCII-conform char in comment broke compile --- source/blender/quicktime/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript index d80a414898f..986302696fb 100644 --- a/source/blender/quicktime/SConscript +++ b/source/blender/quicktime/SConscript @@ -35,6 +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, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/gcc-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers don´t support it fully yet + 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/gcc-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers does not support it fully yet else: env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities) -- cgit v1.2.3 From 47ca7e23c053512204f889906c048d71646110a6 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 28 Sep 2011 17:52:07 +0000 Subject: Now in proper english, hehe --- source/blender/quicktime/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript index 986302696fb..82735dc96bd 100644 --- a/source/blender/quicktime/SConscript +++ b/source/blender/quicktime/SConscript @@ -35,6 +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, cc_compilerchange='/usr/bin/gcc-4.2', cxx_compilerchange='/usr/bin/gcc-4.2') # always use Apple-gcc-4.2 for objC language, for gnu-compilers does not support it fully yet + 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/gcc-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) -- cgit v1.2.3 From 2ad45b5c4f54765ad8804d26dd28b1eca2c235e5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Sep 2011 18:45:17 +0000 Subject: fix 2 bugs with reset-default failing on operators redo panel. - The operator its self was registered so resetting the defaults would unhelpfully replace the toolbar with the reset to defaults operator panel. - The callback for the operator wasnt being used so the settings were changed but the operator didnt re-run. --- source/blender/editors/include/UI_interface.h | 1 + source/blender/editors/interface/interface.c | 2 +- .../blender/editors/interface/interface_handlers.c | 52 ++++++++++++++++------ source/blender/editors/interface/interface_ops.c | 25 ++++++++++- source/blender/makesdna/DNA_ID.h | 2 + 5 files changed, 66 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 4a895472b33..a5781ab7267 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -787,6 +787,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/interface/interface.c b/source/blender/editors/interface/interface.c index 286906402b9..bcf83f7bfb9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -746,7 +746,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 { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 082ddb5b060..929a8bf1dc6 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5089,19 +5089,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,24 +5112,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; + block->handle_func(C, block->handle_func_arg, 0); + } } /* helper function for insert keyframe, reset to default, etc operators */ diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index fd9386dc5ab..ea7e8fb81bc 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -295,10 +295,31 @@ 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 */ + /* Note that buttons already account for this, it might be better to + * have a way to edit the buttons rather than set the rna since block + * callbacks also fail to run. */ + 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 +335,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/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 80fc6f63363..11c60076423 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -204,6 +204,8 @@ 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)) + #ifdef GS #undef GS #endif -- cgit v1.2.3 From a52ac47305e641030695221e2ead8b239b1a531c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 28 Sep 2011 19:05:47 +0000 Subject: Fix #28726: maya key configuration lost after file > new. --- source/blender/windowmanager/intern/wm_files.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index f862af6173a..c08b8c0d01f 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; -- cgit v1.2.3 From e54bfda0f3caff9de44fb13416cf6e192e262425 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 28 Sep 2011 19:11:59 +0000 Subject: Fix autosave trying to write to / if no userpref temp directory was set, like other code in blender it should write to the one actually verified to exist. Also fixes wrong temp directory when loading user preferences with no temp directory from a state where one was specified. --- source/blender/windowmanager/intern/wm_files.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index c08b8c0d01f..76ebeaa9f21 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -289,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); } @@ -853,14 +854,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) @@ -918,7 +919,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); -- cgit v1.2.3 From f05b6bb7c1c9f5f4bd6199d6f40b56fe5729d4dd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 28 Sep 2011 19:18:29 +0000 Subject: Fix #28728: volume precaching took a long time with many objects, changed threading to no longer sleep 50ms for each object, using work queue now. Also it was showing SSS preprocessing while actually doing Volume precaching, fixed as well. --- .../blender/render/intern/include/render_types.h | 1 - .../blender/render/intern/source/volume_precache.c | 178 +++++++++++---------- 2 files changed, 90 insertions(+), 89 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 0b339d285ce..6d27c7707f0 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -485,7 +485,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/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; threadtest_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; } } -- cgit v1.2.3 From 45b74dcf2cd787841459ac7cb133ca6ecca83e19 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 28 Sep 2011 23:43:48 +0000 Subject: Reverting part of r.40659 The output of an automated tool is not a valid excuse for clobbering code to increase maintenance headaches later on. --- source/blender/editors/animation/anim_filter.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index f55d67fed41..c982a1d7f86 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -343,20 +343,23 @@ 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. - */ -/* XXX Commented most of that macro, since it seems that _doSubChannels var is never used... - * mont29. + * + * 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) \ { \ int _filter = filter_mode; \ -/* short _doSubChannels = 0; \*/ \ -/* if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) \*/ \ -/* _doSubChannels=1; \*/ \ -/* else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) \*/ \ -/* _doSubChannels=2; \*/ \ -/* else {\*/ \ - if (!(!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check) || !(filter_mode & ANIMFILTER_LIST_CHANNELS))) { \ + short _doSubChannels = 0; \ + if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) \ + _doSubChannels=1; \ + else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) \ + _doSubChannels=2; \ + else {\ filter_mode |= ANIMFILTER_TMP_PEEK; \ } /* ... standard sub-channel filtering can go on here now ... */ -- cgit v1.2.3 From 5bbd0decfdbcb716064726b75949263a57b02d89 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Sep 2011 05:03:21 +0000 Subject: fix [#28765] keyframe handles do not move with curves in graph editor when hidden, resulting in bad curves. hide handles wasn't properly respected by transform function testhandles_fcurve(). --- source/blender/blenkernel/BKE_fcurve.h | 2 +- source/blender/blenkernel/intern/fcurve.c | 13 +++++++--- source/blender/editors/animation/keyframes_edit.c | 6 ++++- source/blender/editors/space_graph/graph_buttons.c | 6 +++-- .../editors/transform/transform_conversions.c | 29 +++++++++++----------- 5 files changed, 35 insertions(+), 21 deletions(-) (limited to 'source') 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/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 3916d0ca701..8ea80ae9296 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -818,7 +818,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 +834,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/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/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/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index db9be369761..c2d63fa8246 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2785,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 */ @@ -2834,7 +2834,7 @@ static void posttrans_fcurve_clean (FCurve *fcu) } } - testhandles_fcurve(fcu); + testhandles_fcurve(fcu, use_handle); } /* free cache */ @@ -2865,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 */ @@ -3320,9 +3320,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. @@ -3413,9 +3413,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 */ @@ -3475,7 +3475,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 */ @@ -3679,7 +3679,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); } } } @@ -4832,11 +4832,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 */ } } @@ -4916,6 +4916,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) @@ -4944,11 +4945,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); } } -- cgit v1.2.3 From ceb81b1960db2d1cf89fa6305ea9f13874cda950 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Sep 2011 06:13:25 +0000 Subject: no-longer select handles when transforming in the dopesheet since now the dope sheet acts as if handles are hidden. also remove invalid comment. --- source/blender/editors/interface/interface_ops.c | 3 --- source/blender/editors/transform/transform_conversions.c | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index ea7e8fb81bc..081b528d153 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -306,9 +306,6 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) /* 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 */ - /* Note that buttons already account for this, it might be better to - * have a way to edit the buttons rather than set the rna since block - * callbacks also fail to run. */ if(success) { ID *id= ptr.id.data; if(id && ID_CHECK_UNDO(id)) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index c2d63fa8246..c3a249d69bc 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2890,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; + } } } -- cgit v1.2.3 From 9465efd401474c40d45b9943111a68f502832f5f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Sep 2011 06:15:33 +0000 Subject: use math functions for curve handle calculation. --- source/blender/blenkernel/intern/colortools.c | 78 ++++++------ source/blender/blenkernel/intern/curve.c | 175 +++++++++++++------------- 2 files changed, 123 insertions(+), 130 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 61e9daf4138..7747e4750b7 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -361,72 +361,70 @@ 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; + mul_v2_fl(dvec_a, 1.0f/3.0f); + sub_v2_v2v2(p2-3, p2, dvec_a); } if(bezt->h2==HD_VECT) { - dx1/=3.0f; - dy1/=3.0f; - *(p2+3)= *p2+dx1; - *(p2+4)= *(p2+1)+dy1; + mul_v2_fl(dvec_b, 1.0f/3.0f); + sub_v2_v2v2(p2+3, p2, dvec_b); } } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 794006e6f39..b703c33f174 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2457,72 +2457,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 (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(len1==0.0f) len1=1.0f; - if(len2==0.0f) len2=1.0f; + 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 +2544,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 +2569,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 +2595,52 @@ 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; + mul_v3_fl(dvec_a, 1.0f/3.0f); + sub_v3_v3v3(p2-3, p2, dvec_a); } 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; + mul_v3_fl(dvec_b, 1.0f/3.0f); + sub_v3_v3v3(p2+3, p2, dvec_b); } - 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]); } } } -- cgit v1.2.3 From 4b325a938e716787bc51b5cb89e704aac1bd012a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Sep 2011 07:59:33 +0000 Subject: make drawobject.c's code for getting the camera view frame into its own function. (no functional changes) --- source/blender/blenkernel/BKE_object.h | 5 ++ source/blender/blenkernel/intern/object.c | 76 +++++++++++++++++ source/blender/editors/space_view3d/drawobject.c | 102 +++++++---------------- 3 files changed, 111 insertions(+), 72 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 7e39461a032..1dd4feeab2e 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_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/intern/object.c b/source/blender/blenkernel/intern/object.c index eae317b97fc..c9bad579507 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3057,6 +3057,82 @@ 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 aspx, aspy; + float facx, facy; + float depth; + + /* aspect correcton */ + if (scene) { + aspx= (float) scene->r.xsch*scene->r.xasp; + 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 { + aspx= 1.0f; + aspy= 1.0f; + 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_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/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 63a1d7f7b4f..35c3e909d84 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(); } -- cgit v1.2.3 From 4b2b8fe9bdb4b47a414c9315e515706bdb30194a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Sep 2011 08:23:52 +0000 Subject: rna function: vecs = Camera.view_frame(scene) returns 4 points for the camera frame, without this its very hard to know if a point is in the camera view or not, without rewriting blenders internal logic in python. --- source/blender/blenkernel/BKE_object.h | 2 +- source/blender/blenkernel/intern/object.c | 2 +- source/blender/makesrna/intern/CMakeLists.txt | 1 + source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_camera.c | 3 + source/blender/makesrna/intern/rna_camera_api.c | 88 +++++++++++++++++++++++++ source/blender/makesrna/intern/rna_internal.h | 1 + 7 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 source/blender/makesrna/intern/rna_camera_api.c (limited to 'source') diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 1dd4feeab2e..b1943fdf97c 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -149,7 +149,7 @@ void object_camera_matrix( 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_frame(struct Scene *scene, struct Camera *camera, 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); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index c9bad579507..5530096f8ea 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3122,7 +3122,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh r_vec[3][0]= r_shift[0] - facx; r_vec[3][1]= r_shift[1] + facy; r_vec[3][2]= depth; } -void camera_frame(Scene *scene, Camera *camera, float r_vec[4][3]) +void camera_view_frame(Scene *scene, Camera *camera, float r_vec[4][3]) { float dummy_asp[2]; float dummy_shift[2]; diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 99c7a0e2476..5a0a3388c85 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -95,6 +95,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 diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 80352d3f03e..bc45ea4deed 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -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_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..9e92527aef7 --- /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 +#include +#include + + +#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_internal.h b/source/blender/makesrna/intern/rna_internal.h index 78b8c67d92c..cf1be39124e 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -234,6 +234,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); -- cgit v1.2.3 From e5078f196fb3b7739865591977c876552396d418 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Sep 2011 09:19:15 +0000 Subject: Attempt to fix error reported by yafaray devs from my commit r40660 --- source/blender/python/intern/bpy_rna.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 271e4c72a25..31a1d408599 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6242,7 +6242,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param /* annoying!, need to check if the screen gets set to NULL which is a * hint that the file was actually re-loaded. */ - const char is_valid_screen= (CTX_wm_screen(C) != NULL); + const char is_valid_wm= (CTX_wm_manager(C) != NULL); PropertyRNA *pret_single= NULL; void *retdata_single= NULL; @@ -6505,7 +6505,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if ( (!is_static) && (ptr->data) && (RNA_struct_is_a(ptr->type, &RNA_Operator)) && - is_valid_screen == (CTX_wm_screen(C) != NULL)) + is_valid_wm == (CTX_wm_manager(C) != NULL)) { wmOperator *op= ptr->data; reports= op->reports; -- cgit v1.2.3 From bfbfe16570cf0ce1b52d72232ecede4f5e4b52c2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Sep 2011 09:29:46 +0000 Subject: take 2 at fixing the crash... --- source/blender/python/intern/bpy_rna.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 31a1d408599..98aa8c9be35 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6242,7 +6242,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param /* annoying!, need to check if the screen gets set to NULL which is a * hint that the file was actually re-loaded. */ - const char is_valid_wm= (CTX_wm_manager(C) != NULL); + char is_valid_wm; PropertyRNA *pret_single= NULL; void *retdata_single= NULL; @@ -6269,6 +6269,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) { @@ -6505,7 +6507,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if ( (!is_static) && (ptr->data) && (RNA_struct_is_a(ptr->type, &RNA_Operator)) && - is_valid_wm == (CTX_wm_manager(C) != NULL)) + (is_valid_wm == (CTX_wm_manager(C) != NULL))) { wmOperator *op= ptr->data; reports= op->reports; -- cgit v1.2.3 From a81b37e25223c078fbcdb12554a6f89f93bbf48c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 29 Sep 2011 10:17:34 +0000 Subject: Pedantic changes to description for recently added select grouped operator --- source/blender/editors/space_sequencer/sequencer_select.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 232c112ee21..45dd08e3ece 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -1134,7 +1134,7 @@ void SEQUENCER_OT_select_grouped(wmOperatorType *ot) { /* identifiers */ ot->name = "Select Grouped"; - ot->description = "Select all strips grouped by various properties."; + ot->description = "Select all strips grouped by various properties"; ot->idname = "SEQUENCER_OT_select_grouped"; /* api callbacks */ @@ -1146,7 +1146,7 @@ void SEQUENCER_OT_select_grouped(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first."); + 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", ""); } -- cgit v1.2.3 From e276855e60dc69b4e3313d635322a86a3e7e1e6e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 29 Sep 2011 13:52:58 +0000 Subject: Fix #28769 & #28768: problem with duplicated keymap items after fix yesterday. --- source/blender/makesdna/DNA_windowmanager_types.h | 1 + source/blender/windowmanager/intern/wm.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'source') 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/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); -- cgit v1.2.3 From add77842d9c94c53224b7aee36cb699d360e9ee8 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 29 Sep 2011 14:41:11 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. (grrr... That update created tons of new things... back to ~40% done...) --- .../editors/interface/interface_templates.c | 2 +- source/blender/makesrna/intern/rna_object_force.c | 4 +-- source/blender/makesrna/intern/rna_scene.c | 8 ++--- source/blender/makesrna/intern/rna_sequencer.c | 16 ++++----- source/blender/makesrna/intern/rna_smoke.c | 6 ++-- source/blender/makesrna/intern/rna_texture.c | 2 +- source/blender/makesrna/intern/rna_ui.c | 4 +-- source/blender/makesrna/intern/rna_userdef.c | 38 +++++++++++----------- 8 files changed, 39 insertions(+), 41 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 44aa6d1e090..ff6ef41bfb0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -415,7 +415,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str 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) diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index c046c222898..0b137633349 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1680,7 +1680,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"); /***********************************************************************************/ @@ -1722,7 +1722,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_scene.c b/source/blender/makesrna/intern/rna_scene.c index 5332d7b1657..ff1cd052913 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1240,7 +1240,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) 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 */ @@ -1872,19 +1872,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 */ diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index e585c530402..3d81ec24d29 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -821,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); 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_texture.c b/source/blender/makesrna/intern/rna_texture.c index 504e0bed978..21a426640f2 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -668,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); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 52c359d79dd..29357362ae2 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -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\""); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 6aab5af056d..12951f137ec 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2629,7 +2629,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) 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"); + "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"); @@ -2673,7 +2673,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) 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)"); + "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); @@ -2704,31 +2704,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); @@ -2749,11 +2749,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 } @@ -2774,13 +2774,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); @@ -2792,7 +2792,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"); @@ -2893,16 +2893,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)"); + "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); @@ -2916,7 +2916,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"); @@ -2945,7 +2945,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); -- cgit v1.2.3 From f65c72afafd91f357b6d0a94f906e8cf4baeafe7 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 29 Sep 2011 15:28:22 +0000 Subject: =?UTF-8?q?Commented=20and=20tagged=20some=20unused=20vars,=20adde?= =?UTF-8?q?d=20some=20var=20init=20(gcc=20warnings...).=20Won=E2=80=99t=20?= =?UTF-8?q?go=20further,=20most=20other=20warnings=20are=20from=20GE=20or?= =?UTF-8?q?=20intern/extern=20lib=20code...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/blenkernel/intern/implicit.c | 10 +++++----- source/blender/blenkernel/intern/multires.c | 2 +- source/blender/blenkernel/intern/softbody.c | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 295669c98c0..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; isprings; 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]); 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/softbody.c b/source/blender/blenkernel/intern/softbody.c index 2960d8a41e5..784c67d6d77 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1744,12 +1744,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 +1869,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 +1906,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)){ -- cgit v1.2.3 From fe63d078839efa4bcb2eec6c19d97650d059cc2e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 29 Sep 2011 15:58:15 +0000 Subject: Minor: Other UI strings typos and tweaks. --- source/blender/makesrna/intern/rna_particle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 1d8a91861d6..8eb25290b18 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -2068,7 +2068,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) 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_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); -- cgit v1.2.3 From e21e7895071eaa7484679639f39bb7f413bb4dcc Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Thu, 29 Sep 2011 18:37:09 +0000 Subject: SVN maintenance. --- source/blender/makesrna/intern/rna_camera_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c index 9e92527aef7..39478713663 100644 --- a/source/blender/makesrna/intern/rna_camera_api.c +++ b/source/blender/makesrna/intern/rna_camera_api.c @@ -1,5 +1,5 @@ /* - * $Id: + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3 From e6a9b68c798457430698afbfc7dfcdd8b71ca596 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Thu, 29 Sep 2011 21:38:57 +0000 Subject: Recast: upgrade library. - Upgrade Recast library to latest portable version - Implement recast_qsort based on FreeBSD qsort.c to have portable thread safe quick sort for use in conversion routine. - Better default value for the Build Navigation Mesh operator --- .../blender/blenkernel/intern/navmesh_conversion.c | 13 ++++-------- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/mesh/mesh_navmesh.c | 23 +++++++++++++++------- source/gameengine/Ketsji/KX_NavMeshObject.cpp | 2 +- source/gameengine/Ketsji/KX_SteeringActuator.cpp | 6 +++--- 6 files changed, 26 insertions(+), 22 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c index 8a2ec1e5169..04f6ff19564 100644 --- a/source/blender/blenkernel/intern/navmesh_conversion.c +++ b/source/blender/blenkernel/intern/navmesh_conversion.c @@ -328,14 +328,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 +363,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/scene.c b/source/blender/blenkernel/intern/scene.c index d8ae36b4ab5..1a72405ad5e 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -526,7 +526,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; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ce4fb85fef3..482a78007fb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12101,7 +12101,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) 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; + 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) diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 1cd5dcdb241..e4b884744e1 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -174,7 +174,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts struct recast_compactHeightfield* chf; struct recast_contourSet *cset; int width, height, walkableHeight, walkableClimb, walkableRadius; - int minRegionSize, mergeRegionSize, maxEdgeLen; + int minRegionArea, mergeRegionArea, maxEdgeLen; float detailSampleDist, detailSampleMaxError; recast_calcBounds(verts, nverts, bmin, bmax); @@ -183,8 +183,8 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts walkableHeight= (int)ceilf(recastParams->agentheight/ recastParams->cellheight); walkableClimb= (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); walkableRadius= (int)ceilf(recastParams->agentradius / recastParams->cellsize); - minRegionSize= (int)(recastParams->regionminsize * recastParams->regionminsize); - mergeRegionSize= (int)(recastParams->regionmergesize * recastParams->regionmergesize); + 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; @@ -212,13 +212,14 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts 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, RECAST_WALKABLE, solid, chf)) { + if(!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) { recast_destroyHeightfield(solid); recast_destroyCompactHeightfield(chf); @@ -226,6 +227,13 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts } 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)) { @@ -235,7 +243,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts } /* Partition the walkable surface into simple regions without holes */ - if(!recast_buildRegions(chf, walkableRadius, 0, minRegionSize, mergeRegionSize)) { + if(!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) { recast_destroyCompactHeightfield(chf); return 0; @@ -293,7 +301,8 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, Object* obedit; int createob= base==NULL; int nverts, nmeshes, nvp; - unsigned short *verts, *meshes, *polys; + unsigned short *verts, *polys; + unsigned int *meshes; float bmin[3], cs, ch, *dverts; unsigned char *tris; ModifierData *md; @@ -348,7 +357,7 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, for(i= 0; itotvert; - unsigned short vbase= meshes[4*i+0]; + 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]; 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_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp index a0a2e148c1e..1edecdf44d2 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp +++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp @@ -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); -- cgit v1.2.3 From 265c113820e2e01a309b9b28b8f592f8b6403908 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Sep 2011 07:47:45 +0000 Subject: fix for crash generating messages.txt, I wasn't getting this crash because I had 'WITH_PYTHON_SAFETY' enabled which was using different iterators (which dont crash), now there on by default. made headless and no-python configurations work again and added --factory-startup to doc building command. --- source/blender/editors/interface/interface_draw.c | 1 + source/blender/python/intern/bpy_rna.h | 8 +++++--- source/blender/windowmanager/intern/wm_init_exit.c | 2 ++ source/blender/windowmanager/intern/wm_operators.c | 15 ++++++++++----- 4 files changed, 18 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index b65be48f7ee..a40900fb39b 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -466,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]; 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/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 3d7737830eb..766be796484 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -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 841198c0664..b980b45bae4 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1208,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; @@ -1219,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; -- cgit v1.2.3 From 43e72dfa3a5896c7a03d2eba145e7f7a72a6b0b8 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 30 Sep 2011 08:10:53 +0000 Subject: Minor: Other UI strings typos and tweaks. --- source/blender/makesrna/intern/rna_armature.c | 2 +- source/blender/makesrna/intern/rna_boid.c | 2 +- source/blender/makesrna/intern/rna_main_api.c | 4 ++-- source/blender/makesrna/intern/rna_screen.c | 6 +++--- source/blender/makesrna/intern/rna_userdef.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index a834fcf820b..75c21e3f47e 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -752,7 +752,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 */ 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_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 511cd9562b5..54bae59ae93 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -670,7 +670,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"); @@ -949,7 +949,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_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_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 12951f137ec..5d2f24e8324 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -3058,7 +3058,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); @@ -3083,7 +3083,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", ""}, -- cgit v1.2.3 From fb58270a6c087aae3c63156b4a79d3fe6434fe82 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Sep 2011 08:27:38 +0000 Subject: add bevel weight to editmode buttons, patch from Psy-Fi or IRC. --- .../blender/editors/space_view3d/view3d_buttons.c | 131 +++++++++++++++------ 1 file changed, 93 insertions(+), 38 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 7bc25fcf1cc..e1fb287d79c 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) { -- cgit v1.2.3 From 79307369fe8908aca6e746f65aea0ade7218c280 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 30 Sep 2011 09:55:21 +0000 Subject: Bump maps flip: now white means salience, black means concavity Files created in blender before this revision should be rendered in exactly the same way they used to render before. Patch by Morten Mikkelsen, finished by Ton and me. --- source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenkernel/intern/texture.c | 6 +- source/blender/blenloader/intern/readfile.c | 101 +++++++++++++-------- source/blender/gpu/intern/gpu_material.c | 7 +- source/blender/makesdna/DNA_texture_types.h | 1 + .../blender/render/intern/source/render_texture.c | 11 ++- 6 files changed, 85 insertions(+), 43 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index a09e475c9a3..0f674995294 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 diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 38165182d83..ea6f6eb702b 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -640,7 +640,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/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 482a78007fb..765fe7ada12 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12063,9 +12063,7 @@ 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; @@ -12074,45 +12072,72 @@ static void do_versions(FileData *fd, Library *lib, Main *main) 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; amtex[a]; + + if(mtex) { + if((mtex->texflag&MTEX_BUMP_FLIPPED)==0) { + if((mtex->mapto&MAP_NORM) && mtex->texflag&(MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) { + 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 = (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; - } } - + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index f435b507a2a..a792b51e1cf 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -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/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/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; -- cgit v1.2.3 From 31363c33249e998fd170fa7f59422fc18397b5a4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 30 Sep 2011 12:33:52 +0000 Subject: Fix [#28773] Auto Set Preview Range Does not work on selection in DopeSheet (viewall was also broken for DopeSheet, btw, same cause). --- source/blender/editors/space_action/action_edit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 60662334e20..fdf9209c813 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 */ -- cgit v1.2.3 From f3ae228c9d672990f0cbd40a10fcc9c68935a2fc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Sep 2011 15:22:13 +0000 Subject: minor changes, dont append with cmake platform flags which is a string and use enum values rather then ints in a few places. --- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/interface/interface_icons.c | 6 +++--- source/blender/makesdna/DNA_ID.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index bcf83f7bfb9..878b280118d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2467,7 +2467,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; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index fbad34252e7..24434465f5f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -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/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 11c60076423..f81a05f5625 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) -- cgit v1.2.3 From 2bb59bc2734ac682208419e42aebf27285a88d22 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 30 Sep 2011 15:42:04 +0000 Subject: Fix #28432: Scrolling lists respond incorrectly if mouse is not moved Copy hardmin for LISTROW and ROW buttons when updating button from old block due to list item index is stored in this value. --- source/blender/editors/interface/interface.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 878b280118d..a3ae39c8440 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -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); -- cgit v1.2.3 From cf3956f450127956f92e0efea6010c5e9eb2c490 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Sep 2011 15:51:58 +0000 Subject: formatting edits only --- source/creator/CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 28a621c923c..86aebe47edc 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -125,7 +125,7 @@ if(WIN32 AND NOT UNIX) -DBLEN_VER_RC_4=0 ) endif() - + list(APPEND SRC ../icons/winblender.rc @@ -198,16 +198,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() @@ -687,14 +687,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 @@ -728,7 +728,7 @@ elseif(APPLE) FILES ${PLAYER_SOURCEDIR}/Contents/PkgInfo DESTINATION ${TARGETDIR}/blenderplayer.app/Contents ) - + install_dir( ${PLAYER_SOURCEDIR}/Contents/Resources \${TARGETDIR}/blenderplayer.app/Contents/ @@ -742,7 +742,7 @@ elseif(APPLE) 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 @@ -917,12 +917,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() -- cgit v1.2.3 From 471ea617b2dbe002ed57ef06a7ea6ab83f0924b7 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 1 Oct 2011 00:56:36 +0000 Subject: Bugfix [#28781] Grease pencil segfaults when deleting or duplicating frames in dopesheet --- source/blender/editors/space_action/action_edit.c | 25 ++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index fdf9209c813..a05053a2d9d 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -459,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)) { @@ -497,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)) { @@ -680,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)) @@ -709,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 ************************* */ @@ -764,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); @@ -1381,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"); @@ -1491,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"); -- cgit v1.2.3 From b062056c05a3b116d87466be03e0bc7d97dfca8e Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 1 Oct 2011 01:27:44 +0000 Subject: Bugfixes for: [#28525] [#28690] [#28774] [#28777] This commit basically disables the RNA update caches for now, and introduces a workaround/hack to ensure that modifier properties still work when animated/driven. The whole way that updates currently get handled needs reviewing in future. Fix provided by Brecht. --- source/blender/blenkernel/intern/anim_sys.c | 3 +++ source/blender/blenkernel/intern/depsgraph.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 5d01db87422..13abf18e20c 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1160,6 +1160,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; @@ -1176,6 +1178,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/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... } -- cgit v1.2.3 From fdcfb9a4a017224c9d9b8c66d6cd1efff55b00ab Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 1 Oct 2011 11:21:47 +0000 Subject: * Updating readme.html and link to release logs for 2.60, now that we approach the RC state. --- source/blender/windowmanager/intern/wm_operators.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b980b45bae4..16cba7d6758 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1280,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"); -- cgit v1.2.3 From ca5871c26fa11dd856aae1731877902bc4169cbf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 1 Oct 2011 13:46:20 +0000 Subject: reverting part of rev40594. Pardoon, looks like i've forgot to revert current work before commiting actual patch i wanted to send to the svn. --- source/blender/editors/space_view3d/view3d_edit.c | 2 +- source/blender/windowmanager/intern/wm_event_system.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index d3d7b1b1505..0854f9f3685 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3226,7 +3226,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve else WM_event_add_notifier(C, NC_SCENE|NA_EDITED, scene); - return OPERATOR_PASS_THROUGH; + return OPERATOR_FINISHED; } void VIEW3D_OT_cursor3d(wmOperatorType *ot) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 596fa35d597..cafee6b49ca 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1278,6 +1278,10 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand } /* Finished and pass through flag as handled */ + /* Finished and pass through flag as handled */ + if(retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH)) + return WM_HANDLER_HANDLED; + /* Modal unhandled, break */ if(retval == (OPERATOR_PASS_THROUGH|OPERATOR_RUNNING_MODAL)) return (WM_HANDLER_BREAK|WM_HANDLER_MODAL); -- cgit v1.2.3 From 7b398f271ec543c72e622074467d6861db797ccc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Oct 2011 15:02:55 +0000 Subject: fix for mingw --- source/blender/python/intern/bpy_rna.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 98aa8c9be35..ff2a3dd1303 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4706,7 +4706,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; */ +#ifdef 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 +5281,11 @@ PyTypeObject pyrna_prop_collection_iter_Type= { NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ +#ifdef 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 +5314,11 @@ PyTypeObject pyrna_prop_collection_iter_Type= { #endif /*** Added in release 2.2 ***/ /* Iterators */ +#ifdef 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 +5704,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 */ +#ifdef 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; -- cgit v1.2.3 From 646a397297d55452a8908122eb67e0d8eaceef5e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Oct 2011 15:40:32 +0000 Subject: add a collection function slot for assignment (not used yet). --- source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/RNA_define.h | 2 +- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_ID.c | 2 +- source/blender/makesrna/intern/rna_access.c | 15 ++++++++++ source/blender/makesrna/intern/rna_action.c | 2 +- source/blender/makesrna/intern/rna_armature.c | 2 +- source/blender/makesrna/intern/rna_color.c | 2 +- source/blender/makesrna/intern/rna_curve.c | 4 +-- source/blender/makesrna/intern/rna_define.c | 5 ++-- source/blender/makesrna/intern/rna_fluidsim.c | 2 +- source/blender/makesrna/intern/rna_group.c | 2 +- .../blender/makesrna/intern/rna_internal_types.h | 2 ++ source/blender/makesrna/intern/rna_key.c | 2 +- source/blender/makesrna/intern/rna_lattice.c | 4 +-- source/blender/makesrna/intern/rna_main.c | 2 +- source/blender/makesrna/intern/rna_material.c | 3 +- source/blender/makesrna/intern/rna_mesh.c | 33 ++++++++-------------- source/blender/makesrna/intern/rna_modifier.c | 2 +- source/blender/makesrna/intern/rna_object.c | 2 +- source/blender/makesrna/intern/rna_object_force.c | 3 +- source/blender/makesrna/intern/rna_pose.c | 2 +- source/blender/makesrna/intern/rna_render.c | 6 ++-- source/blender/makesrna/intern/rna_rna.c | 12 ++++---- source/blender/makesrna/intern/rna_scene.c | 7 ++--- source/blender/makesrna/intern/rna_sequencer.c | 8 +++--- 26 files changed, 66 insertions(+), 63 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 26bae68d5a4..6dbc002d505 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -778,6 +778,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, 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/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index bc45ea4deed..bb4d6d3a330 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; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index bf83d33a0a3..492f51967b2 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -367,7 +367,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 b995b5ab731..c6a9627aa3c 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2864,6 +2864,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, 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); diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 718f70cea1e..44c37f93b5e 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -451,7 +451,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_armature.c b/source/blender/makesrna/intern/rna_armature.c index 75c21e3f47e..c8e5faee7c8 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -841,7 +841,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); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 4ef6e9f4af7..65745ca2afd 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -405,7 +405,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..28c1a3bc234 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"); @@ -1450,7 +1450,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 63a41762f4c..ab469c19e15 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -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 @@ -2047,7 +2047,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch } } -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; @@ -2067,6 +2067,7 @@ 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: diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index ccb24d7dd9b..82911ebb3be 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -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_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 249833ae94b..87b35459d40 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, 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 352aaa890a5..0b44f7c98d0 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -337,7 +337,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_material.c b/source/blender/makesrna/intern/rna_material.c index 80a418a0047..a9878ab2bf2 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -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 00c79c32b3a..44be5ae8e35 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1226,8 +1226,7 @@ static void rna_def_mvert(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); 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_def_property_collection_funcs(prop, "rna_MeshVertex_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 vertex is member of"); @@ -1401,9 +1400,7 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); 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_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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshTextureFace", NULL); RNA_def_struct_sdna(srna, "MTFace"); @@ -1515,9 +1512,7 @@ static void rna_def_mcol(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshColor"); 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_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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshColor", NULL); RNA_def_struct_sdna(srna, "MCol"); @@ -1572,9 +1567,7 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshFloatProperty"); 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_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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshFloatProperty", NULL); RNA_def_struct_sdna(srna, "MFloatProperty"); @@ -1600,9 +1593,7 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshIntProperty"); 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_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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshIntProperty", NULL); RNA_def_struct_sdna(srna, "MIntProperty"); @@ -1628,9 +1619,7 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshStringProperty"); 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_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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshStringProperty", NULL); RNA_def_struct_sdna(srna, "MStringProperty"); @@ -1834,7 +1823,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); @@ -1864,26 +1853,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", ""); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 00ac371f929..5259ee1f6d1 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1564,7 +1564,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); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f271673d278..3141369fcd4 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1915,7 +1915,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); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 0b137633349..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); 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..454fd6275d9 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -979,13 +979,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", ""); } @@ -1135,7 +1135,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 +1286,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 +1389,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 ff1cd052913..86f77629ec7 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3480,14 +3480,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 */ @@ -3617,8 +3617,7 @@ 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)"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 3d81ec24d29..a75166c3e99 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1174,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"); @@ -1350,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); @@ -1426,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", ""); -- cgit v1.2.3 From 975c4e717798e71af3d46f06c3e25ae54e11fcca Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Oct 2011 15:54:36 +0000 Subject: fix for msvc, I thought this was only needed for mingw. --- source/blender/python/intern/bpy_rna.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ff2a3dd1303..d367ea92cf4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4706,7 +4706,7 @@ PyTypeObject pyrna_struct_meta_idprop_Type= { NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ NULL, /* struct PyGetSetDef *tp_getset; */ -#ifdef FREE_WINDOWS +#if defined(_MSC_VER) || defined(FREE_WINDOWS) NULL, /* defer assignment */ #else &PyType_Type, /* struct _typeobject *tp_base; */ @@ -5281,7 +5281,7 @@ PyTypeObject pyrna_prop_collection_iter_Type= { NULL, /* reprfunc tp_str; */ /* will only use these if this is a subtype of a py class */ -#ifdef FREE_WINDOWS +#if defined(_MSC_VER) || defined(FREE_WINDOWS) NULL, /* defer assignment */ #else PyObject_GenericGetAttr, /* getattrofunc tp_getattro; */ @@ -5314,7 +5314,7 @@ PyTypeObject pyrna_prop_collection_iter_Type= { #endif /*** Added in release 2.2 ***/ /* Iterators */ -#ifdef FREE_WINDOWS +#if defined(_MSC_VER) || defined(FREE_WINDOWS) NULL, /* defer assignment */ #else PyObject_SelfIter, /* getiterfunc tp_iter; */ @@ -5705,7 +5705,7 @@ void BPY_rna_init(void) #endif /* for some reason MSVC complains of these */ -#ifdef FREE_WINDOWS +#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; -- cgit v1.2.3 From 738491555d4e831186de337800dce4f14c56d252 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Oct 2011 17:51:47 +0000 Subject: BKE material api function: assign_material_id, like assign_material but takes the object data rather then the object. --- source/blender/blenkernel/BKE_material.h | 1 + source/blender/blenkernel/intern/material.c | 42 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'source') 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/intern/material.c b/source/blender/blenkernel/intern/material.c index a25da56d573..6e1303e375e 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -723,6 +723,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; -- cgit v1.2.3 From 9a88524f681d62cee51dfbc3186d59b4b0712a05 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Oct 2011 17:54:33 +0000 Subject: support for object data material assignment in python eg: bpy.context.object.data.materials[0] = bpy.data.materials["SomeMaterial"] --- source/blender/makesrna/RNA_access.h | 2 +- source/blender/makesrna/intern/rna_ID.c | 8 + source/blender/makesrna/intern/rna_access.c | 5 +- source/blender/makesrna/intern/rna_curve.c | 3 +- source/blender/makesrna/intern/rna_internal.h | 3 + .../blender/makesrna/intern/rna_internal_types.h | 2 +- source/blender/makesrna/intern/rna_mesh.c | 1 + source/blender/makesrna/intern/rna_meta.c | 3 +- source/blender/python/intern/bpy_rna.c | 175 +++++++++++++++++++-- 9 files changed, 184 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 6dbc002d505..1e9496fdbbb 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -778,7 +778,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, PointerRNA *assign_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/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 492f51967b2..3f8a310285e 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -314,6 +314,14 @@ static int rna_IDPArray_length(PointerRNA *ptr) return prop->len; } +int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, 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) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index c6a9627aa3c..24e1aa078cf 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1095,6 +1095,9 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop) if(cprop->item_type) return cprop->item_type; } + else { + BLI_assert(0); + } return &RNA_UnknownType; } @@ -2865,7 +2868,7 @@ 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, PointerRNA *assign_ptr) +int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr) { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 28c1a3bc234..edae977f3f6 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -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) diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index cf1be39124e..aab74056ad9 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -382,6 +382,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, 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 87b35459d40..50790a0077f 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -102,7 +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, struct PointerRNA *assign_ptr); +typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); /* Container - generic abstracted container of RNA properties */ typedef struct ContainerRNA { diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 44be5ae8e35..ad4467a6d0b 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1942,6 +1942,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/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index d367ea92cf4..d5a950fc5bb 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1922,6 +1922,21 @@ 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) { @@ -1930,17 +1945,7 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s 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,6 +1968,28 @@ 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; @@ -2173,6 +2200,128 @@ 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) @@ -2409,7 +2558,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 */ @@ -2505,7 +2654,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 */ -- cgit v1.2.3 From 077fd134167d7ee73fb026b5b7dea21d31c0b28c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Oct 2011 19:52:33 +0000 Subject: cmake: - fix for cmake's SSE detection which would fail because of strict warnings and also had redundant cache setting. - was incorrectly initializing variables (own bad) - python was searching for libs on every run, now only do this if there not cached. --- source/blender/blenfont/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index 838a36d9fe2..49323ec658f 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -53,7 +53,7 @@ set(SRC if(WITH_INTERNATIONAL) list(APPEND INC_SYS - ${GETTEXT_INC} + ${GETTEXT_INCLUDE_DIRS} ) add_definitions(-DWITH_INTERNATIONAL) endif() -- cgit v1.2.3 From 91283853b27fd793b3bcaff58af0991288bba437 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Oct 2011 21:09:42 +0000 Subject: fix [#28786] Large enum lists display columns in inverted order (right to left) also cleared annoying intel c++ warnings. --- source/blender/editors/interface/interface_regions.c | 9 ++++++++- source/blender/makesrna/intern/rna_ID.c | 2 +- source/blender/makesrna/intern/rna_internal.h | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index c898ba983c7..d29e5975afb 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2308,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); @@ -2323,6 +2322,14 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut pup->popup= 1; pup->block->flag |= UI_BLOCK_NO_FLIP; } + 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; + } + } if(str) { /* menu is created from a string */ diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 3f8a310285e..ddd0fcc1007 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -314,7 +314,7 @@ static int rna_IDPArray_length(PointerRNA *ptr) return prop->len; } -int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, PointerRNA *assign_ptr) +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; diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index aab74056ad9..4cd4a2f11f9 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -383,7 +383,7 @@ struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct bContext *C, 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, struct PointerRNA *assign_ptr); +int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); #endif /* RNA_INTERNAL_H */ -- cgit v1.2.3 From 90b38eaa0c05754ef8bab20b6bdc906dd506fa6c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 2 Oct 2011 08:46:46 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/editors/object/object_vgroup.c | 41 ++++++++++++++++++--------- source/blender/makesrna/intern/rna_ui.c | 4 +-- 2 files changed, 29 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 49205318fd4..7b4db347315 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -892,7 +892,8 @@ 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) @@ -930,15 +931,17 @@ 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; @@ -1094,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); @@ -2319,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) @@ -2357,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; @@ -2366,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); } @@ -2425,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"); } @@ -2515,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; @@ -2587,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/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 29357362ae2..2c2bc4704bf 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -781,9 +781,9 @@ 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_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); -- cgit v1.2.3 From a1d647e92cd7f51659f0bcb16fb05c1b30177b79 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Oct 2011 12:21:24 +0000 Subject: remove some redundant checks and compiler warnings. --- source/blender/editors/transform/transform.c | 14 ++++++-------- source/blender/python/mathutils/mathutils.c | 11 ++++++----- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c77f7620326..8699bc88645 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2611,8 +2611,8 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { copy_v3_v3(center, td->center); } else if (t->flag & T_EDIT) { - - if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { + + if(t->settings->selectmode & SCE_SELECT_FACE) { copy_v3_v3(center, td->center); } else { @@ -2899,19 +2899,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)) { center = td->center; } - else { - if(around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { - center = td->center; - } + else if (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/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 50b75b09cb2..c6cbb04edd0 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -94,11 +94,12 @@ 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)) + { + printf("siez %d\n", size); if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; } -- cgit v1.2.3 From acac22f3f2c1e1cd0c1df55472a41b68a6b819e5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Oct 2011 12:34:41 +0000 Subject: enable cmake building makesdna with ghash --- source/blender/makesdna/intern/CMakeLists.txt | 2 +- source/blender/python/mathutils/mathutils.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'source') 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/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index c6cbb04edd0..9adeae9dc29 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -99,7 +99,6 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject * (size= QuaternionObject_Check(value) ? 4 : 0) || (size= ColorObject_Check(value) ? 3 : 0)) { - printf("siez %d\n", size); if(BaseMath_ReadCallback((BaseMathObject *)value) == -1) { return -1; } -- cgit v1.2.3 From 6ad5e2ef1f69b4235538051f4702f6faa418fe43 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 2 Oct 2011 12:57:49 +0000 Subject: =?UTF-8?q?Fix=20[#28436]=20ID=20mask=20creates=20'feather'=20arou?= =?UTF-8?q?nd=20ID=20even=20with=20AA=20turned=20off.=20Perhaps=20not=20th?= =?UTF-8?q?e=20ideal=20solution,=20but=20it=20works,=20is=20easy=20to=20un?= =?UTF-8?q?do=20if/when=20we=20have=20a=20better=20one,=20and=20I=E2=80=99?= =?UTF-8?q?m=20pretty=20sure=20it=20won=E2=80=99t=20break=20anything...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/editors/space_node/drawnode.c | 1 + source/blender/makesrna/intern/rna_nodetree.c | 5 +++++ source/blender/nodes/composite/nodes/node_composite_idMask.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 970eccb8be3..219aa3261c7 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, "smooth_mask", 0, NULL, ICON_NONE); } static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 1b113620663..23a71b20c32 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, "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/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); -- cgit v1.2.3 From c664275386b6e2cf202ebfe59fbd14871ea026ac Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 2 Oct 2011 14:41:13 +0000 Subject: * 2.60 release cycle, moving on to bcon4, only bugfixes! --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 0f674995294..f6910fede8e 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -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; -- cgit v1.2.3 From 74c681330f2da09cbc5e409ea4cc61426681c027 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Oct 2011 19:57:34 +0000 Subject: fix [#28788] Scale using "Individual origins" in bones works for rotate and scale --- source/blender/editors/transform/transform.c | 12 +++++++----- source/blender/editors/transform/transform_conversions.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8699bc88645..898785fd120 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2612,7 +2612,9 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { } else if (t->flag & T_EDIT) { - if(t->settings->selectmode & SCE_SELECT_FACE) { + if( (t->settings->selectmode & SCE_SELECT_FACE) || + (t->obedit && t->obedit->type == OB_ARMATURE)) + { copy_v3_v3(center, td->center); } else { @@ -2902,10 +2904,10 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short /* local constraint shouldn't alter center */ if (around == V3D_LOCAL) { - if (t->flag & (T_OBJECT|T_POSE)) { - center = td->center; - } - else if (t->settings->selectmode & SCE_SELECT_FACE) { + if ( (t->flag & (T_OBJECT|T_POSE)) || + (t->settings->selectmode & SCE_SELECT_FACE) || + (t->obedit && t->obedit->type == OB_ARMATURE)) + { center = td->center; } } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index c3a249d69bc..e37435a0cd5 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) -- cgit v1.2.3 From e49688f021dd7d19b46efb54f0cbe21aaf6f45ee Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Oct 2011 20:09:45 +0000 Subject: use use_ prefix for boolean value. --- source/blender/editors/space_node/drawnode.c | 2 +- source/blender/makesrna/intern/rna_nodetree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 219aa3261c7..5f443509801 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1538,7 +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, "smooth_mask", 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) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 23a71b20c32..813375a3549 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1875,7 +1875,7 @@ static void def_cmp_id_mask(StructRNA *srna) 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, "smooth_mask", PROP_BOOLEAN, PROP_NONE); + 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"); -- cgit v1.2.3 From 4a0c3e2a12498c0769eabf9ee1dab30d01fe658d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Oct 2011 21:21:14 +0000 Subject: fix [#28784] CRASHER on load with load_post handler also fix pacman package build spec. --- source/blender/windowmanager/intern/wm_files.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 76ebeaa9f21..bf5b60d691f 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -412,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 */ @@ -429,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"); -- cgit v1.2.3 From e42146c1ec01d8cbaf05d554ef08814901fc666d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Oct 2011 22:28:49 +0000 Subject: remove .Blanguages, its not used anymore --- source/creator/CMakeLists.txt | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 86aebe47edc..d36bd3cd344 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -350,11 +350,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 @@ -427,10 +422,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 @@ -663,11 +654,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 -- cgit v1.2.3 From f87ab2e907823754685bb22d45c62c2734721fa4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 01:01:01 +0000 Subject: minor edit for UI code, pointless short/int mix. --- source/blender/editors/interface/interface.c | 6 +++--- source/blender/editors/interface/interface_handlers.c | 10 +++++----- source/blender/editors/interface/interface_intern.h | 3 ++- source/blender/editors/interface/interface_layout.c | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a3ae39c8440..5ebdf78e611 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2049,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 */ } @@ -2291,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; @@ -2428,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;) { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 929a8bf1dc6..81900b0ba39 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4681,7 +4681,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 +4868,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 +4967,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; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 94eb180bd06..07ff8699b60 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -308,7 +308,8 @@ struct uiBlock { int flag; char direction; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ - short auto_open; + char pad; + char auto_open; double auto_open_last; const char *lockstr; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ab07cb4bbf6..2f10ebf1d73 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -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; -- cgit v1.2.3 From b001eeb10deed53ea763f39de718b3558f5f0326 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 01:36:25 +0000 Subject: Change struct alignment for structs which are intended to be aligned but aren't. remove uiIconImage too since its unused. --- .../blender/editors/interface/interface_intern.h | 30 ++++++++-------------- source/blender/makesrna/RNA_types.h | 8 +++--- source/blender/windowmanager/WM_types.h | 13 ++++++---- 3 files changed, 22 insertions(+), 29 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 07ff8699b60..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,10 +297,12 @@ struct uiBlock { void *drawextra_arg2; int flag; + short alignnr; + char direction; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */ - char pad; char auto_open; + char _pad[7]; double auto_open_last; const char *lockstr; @@ -327,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 { @@ -401,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; 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/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? ************** */ -- cgit v1.2.3 From 275093324feab04bf31f9fb031e594da94de8149 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 02:49:08 +0000 Subject: fix [#28023] VSE: Transform Markers doesn't do anything - renamed to 'Sync Markers' to match action editor. - action editor option was broken in the same way as the sequencer. --- source/blender/editors/transform/transform_conversions.c | 10 +++++----- source/blender/makesrna/intern/rna_space.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index e37435a0cd5..c4295b15858 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4780,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); } } @@ -4892,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); } } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index fa98e07da20..560e2dbcd8e 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1751,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); -- cgit v1.2.3 From 3dd75fa6f17cfe39ab215c5f6712da3da5227d74 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 03:25:05 +0000 Subject: patch [#27887] LOSSLESS RENDERING: HuffYUV and FFV1 both fail to render losslessly from Troy Sobotka (sobotka) --- source/blender/blenkernel/intern/writeffmpeg.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 3cb32f9ad12..6010770e1ee 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -489,6 +489,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 +524,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); -- cgit v1.2.3 From 8e55780aa75da5a8f93a927ab93f605d7c580625 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 3 Oct 2011 03:32:59 +0000 Subject: BGE: removing old hack from Dome code. it's no longer needed and it was making dome to fail if using game autostart (<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(){ -- cgit v1.2.3 From d1c99081ea57a9ef55d51dc08ddb700da5f6bbf8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 03:48:48 +0000 Subject: fix for crash when loading the file selector on startup. --- source/blender/editors/space_file/file_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index fd52c3c4199..c265c4ec1a7 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 && filelist_lib(sfile->files); } void FILE_OT_directory(struct wmOperatorType *ot) -- cgit v1.2.3 From f571d1d238372b668eab88bb491eb48bd1327554 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 04:48:14 +0000 Subject: fix [#27578] Fileselector UI area does not scale with UI (partially hides buttons) --- source/blender/editors/screen/area.c | 3 +++ source/blender/editors/space_file/file_draw.c | 4 ++-- source/blender/editors/space_file/space_file.c | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 041cb9091d9..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; diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index f7abb01546f..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; diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 18270bfaa26..f4adc471f70 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -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); -- cgit v1.2.3 From 354670e6ed5bcb36a02706b3c97078dc8f4d0b8d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Oct 2011 08:01:07 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_armature.c | 32 +++++++++++++------ source/blender/makesrna/intern/rna_cloth.c | 44 +++++++++++++++++---------- 2 files changed, 50 insertions(+), 26 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index c8e5faee7c8..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); @@ -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"); @@ -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_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); -- cgit v1.2.3 From 7fec67ab40cac18aaa44420216603ddc2b623caa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 3 Oct 2011 11:04:05 +0000 Subject: Fix #28780: Undo while painting image sequences issue - Store imbuf file path in UndoImageTile structure, so imbuf can be verified before applying titles on it. - If current image's imbuf file path isn't equal to file path stored in undo block, search for imbuf in ima->ibufs. Probably it can be optimized, but storing all settings which defines needed imbuf (image source type, offset, image file name, current scene frame and so messes up undo code and requires deeper changes which probably better not to start on bcon4). --- source/blender/editors/sculpt_paint/paint_image.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index add269c0877..43969f3c19e 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -356,6 +356,7 @@ 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; @@ -389,7 +390,7 @@ 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) + if(tile->x == x_tile && tile->y == y_tile && strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0) return tile->rect; if (*tmpibuf==NULL) @@ -404,6 +405,8 @@ 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); + undo_copy_tile(tile, *tmpibuf, ibuf, 0); undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize); @@ -433,6 +436,21 @@ static void image_undo_restore(bContext *C, ListBase *lb) ibuf= BKE_image_get_ibuf(ima, NULL); + if(ima && 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= ima->ibufs.first; + while(ibuf) { + if(strcmp(tile->ibufname, ibuf->name)==0) + break; + + ibuf= ibuf->next; + } + } + if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) continue; -- cgit v1.2.3 From 758e34b45d3fd3470e847b972897e6aff50954dd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 12:56:33 +0000 Subject: - use BLI_findstring rather then while loop for listbase lookups - remove BLI_assert I recently added to RNA_property_pointer_type since its intentionally called with no type check. --- source/blender/editors/sculpt_paint/paint_image.c | 16 +++++----------- source/blender/makesrna/intern/rna_access.c | 4 +--- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 43969f3c19e..d556ff9797f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -427,11 +427,11 @@ 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); @@ -442,13 +442,7 @@ static void image_undo_restore(bContext *C, ListBase *lb) full image user (which isn't so obvious, btw) try to find ImBuf with matched file name in list of already loaded images */ - ibuf= ima->ibufs.first; - while(ibuf) { - if(strcmp(tile->ibufname, ibuf->name)==0) - break; - - ibuf= ibuf->next; - } + ibuf= BLI_findstring(&ima->ibufs, tile->ibufname, offsetof(ImBuf, name)); } if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 24e1aa078cf..8047b2df226 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1095,9 +1095,7 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop) if(cprop->item_type) return cprop->item_type; } - else { - BLI_assert(0); - } + /* ignore other types, RNA_struct_find_nested calls with unchecked props */ return &RNA_UnknownType; } -- cgit v1.2.3 From 782499717efa2464b700360ded6193a67a170781 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 3 Oct 2011 13:01:24 +0000 Subject: Fix #27532: Undo test texture after painting gives black blocks. - Do not apply undo tiles on image if source or generated type was changed. - Added null-check in own recent commit in this area. --- source/blender/editors/sculpt_paint/paint_image.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index d556ff9797f..36711d14beb 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -360,6 +360,9 @@ typedef struct UndoImageTile { void *rect; int x, y; + + short source; + char gen_type; } UndoImageTile; static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0}; @@ -390,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 && strcmp(tile->ibufname, ibuf->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); @@ -407,6 +411,9 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int 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); @@ -436,7 +443,7 @@ static void image_undo_restore(bContext *C, ListBase *lb) ibuf= BKE_image_get_ibuf(ima, NULL); - if(ima && strcmp(tile->ibufname, ibuf->name)!=0) { + 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 @@ -448,6 +455,9 @@ static void image_undo_restore(bContext *C, ListBase *lb) 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 */ -- cgit v1.2.3 From e5a11dfcd670f45a467a84b362c7d189cd011fab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 16:20:05 +0000 Subject: fix for [#28788] wasn't complete, pose bones scale was ignoring "Individual origins" setting. --- source/blender/editors/transform/transform.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 898785fd120..73acd1f9000 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2606,29 +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->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); - } - } - 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]; -- cgit v1.2.3 From 75621eeff97d5765ecd3cdea1873d5c40baad0d6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 16:55:00 +0000 Subject: fix [#27526] shared data but different data materials. --- source/blender/editors/space_buttons/buttons_context.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 9d2ac3fd8e2..526859cecd2 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -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->typetotcol) - CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1); + if(ob && ob->type && (ob->typetotcol) { + /* 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; -- cgit v1.2.3 From 3b996ac1b3fcc93b121a9d4ef6024d5638df780f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 17:29:43 +0000 Subject: add macro OB_TYPE_SUPPORT_MATERIAL, type checks were being done inline, some comparing range, some using ELEM#(), once was missing metaball check. --- source/blender/blenkernel/intern/object.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/object/object_relations.c | 6 ++++-- source/blender/editors/render/render_preview.c | 2 +- source/blender/editors/space_buttons/buttons_context.c | 4 ++-- source/blender/editors/space_view3d/view3d_buttons.c | 5 ++++- source/blender/makesdna/DNA_object_types.h | 3 +++ source/blender/render/intern/source/convertblender.c | 4 ++-- 8 files changed, 18 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 5530096f8ea..ce4cc284bb0 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1649,7 +1649,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; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 8ca481655d0..a50dd00ef16 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -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_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/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/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 526859cecd2..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->typetype)) { ma= give_current_material(ob, ob->actcol); RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); path->len++; @@ -721,7 +721,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(ptr) { Object *ob= ptr->data; - if(ob && ob->type && (ob->typetotcol) { + 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; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index e1fb287d79c..0ad36657196 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -895,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); + } } } 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/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index f06707c94fe..0ea0725d05d 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4359,9 +4359,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) -- cgit v1.2.3 From cdc564064c5d7e442b1accf51670b6287c149ff4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 17:59:33 +0000 Subject: revert r40738, flipepd enums give quick access to first items, even if it does seem odd to have them flipped. --- source/blender/editors/interface/interface_regions.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index d29e5975afb..622d50752fa 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2322,6 +2322,10 @@ 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 @@ -2330,6 +2334,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut pup->block->flag |= UI_BLOCK_NO_FLIP; } } +#endif if(str) { /* menu is created from a string */ -- cgit v1.2.3 From 59c0cbbc34869e21bb687eb60506add04e5bf2d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Oct 2011 18:03:44 +0000 Subject: fix for missing null check in own recent commit. --- source/blender/editors/interface/interface_handlers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 81900b0ba39..b4970d5933c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5157,7 +5157,9 @@ void uiContextActivePropertyHandle(bContext *C) * currently this is mainly so reset defaults works for the * operator redo panel - campbell */ uiBlock *block= activebut->block; - block->handle_func(C, block->handle_func_arg, 0); + if (block->handle_func) { + block->handle_func(C, block->handle_func_arg, 0); + } } } -- cgit v1.2.3 From 42bde7eaa1372afac642d3465554b7bc7592ff78 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 4 Oct 2011 07:48:56 +0000 Subject: Minor: Other UI strings typos and tweaks. Also updated french po & mo. --- source/blender/makesrna/intern/rna_fcurve.c | 56 +++++++++++++++++++--------- source/blender/makesrna/intern/rna_mesh.c | 30 ++++++++++----- source/blender/makesrna/intern/rna_texture.c | 10 ++--- 3 files changed, 65 insertions(+), 31 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index a08e030215c..43812ad4a01 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -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_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index ad4467a6d0b..d35b7ad38fb 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); } @@ -1226,7 +1227,8 @@ static void rna_def_mvert(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); 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", NULL, NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_MeshVertex_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 vertex is member of"); @@ -1348,12 +1350,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); @@ -1400,7 +1402,9 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); 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", NULL, NULL, NULL); + 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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshTextureFace", NULL); RNA_def_struct_sdna(srna, "MTFace"); @@ -1512,7 +1516,9 @@ static void rna_def_mcol(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshColor"); 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", NULL, NULL, NULL); + 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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshColor", NULL); RNA_def_struct_sdna(srna, "MCol"); @@ -1567,7 +1573,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshFloatProperty"); 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", NULL, NULL, NULL); + 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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshFloatProperty", NULL); RNA_def_struct_sdna(srna, "MFloatProperty"); @@ -1593,7 +1601,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshIntProperty"); 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", NULL, NULL, NULL); + 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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshIntProperty", NULL); RNA_def_struct_sdna(srna, "MIntProperty"); @@ -1619,7 +1629,9 @@ static void rna_def_mproperties(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "MeshStringProperty"); 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", NULL, NULL, NULL); + 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", NULL, NULL, NULL); srna= RNA_def_struct(brna, "MeshStringProperty", NULL); RNA_def_struct_sdna(srna, "MStringProperty"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 21a426640f2..b5e8acb76e5 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -559,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); @@ -591,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"); } @@ -601,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[] = { -- cgit v1.2.3 From 019dca9c54289136b34c688a048ee009e2e852ee Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Oct 2011 08:28:37 +0000 Subject: remove redundant code, also dont bother with os.path.basename(x) for recent scons commit. --- source/blender/blenkernel/intern/object.c | 7 ++----- source/blender/blenkernel/intern/seqeffects.c | 6 ++---- source/blender/editors/sculpt_paint/paint_image.c | 8 +++----- source/blender/editors/space_view3d/drawobject.c | 2 -- 4 files changed, 7 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ce4cc284bb0..81a31c83e95 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3060,14 +3060,13 @@ 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 aspx, aspy; float facx, facy; float depth; /* aspect correcton */ if (scene) { - aspx= (float) scene->r.xsch*scene->r.xasp; - aspy= (float) scene->r.ysch*scene->r.yasp; + 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; @@ -3079,8 +3078,6 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh } } else { - aspx= 1.0f; - aspy= 1.0f; r_asp[0]= 1.0f; r_asp[1]= 1.0f; } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 70b44792b30..d8d6ed6ea6d 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1639,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; @@ -2320,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); @@ -2490,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/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 36711d14beb..1c53be15a0f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -2690,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; @@ -4900,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) { @@ -4911,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/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 35c3e909d84..b84998e6b83 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5103,8 +5103,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; -- cgit v1.2.3