From cbdc67e2e81cb136a0dca2218dd0ccb6ecc557ca Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Wed, 3 Aug 2011 19:12:18 +0000 Subject: Find all key frames for baked animation export. --- source/blender/collada/AnimationExporter.cpp | 53 ++++++++++++++++++++++++++++ source/blender/collada/AnimationExporter.h | 6 ++++ 2 files changed, 59 insertions(+) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 2f92d9212a9..5a5ec4fea2d 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -61,6 +61,13 @@ void AnimationExporter::exportAnimations(Scene *sce) bool isMatAnim = false; if(ob->adt && ob->adt->action) { + if ( ob->type == OB_ARMATURE ) + { + bArmature *arm = (bArmature*)ob->data; + for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) + bake_bone_animation(ob, bone); + + } fcu = (FCurve*)ob->adt->action->curves.first; while (fcu) { transformName = extract_transform_name( fcu->rna_path ); @@ -318,6 +325,17 @@ void AnimationExporter::exportAnimations(Scene *sce) closeAnimation(); } + void AnimationExporter::bake_bone_animation(Object *ob_arm, Bone *bone) + { + if (!ob_arm->adt) + return; + + sample_and_bake_bone_animation(ob_arm, bone); + + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) + bake_bone_animation(ob_arm, child); + } + void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone) { if (!ob_arm->adt) @@ -334,6 +352,22 @@ void AnimationExporter::exportAnimations(Scene *sce) write_bone_animation(ob_arm, child); } + void AnimationExporter::sample_and_bake_bone_animation(Object *ob_arm, Bone *bone) + { + bArmature *arm = (bArmature*)ob_arm->data; + int flag = arm->flag; + std::vector fra; + char prefix[256]; + + BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name); + + bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + if (!pchan) + return; + + find_all_frames(ob_arm, fra); + } + void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) { bArmature *arm = (bArmature*)ob_arm->data; @@ -920,6 +954,25 @@ void AnimationExporter::exportAnimations(Scene *sce) return dot ? (dot + 1) : rna_path; } + void AnimationExporter::find_all_frames(Object *ob, std::vector &fra) + { + FCurve *fcu= (FCurve*)ob->adt->action->curves.first; + std::vector keys; + for (unsigned int i = 0; i < fcu->totvert; i++) { + float f = fcu->bezt[i].vec[1][0]; // + if (std::find(keys.begin(), keys.end(), f) == keys.end()) + keys.push_back(f); + } + + std::sort(keys.begin(), keys.end()); + + for ( float fAll = *(keys.begin()) ; fAll != *(keys.end()) ; fAll+=1.0f ) + { + fra.push_back(fAll); + } + return; + + } void AnimationExporter::find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name) { FCurve *fcu= (FCurve*)ob->adt->action->curves.first; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 3e3150cd8ef..388d7dbb24d 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -96,10 +96,14 @@ protected: void dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material *ma = NULL); + void bake_bone_animation(Object *ob_arm, Bone *bone); + void write_bone_animation(Object *ob_arm, Bone *bone); void sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type); + void sample_and_bake_bone_animation(Object *ob_arm, Bone *bone); + void sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan); // dae_bone_animation -> add_bone_animation @@ -134,6 +138,8 @@ protected: std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); void find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name); + + void find_all_frames(Object *ob, std::vector &fra); void find_rotation_frames(Object *ob, std::vector &fra, const char *prefix, int rotmode); -- cgit v1.2.3 From c284725a1a69be3f9a80d88e17be922e6ce63f72 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Thu, 4 Aug 2011 07:12:03 +0000 Subject: 3D Audio GSoC: * versioning stuff for btheme->tv3d.speaker * separating object.c speaker functions in own source file Thanks Brecht for the suggestions. --- source/blender/blenkernel/BKE_object.h | 5 - source/blender/blenkernel/BKE_speaker.h | 43 +++++++ source/blender/blenkernel/CMakeLists.txt | 2 + source/blender/blenkernel/intern/library.c | 1 + source/blender/blenkernel/intern/object.c | 95 +--------------- source/blender/blenkernel/intern/speaker.c | 139 +++++++++++++++++++++++ source/blender/editors/interface/resources.c | 7 ++ source/blender/editors/object/object_add.c | 1 + source/blender/editors/object/object_relations.c | 1 + source/blender/makesrna/intern/rna_main_api.c | 1 + 10 files changed, 196 insertions(+), 99 deletions(-) create mode 100644 source/blender/blenkernel/BKE_speaker.h create mode 100644 source/blender/blenkernel/intern/speaker.c (limited to 'source') diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index f9e01a524ab..a6b5c04b5c3 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -88,11 +88,6 @@ void make_local_lamp(struct Lamp *la); void free_camera(struct Camera *ca); void free_lamp(struct Lamp *la); -void *add_speaker(const char *name); -struct Speaker *copy_speaker(struct Speaker *spk); -void make_local_speaker(struct Speaker *spk); -void free_speaker(struct Speaker *spk); - struct Object *add_only_object(int type, const char *name); struct Object *add_object(struct Scene *scene, int type); diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h new file mode 100644 index 00000000000..111bd86fdd3 --- /dev/null +++ b/source/blender/blenkernel/BKE_speaker.h @@ -0,0 +1,43 @@ +/* + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Jörg Müller. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BKE_SPEAKER_H +#define BKE_SPEAKER_H + +/** \file BKE_speaker.h + * \ingroup bke + * \brief General operations for speakers. + */ + +void *add_speaker(const char *name); +struct Speaker *copy_speaker(struct Speaker *spk); +void make_local_speaker(struct Speaker *spk); +void free_speaker(struct Speaker *spk); + +#endif diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index defcef58463..c1797427cc2 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -140,6 +140,7 @@ set(SRC intern/smoke.c intern/softbody.c intern/sound.c + intern/speaker.c intern/subsurf_ccg.c intern/suggestions.c intern/text.c @@ -220,6 +221,7 @@ set(SRC BKE_smoke.h BKE_softbody.h BKE_sound.h + BKE_speaker.h BKE_subsurf.h BKE_suggestions.h BKE_text.h diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 85f87992c28..8668168936b 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -109,6 +109,7 @@ #include "BKE_particle.h" #include "BKE_gpencil.h" #include "BKE_fcurve.h" +#include "BKE_speaker.h" #include "RNA_access.h" diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 66bf4ea208b..a615bc42f66 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -56,7 +56,6 @@ #include "DNA_sequence_types.h" #include "DNA_sound_types.h" #include "DNA_space_types.h" -#include "DNA_speaker_types.h" #include "DNA_view3d_types.h" #include "DNA_world_types.h" @@ -98,6 +97,7 @@ #include "BKE_sca.h" #include "BKE_scene.h" #include "BKE_sequencer.h" +#include "BKE_speaker.h" #include "BKE_softbody.h" #include "BKE_material.h" @@ -977,99 +977,6 @@ void free_lamp(Lamp *la) la->id.icon_id = 0; } -void *add_speaker(const char *name) -{ - Speaker *spk; - - spk= alloc_libblock(&G.main->speaker, ID_SPK, name); - - spk->attenuation = 1.0f; - spk->cone_angle_inner = 360.0f; - spk->cone_angle_outer = 360.0f; - spk->cone_volume_outer = 1.0f; - spk->distance_max = FLT_MAX; - spk->distance_reference = 1.0f; - spk->flag = 0; - spk->pitch = 1.0f; - spk->sound = NULL; - spk->volume = 1.0f; - spk->volume_max = 1.0f; - spk->volume_min = 0.0f; - - return spk; -} - -Speaker *copy_speaker(Speaker *spk) -{ - Speaker *spkn; - - spkn= copy_libblock(spk); - if(spkn->sound) - spkn->sound->id.us++; - - return spkn; -} - -void make_local_speaker(Speaker *spk) -{ - Main *bmain= G.main; - Object *ob; - int local=0, lib=0; - - /* - only lib users: do nothing - * - only local users: set flag - * - mixed: make copy - */ - - if(spk->id.lib==NULL) return; - if(spk->id.us==1) { - spk->id.lib= NULL; - spk->id.flag= LIB_LOCAL; - new_id(&bmain->speaker, (ID *)spk, NULL); - return; - } - - ob= bmain->object.first; - while(ob) { - if(ob->data==spk) { - if(ob->id.lib) lib= 1; - else local= 1; - } - ob= ob->id.next; - } - - if(local && lib==0) { - spk->id.lib= NULL; - spk->id.flag= LIB_LOCAL; - new_id(&bmain->speaker, (ID *)spk, NULL); - } - else if(local && lib) { - Speaker *spkn= copy_speaker(spk); - spkn->id.us= 0; - - ob= bmain->object.first; - while(ob) { - if(ob->data==spk) { - - if(ob->id.lib==NULL) { - ob->data= spkn; - spkn->id.us++; - spk->id.us--; - } - } - ob= ob->id.next; - } - } -} - -void free_speaker(Speaker *spk) -{ - if(spk->sound) - spk->sound->id.us--; - - BKE_free_animdata((ID *)spk); -} - /* *************************************************** */ static void *add_obdata_from_type(int type) diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c new file mode 100644 index 00000000000..200dbd41899 --- /dev/null +++ b/source/blender/blenkernel/intern/speaker.c @@ -0,0 +1,139 @@ +/* speaker.c + * + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Jörg Müller. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/blenkernel/intern/speaker.c + * \ingroup bke + */ + +#include "DNA_object_types.h" +#include "DNA_sound_types.h" +#include "DNA_speaker_types.h" + +#include "BLI_math.h" + +#include "BKE_animsys.h" +#include "BKE_global.h" +#include "BKE_library.h" +#include "BKE_main.h" +#include "BKE_speaker.h" + +void *add_speaker(const char *name) +{ + Speaker *spk; + + spk= alloc_libblock(&G.main->speaker, ID_SPK, name); + + spk->attenuation = 1.0f; + spk->cone_angle_inner = 360.0f; + spk->cone_angle_outer = 360.0f; + spk->cone_volume_outer = 1.0f; + spk->distance_max = FLT_MAX; + spk->distance_reference = 1.0f; + spk->flag = 0; + spk->pitch = 1.0f; + spk->sound = NULL; + spk->volume = 1.0f; + spk->volume_max = 1.0f; + spk->volume_min = 0.0f; + + return spk; +} + +Speaker *copy_speaker(Speaker *spk) +{ + Speaker *spkn; + + spkn= copy_libblock(spk); + if(spkn->sound) + spkn->sound->id.us++; + + return spkn; +} + +void make_local_speaker(Speaker *spk) +{ + Main *bmain= G.main; + Object *ob; + int local=0, lib=0; + + /* - only lib users: do nothing + * - only local users: set flag + * - mixed: make copy + */ + + if(spk->id.lib==NULL) return; + if(spk->id.us==1) { + spk->id.lib= NULL; + spk->id.flag= LIB_LOCAL; + new_id(&bmain->speaker, (ID *)spk, NULL); + return; + } + + ob= bmain->object.first; + while(ob) { + if(ob->data==spk) { + if(ob->id.lib) lib= 1; + else local= 1; + } + ob= ob->id.next; + } + + if(local && lib==0) { + spk->id.lib= NULL; + spk->id.flag= LIB_LOCAL; + new_id(&bmain->speaker, (ID *)spk, NULL); + } + else if(local && lib) { + Speaker *spkn= copy_speaker(spk); + spkn->id.us= 0; + + ob= bmain->object.first; + while(ob) { + if(ob->data==spk) { + + if(ob->id.lib==NULL) { + ob->data= spkn; + spkn->id.us++; + spk->id.us--; + } + } + ob= ob->id.next; + } + } +} + +void free_speaker(Speaker *spk) +{ + if(spk->sound) + spk->sound->id.us--; + + BKE_free_animdata((ID *)spk); +} diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index adabfe5f230..dd63cdf5861 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1594,6 +1594,13 @@ void init_userdef_do_versions(void) NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE; } + { + bTheme *btheme; + for(btheme= U.themes.first; btheme; btheme= btheme->next) { + btheme->tv3d.speaker[3] = 255; + } + } + /* funny name, but it is GE stuff, moves userdef stuff to engine */ // XXX space_set_commmandline_options(); /* this timer uses U */ diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 97a98d2017f..22e6a5243c7 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -73,6 +73,7 @@ #include "BKE_particle.h" #include "BKE_report.h" #include "BKE_sca.h" +#include "BKE_speaker.h" #include "BKE_texture.h" #include "RNA_access.h" diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index ce1f47c1b7b..39300cabd5e 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -76,6 +76,7 @@ #include "BKE_report.h" #include "BKE_sca.h" #include "BKE_scene.h" +#include "BKE_speaker.h" #include "BKE_texture.h" #include "WM_api.h" diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 7b951294aee..e99958c2217 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -63,6 +63,7 @@ #include "BKE_particle.h" #include "BKE_font.h" #include "BKE_node.h" +#include "BKE_speaker.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" -- cgit v1.2.3 From 2ed11158db7cfc157c26475a2dcb5f513043cd72 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 4 Aug 2011 14:06:30 +0000 Subject: Bugfix: Setting of new default settings for new Graph Editors was done in wrong place, leading to loss of settings everytime the view changed (i.e. after open/saving) --- source/blender/editors/space_graph/space_graph.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index fea9e5d71e8..3cc83b12124 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -110,6 +110,10 @@ static SpaceLink *graph_new(const bContext *C) sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet"); sipo->ads->source= (ID *)scene; + /* settings for making it easier by default to just see what you're interested in tweaking */ + sipo->ads->filterflag |= ADS_FILTER_ONLYSEL; + sipo->flag |= SIPO_SELVHANDLESONLY; + /* header */ ar= MEM_callocN(sizeof(ARegion), "header for graphedit"); @@ -187,10 +191,6 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) sipo->ads->source= (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now... } - /* settings for making it easier by default to just see what you're interested in tweaking */ - sipo->ads->filterflag |= ADS_FILTER_ONLYSEL; - sipo->flag |= SIPO_SELVHANDLESONLY; - ED_area_tag_refresh(sa); } -- cgit v1.2.3 From 900928f8bf47b8f1bbb1b2cd863d2d9649c940a0 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 4 Aug 2011 14:13:05 +0000 Subject: Bassam Feature Request: "Auto Clamped" handles can now be set per handle/key This used to be a weird per-curve setting which would happen to get applied/work correctly if handles were set to "auto", and was a source of constant confusion for both old and new animators. The main effect of this handle-type/option was really to just ensure that auto-handles stayed horizontal, instead of tilting as the keys were moved. This commit simply changes this from a per-curve to per keyframe/handle setting. --- source/blender/blenkernel/intern/curve.c | 10 ++--- source/blender/blenkernel/intern/fcurve.c | 11 ++---- source/blender/blenkernel/intern/ipo.c | 13 ++++++- source/blender/blenkernel/intern/nla.c | 4 +- source/blender/blenloader/intern/readfile.c | 32 ++++++++++++++++ source/blender/editors/animation/drivers.c | 6 +-- source/blender/editors/animation/keyframes_edit.c | 46 ++++++++++++++--------- source/blender/editors/animation/keyframing.c | 2 +- source/blender/editors/include/UI_resources.h | 2 + source/blender/editors/interface/resources.c | 23 +++++++++++- source/blender/editors/space_action/action_edit.c | 19 +--------- source/blender/editors/space_graph/graph_edit.c | 19 +--------- source/blender/makesdna/DNA_anim_types.h | 2 + source/blender/makesdna/DNA_curve_types.h | 2 +- source/blender/makesdna/DNA_userdef_types.h | 7 +++- source/blender/makesrna/RNA_enum_types.h | 1 + source/blender/makesrna/intern/rna_curve.c | 8 ++++ source/blender/makesrna/intern/rna_fcurve.c | 9 +---- source/blender/makesrna/intern/rna_userdef.c | 17 ++++++++- 19 files changed, 147 insertions(+), 86 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index eb364af6ff8..2f1a85c57b3 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2473,7 +2473,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) if(len2==0.0f) len2=1.0f; - if(bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) { /* auto */ + 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; @@ -2484,13 +2484,13 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) if(len1>5.0f*len2) len1= 5.0f*len2; if(len2>5.0f*len1) len2= 5.0f*len1; - if(bezt->h1==HD_AUTO) { + 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; - if(mode==2 && 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) ) { @@ -2512,13 +2512,13 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) } } } - if(bezt->h2==HD_AUTO) { + 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; - if(mode==2 && 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) ) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index aa8f817ae3c..28f17b3cf86 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -792,13 +792,10 @@ void calchandles_fcurve (FCurve *fcu) if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0]; /* calculate auto-handles */ - if (fcu->flag & FCURVE_AUTO_HANDLES) - calchandleNurb(bezt, prev, next, 2); /* 2==special autohandle && keep extrema horizontal */ - else - calchandleNurb(bezt, prev, next, 1); /* 1==special autohandle */ + calchandleNurb(bezt, prev, next, 1); /* 1==special autohandle */ /* for automatic ease in and out */ - if ((bezt->h1==HD_AUTO) && (bezt->h2==HD_AUTO)) { + if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) && ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) { /* only do this on first or last beztriple */ if ((a == 0) || (a == fcu->totvert-1)) { /* set both handles to have same horizontal value as keyframe */ @@ -846,9 +843,9 @@ void testhandles_fcurve (FCurve *fcu) /* one or two handles selected only */ if (ELEM(flag, 0, 7)==0) { /* auto handles become aligned */ - if (bezt->h1==HD_AUTO) + if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) bezt->h1= HD_ALIGN; - if (bezt->h2==HD_AUTO) + if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) bezt->h2= HD_ALIGN; /* vector handles become 'free' when only one half selected */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 104ce2b3b32..d41a3a36b2d 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1157,7 +1157,6 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * if (icu->flag & IPO_ACTIVE) fcu->flag |= FCURVE_ACTIVE; if (icu->flag & IPO_MUTE) fcu->flag |= FCURVE_MUTED; if (icu->flag & IPO_PROTECT) fcu->flag |= FCURVE_PROTECTED; - if (icu->flag & IPO_AUTO_HORIZ) fcu->flag |= FCURVE_AUTO_HANDLES; /* set extrapolation */ switch (icu->extrap) { @@ -1242,6 +1241,12 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * /* 'hide' flag is now used for keytype - only 'keyframes' existed before */ dst->hide= BEZT_KEYTYPE_KEYFRAME; + /* auto-handles - per curve to per handle */ + if (icu->flag & IPO_AUTO_HORIZ) { + if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM; + if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM; + } + /* correct values, by checking if the flag of interest is set */ if ( ((int)(dst->vec[1][1])) & (abp->bit) ) dst->vec[0][1]= dst->vec[1][1]= dst->vec[2][1] = 1.0f; @@ -1292,6 +1297,12 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * /* 'hide' flag is now used for keytype - only 'keyframes' existed before */ dst->hide= BEZT_KEYTYPE_KEYFRAME; + + /* auto-handles - per curve to per handle */ + if (icu->flag & IPO_AUTO_HORIZ) { + if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM; + if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM; + } /* correct values for euler rotation curves * - they were degrees/10 diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 8391e9f6ab1..f2ce8e4e6f1 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1185,7 +1185,7 @@ void BKE_nlastrip_validate_fcurves (NlaStrip *strip) BLI_addtail(&strip->fcurves, fcu); /* set default flags */ - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); + fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED); /* store path - make copy, and store that */ fcu->rna_path= BLI_strdupn("influence", 9); @@ -1206,7 +1206,7 @@ void BKE_nlastrip_validate_fcurves (NlaStrip *strip) BLI_addtail(&strip->fcurves, fcu); /* set default flags */ - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); + fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED); /* store path - make copy, and store that */ fcu->rna_path= BLI_strdupn("strip_time", 10); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1737b44a56f..435ae62123a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11799,6 +11799,38 @@ static void do_versions(FileData *fd, Library *lib, Main *main) SEQ_END } } + { + /* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve + * + * We're only patching F-Curves in Actions here, since it is assumed that most + * drivers out there won't be using this (and if they are, they're in the minority). + * While we should aim to fix everything ideally, in practice it's far too hard + * to get to every animdata block, not to mention the performance hit that'd have + */ + bAction *act; + FCurve *fcu; + + for (act = main->action.first; act; act = act->id.next) { + for (fcu = act->curves.first; fcu; fcu = fcu->next) { + BezTriple *bezt; + unsigned int i = 0; + + /* only need to touch curves that had this flag set */ + if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0) + continue; + if ((fcu->totvert == 0) || (fcu->bezt == NULL)) + continue; + + /* only change auto-handles to auto-clamped */ + for (bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { + if (bezt->h1 == HD_AUTO) bezt->h1 = HD_AUTO_ANIM; + if (bezt->h2 == HD_AUTO) bezt->h2 = HD_AUTO_ANIM; + } + + fcu->flag &= ~FCURVE_AUTO_HANDLES; + } + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index c9e422baa3e..3df65a942da 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -108,7 +108,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind /* use default settings to make a F-Curve */ fcu= MEM_callocN(sizeof(FCurve), "FCurve"); - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); + fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED); /* store path - make copy, and store that */ fcu->rna_path= BLI_strdupn(rna_path, strlen(rna_path)); @@ -386,10 +386,6 @@ short ANIM_paste_driver (ReportList *reports, ID *id, const char rna_path[], int copy_fmodifiers(&fcu->modifiers, &channeldriver_copypaste_buf->modifiers); /* flags - on a per-relevant-flag basis */ - if (channeldriver_copypaste_buf->flag & FCURVE_AUTO_HANDLES) - fcu->flag |= FCURVE_AUTO_HANDLES; - else - fcu->flag &= ~FCURVE_AUTO_HANDLES; /* extrapolation mode */ fcu->extend= channeldriver_copypaste_buf->extend; diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 9f3d40a5709..ae9107ebe5a 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -756,20 +756,37 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type) /* ******************************************* */ /* Settings */ +/* standard validation step for a few of these (implemented as macro for inlining without fn-call overhead): + * "if the handles are not of the same type, set them to type free" + */ +#define ENSURE_HANDLES_MATCH(bezt) \ + if (bezt->h1 != bezt->h2) { \ + if ELEM3(bezt->h1, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM) bezt->h1= HD_FREE; \ + if ELEM3(bezt->h2, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM) bezt->h2= HD_FREE; \ + } + /* Sets the selected bezier handles to type 'auto' */ static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { - if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { - if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; /* the secret code for auto */ + if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; if (bezt->f3 & SELECT) bezt->h2= HD_AUTO; - /* if the handles are not of the same type, set them - * to type free - */ - if (bezt->h1 != bezt->h2) { - if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE; - if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE; - } + ENSURE_HANDLES_MATCH(bezt); + } + return 0; +} + +/* Sets the selected bezier handles to type 'auto-clamped' + * NOTE: this is like auto above, but they're handled a bit different + */ +static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *bezt) +{ + if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + if (bezt->f1 & SELECT) bezt->h1= HD_AUTO_ANIM; + if (bezt->f3 & SELECT) bezt->h2= HD_AUTO_ANIM; + + ENSURE_HANDLES_MATCH(bezt); } return 0; } @@ -781,13 +798,7 @@ static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt) if (bezt->f1 & SELECT) bezt->h1= HD_VECT; if (bezt->f3 & SELECT) bezt->h2= HD_VECT; - /* if the handles are not of the same type, set them - * to type free - */ - if (bezt->h1 != bezt->h2) { - if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE; - if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE; - } + ENSURE_HANDLES_MATCH(bezt); } return 0; } @@ -824,8 +835,9 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code) { switch (code) { case HD_AUTO: /* auto */ - case HD_AUTO_ANIM: /* auto clamped */ return set_bezier_auto; + case HD_AUTO_ANIM: /* auto clamped */ + return set_bezier_auto_clamped; case HD_VECT: /* vector */ return set_bezier_vector; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 109da669ce6..fbedb466f7e 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -174,7 +174,7 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[], /* use default settings to make a F-Curve */ fcu= MEM_callocN(sizeof(FCurve), "FCurve"); - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); + fcu->flag = (FCURVE_VISIBLE|FCURVE_SELECTED); if (act->curves.first==NULL) fcu->flag |= FCURVE_ACTIVE; /* first one added active */ diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 2bc2aac165f..ff9a1f539a1 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -183,10 +183,12 @@ enum { TH_HANDLE_AUTO, TH_HANDLE_VECT, TH_HANDLE_ALIGN, + TH_HANDLE_AUTOCLAMP, TH_HANDLE_SEL_FREE, TH_HANDLE_SEL_AUTO, TH_HANDLE_SEL_VECT, TH_HANDLE_SEL_ALIGN, + TH_HANDLE_SEL_AUTOCLAMP, TH_ACTIVE_SPLINE, TH_LASTSEL_POINT, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index dd63cdf5861..00c92b85ee7 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -328,6 +328,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp= ts->handle_free; break; case TH_HANDLE_AUTO: cp= ts->handle_auto; break; + case TH_HANDLE_AUTOCLAMP: + cp= ts->handle_auto_clamped; break; case TH_HANDLE_VECT: cp= ts->handle_vect; break; case TH_HANDLE_ALIGN: @@ -336,11 +338,13 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp= ts->handle_sel_free; break; case TH_HANDLE_SEL_AUTO: cp= ts->handle_sel_auto; break; + case TH_HANDLE_SEL_AUTOCLAMP: + cp= ts->handle_sel_auto_clamped; break; case TH_HANDLE_SEL_VECT: cp= ts->handle_sel_vect; break; case TH_HANDLE_SEL_ALIGN: cp= ts->handle_sel_align; break; - + case TH_SYNTAX_B: cp= ts->syntaxb; break; case TH_SYNTAX_V: @@ -667,6 +671,8 @@ void ui_theme_init_default(void) SETCOL(btheme->tipo.handle_vertex, 0, 0, 0, 255); SETCOL(btheme->tipo.handle_vertex_select, 255, 133, 0, 255); + SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255); + SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255); btheme->tipo.handle_vertex_size= 4; SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255); @@ -1557,6 +1563,21 @@ void init_userdef_do_versions(void) U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET; } + if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) { + bTheme *btheme; + + /* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead */ + if (U.keyhandles_new == HD_AUTO) + U.keyhandles_new = HD_AUTO_ANIM; + + /* theme color additions */ + for (btheme= U.themes.first; btheme; btheme= btheme->next) { + /* auto-clamped handles -> based on auto */ + SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255); + SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255); + } + } + /* GL Texture Garbage Collection (variable abused above!) */ if (U.textimeout == 0) { U.texcollectrate = 60; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 40d73a59a42..5276e62b9eb 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -1103,17 +1103,6 @@ void ACTION_OT_interpolation_type (wmOperatorType *ot) /* ******************** Set Handle-Type Operator *********************** */ -static EnumPropertyItem actkeys_handle_type_items[] = { - {HD_FREE, "FREE", 0, "Free", ""}, - {HD_VECT, "VECTOR", 0, "Vector", ""}, - {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, - {0, "", 0, "", ""}, - {HD_AUTO, "AUTO", 0, "Auto", "Handles that are automatically adjusted upon moving the keyframe"}, - {HD_AUTO_ANIM, "ANIM_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot"}, - {0, NULL, 0, NULL, NULL}}; - -/* ------------------- */ - /* this function is responsible for setting handle-type of selected keyframes */ static void sethandles_action_keys(bAnimContext *ac, short mode) { @@ -1136,12 +1125,6 @@ static void sethandles_action_keys(bAnimContext *ac, short mode) /* any selected keyframes for editing? */ if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) { - /* for auto/auto-clamped, toggle the auto-handles flag on the F-Curve */ - if (mode == HD_AUTO_ANIM) - fcu->flag |= FCURVE_AUTO_HANDLES; - else if (mode == HD_AUTO) - fcu->flag &= ~FCURVE_AUTO_HANDLES; - /* change type of selected handles */ ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, calchandles_fcurve); } @@ -1195,7 +1178,7 @@ void ACTION_OT_handle_type (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* id-props */ - ot->prop= RNA_def_enum(ot->srna, "type", actkeys_handle_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", ""); } /* ******************** Set Keyframe-Type Operator *********************** */ diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index d88a18ffcbc..900aa6f6197 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1447,8 +1447,6 @@ void GRAPH_OT_interpolation_type (wmOperatorType *ot) /* ******************** Set Handle-Type Operator *********************** */ -/* ------------------- */ - /* this function is responsible for setting handle-type of selected keyframes */ static void sethandles_graph_keys(bAnimContext *ac, short mode) { @@ -1471,12 +1469,6 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode) /* any selected keyframes for editing? */ if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) { - /* for auto/auto-clamped, toggle the auto-handles flag on the F-Curve */ - if (mode == HD_AUTO_ANIM) - fcu->flag |= FCURVE_AUTO_HANDLES; - else if (mode == HD_AUTO) - fcu->flag &= ~FCURVE_AUTO_HANDLES; - /* change type of selected handles */ ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, calchandles_fcurve); } @@ -1513,15 +1505,6 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op) void GRAPH_OT_handle_type (wmOperatorType *ot) { - /* sync with editcurve_handle_type_items */ - static EnumPropertyItem graphkeys_handle_type_items[] = { - {HD_AUTO, "AUTO", 0, "Automatic", "Handles that are automatically adjusted upon moving the keyframe. Whole curve"}, - {HD_VECT, "VECTOR", 0, "Vector", ""}, - {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, - {HD_FREE, "FREE_ALIGN", 0, "Free", ""}, - {HD_AUTO_ANIM, "ANIM_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot. Whole curve"}, - {0, NULL, 0, NULL, NULL}}; - /* identifiers */ ot->name= "Set Keyframe Handle Type"; ot->idname= "GRAPH_OT_handle_type"; @@ -1536,7 +1519,7 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* id-props */ - ot->prop= RNA_def_enum(ot->srna, "type", graphkeys_handle_type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", ""); } /* ************************************************************************** */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 00a9786fc6f..374799ecf08 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -473,7 +473,9 @@ typedef enum eFCurve_Flags { FCURVE_PROTECTED = (1<<3), /* fcurve will not be evaluated for the next round */ FCURVE_MUTED = (1<<4), + /* fcurve uses 'auto-handles', which stay horizontal... */ + // DEPRECATED FCURVE_AUTO_HANDLES = (1<<5), /* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */ diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index b51612037fc..a38b33e6640 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -314,7 +314,7 @@ typedef enum eBezTriple_Handle { HD_AUTO, HD_VECT, HD_ALIGN, - HD_AUTO_ANIM /* not real handle type, but is just used as dummy item for anim code */ + HD_AUTO_ANIM /* auto-clamped handles for animation */ } eBezTriple_Handle; /* interpolation modes (used only for BezTriple->ipo) */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 85a64e02ddb..e5558c1738b 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -210,10 +210,13 @@ typedef struct ThemeSpace { char bone_solid[4], bone_pose[4]; char strip[4], strip_select[4]; char cframe[4]; + char nurb_uline[4], nurb_vline[4]; char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4], lastsel_point[4]; - char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4]; - char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4]; + + char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4], handle_auto_clamped[4]; + char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], handle_sel_auto_clamped[4]; + char ds_channel[4], ds_subchannel[4]; // dopesheet char console_output[4], console_input[4], console_info[4], console_error[4]; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 56eb20f01b2..d09d1359ce8 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -58,6 +58,7 @@ extern EnumPropertyItem image_type_items[]; extern EnumPropertyItem beztriple_keyframe_type_items[]; extern EnumPropertyItem beztriple_handle_type_items[]; extern EnumPropertyItem beztriple_interpolation_mode_items[]; +extern EnumPropertyItem keyframe_handle_type_items[]; extern EnumPropertyItem keyingset_path_grouping_items[]; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 260d483b9d2..4e7fceed7e1 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -51,6 +51,14 @@ EnumPropertyItem beztriple_handle_type_items[] = { {HD_VECT, "VECTOR", 0, "Vector", ""}, {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, {0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem keyframe_handle_type_items[] = { + {HD_FREE, "FREE", 0, "Free", ""}, + {HD_AUTO, "AUTO", 0, "Auto", ""}, + {HD_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot"}, + {HD_VECT, "VECTOR", 0, "Vector", ""}, + {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, + {0, NULL, 0, NULL, NULL}}; EnumPropertyItem beztriple_interpolation_mode_items[] = { {BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""}, diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index cd85e100521..2f37a6921d1 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1336,13 +1336,13 @@ static void rna_def_fkeyframe(BlenderRNA *brna) /* Enums */ prop= RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "h1"); - RNA_def_property_enum_items(prop, beztriple_handle_type_items); + RNA_def_property_enum_items(prop, keyframe_handle_type_items); RNA_def_property_ui_text(prop, "Left Handle Type", "Handle types"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); prop= RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "h2"); - RNA_def_property_enum_items(prop, beztriple_handle_type_items); + RNA_def_property_enum_items(prop, keyframe_handle_type_items); RNA_def_property_ui_text(prop, "Right Handle Type", "Handle types"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); @@ -1541,11 +1541,6 @@ static void rna_def_fcurve(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Muted", "F-Curve is not evaluated"); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); - prop= RNA_def_property(srna, "use_auto_handle_clamp", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_AUTO_HANDLES); - RNA_def_property_ui_text(prop, "Auto Clamped Handles", "All auto-handles for F-Curve are clamped"); - RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); - prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_VISIBLE); RNA_def_property_ui_text(prop, "Hide", "F-Curve and its keyframes are hidden in the Graph Editor graphs"); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 64cd7dc646f..7cafc39d0ff 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -878,6 +878,21 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurb RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Align handle selected color", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + if (incl_nurbs == 0) { + /* assume that when nurbs are off, this is for 2D (i.e. anim) editors */ + prop= RNA_def_property(srna, "handle_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "handle_auto_clamped"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Auto-Clamped handle color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "handle_sel_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto_clamped"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Auto-Clamped handle selected color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + } prop= RNA_def_property(srna, "lastsel_point", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "lastsel_point"); @@ -2254,7 +2269,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "New Interpolation Type", ""); prop= RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, beztriple_handle_type_items); + RNA_def_property_enum_items(prop, keyframe_handle_type_items); RNA_def_property_enum_sdna(prop, NULL, "keyhandles_new"); RNA_def_property_ui_text(prop, "New Handles Type", ""); -- cgit v1.2.3 From e9bd246e3bb71403690364ffb4b58d2cdd7e3998 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 4 Aug 2011 14:19:35 +0000 Subject: Clarifying tooltips on userpref keyframing options These probably still need a good review (based on discussions I've had with animators), but this should be a good stop-gap measure in the mean time --- source/blender/makesrna/intern/rna_userdef.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7cafc39d0ff..879ff3f3090 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2238,13 +2238,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna) /* 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"); + 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"); + 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); @@ -2266,12 +2266,12 @@ static void rna_def_userdef_edit(BlenderRNA *brna) 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", ""); + 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); RNA_def_property_enum_sdna(prop, NULL, "keyhandles_new"); - RNA_def_property_ui_text(prop, "New Handles Type", ""); + RNA_def_property_ui_text(prop, "New Handles Type", "Handle type for handles of new keyframes"); /* frame numbers */ prop= RNA_def_property(srna, "use_negative_frames", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3 From 74b94dcdf64000c7d681530bf8c833196c58f17d Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 5 Aug 2011 01:21:08 +0000 Subject: BGE Animations: Moving the do_versions code for the actuators back into the "put compatibility code here until next subversion bump" block. It got sucked into the 2.58.1 block during a merge sometime. --- source/blender/blenloader/intern/readfile.c | 77 ++++++++++++++--------------- 1 file changed, 38 insertions(+), 39 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 435ae62123a..e22f5dcb3de 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11733,45 +11733,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - - { - /* convert fcurve and shape action actuators to action actuators */ - Object *ob; - bActuator *act; - bIpoActuator *ia; - bActionActuator *aa; - - for (ob= main->object.first; ob; ob= ob->id.next) { - for (act= ob->actuators.first; act; act= act->next) { - if (act->type == ACT_IPO) { - // Create the new actuator - ia= act->data; - aa= MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version"); - - // Copy values - aa->type = ia->type; - aa->flag = ia->flag; - aa->sta = ia->sta; - aa->end = ia->end; - strcpy(aa->name, ia->name); - strcpy(aa->frameProp, ia->frameProp); - if (ob->adt) - aa->act = ob->adt->action; - - // Get rid of the old actuator - MEM_freeN(ia); - - // Assign the new actuator - act->data = aa; - act->type= act->otype= ACT_ACTION; - - } - else if (act->type == ACT_SHAPEACTION) { - act->type = act->otype = ACT_ACTION; - } - } - } - } { ParticleSettings *part; @@ -11831,6 +11792,44 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + { + /* convert fcurve and shape action actuators to action actuators */ + Object *ob; + bActuator *act; + bIpoActuator *ia; + bActionActuator *aa; + + for (ob= main->object.first; ob; ob= ob->id.next) { + for (act= ob->actuators.first; act; act= act->next) { + if (act->type == ACT_IPO) { + // Create the new actuator + ia= act->data; + aa= MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version"); + + // Copy values + aa->type = ia->type; + aa->flag = ia->flag; + aa->sta = ia->sta; + aa->end = ia->end; + strcpy(aa->name, ia->name); + strcpy(aa->frameProp, ia->frameProp); + if (ob->adt) + aa->act = ob->adt->action; + + // Get rid of the old actuator + MEM_freeN(ia); + + // Assign the new actuator + act->data = aa; + act->type= act->otype= ACT_ACTION; + + } + else if (act->type == ACT_SHAPEACTION) { + act->type = act->otype = ACT_ACTION; + } + } + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ -- cgit v1.2.3 From dca090abc87fc57cb0a98bbe07ea8868f04f8c97 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 5 Aug 2011 11:23:28 +0000 Subject: Assorted loose ends for auto-clamped handles work * Tweaked order of handle types to make it easier to find Auto/Auto- clamped in the list * Fixed a number of places which were still just checking for auto- handles when they should have included auto-clamped too, including handle rotation --- source/blender/blenkernel/intern/curve.c | 10 +++++----- source/blender/editors/animation/keyframes_edit.c | 4 ++-- source/blender/editors/transform/transform_conversions.c | 2 +- source/blender/makesrna/intern/rna_curve.c | 6 +++--- source/blender/makesrna/intern/rna_fcurve.c | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 2f1a85c57b3..b1beb6c449a 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2674,15 +2674,15 @@ void testhandlesNurb(Nurb *nu) if(bezt->f1 & SELECT) flag++; if(bezt->f2 & SELECT) flag += 2; if(bezt->f3 & SELECT) flag += 4; - + if( !(flag==0 || flag==7) ) { - if(bezt->h1==HD_AUTO) { /* auto */ + if(ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) { /* auto */ bezt->h1= HD_ALIGN; } - if(bezt->h2==HD_AUTO) { /* auto */ + if(ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */ bezt->h2= HD_ALIGN; } - + if(bezt->h1==HD_VECT) { /* vector */ if(flag < 4) bezt->h1= 0; } @@ -2692,7 +2692,7 @@ void testhandlesNurb(Nurb *nu) } bezt++; } - + calchandlesNurb(nu); } diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index ae9107ebe5a..d5fb8b17440 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -634,8 +634,8 @@ static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *be if (bezt->f2 & SELECT) { bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1]; - if ((bezt->h1==HD_AUTO) || (bezt->h1==HD_VECT)) bezt->h1= HD_ALIGN; - if ((bezt->h2==HD_AUTO) || (bezt->h2==HD_VECT)) bezt->h2= HD_ALIGN; + if (ELEM3(bezt->h1, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h1= HD_ALIGN; + if (ELEM3(bezt->h2, HD_AUTO, HD_AUTO_ANIM, HD_VECT)) bezt->h2= HD_ALIGN; } return 0; } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index b0488ef8b08..7b43d0955a7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3452,7 +3452,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) * then check if we're using auto-handles. * - If so, change them auto-handles to aligned handles so that handles get affected too */ - if ((bezt->h1 == HD_AUTO) && (bezt->h2 == HD_AUTO) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) { + if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) { if (hdata && (sel1) && (sel3)) { bezt->h1= HD_ALIGN; bezt->h2= HD_ALIGN; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 4e7fceed7e1..95a76dd7729 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -47,17 +47,17 @@ EnumPropertyItem beztriple_handle_type_items[] = { {HD_FREE, "FREE", 0, "Free", ""}, - {HD_AUTO, "AUTO", 0, "Auto", ""}, {HD_VECT, "VECTOR", 0, "Vector", ""}, {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, + {HD_AUTO, "AUTO", 0, "Auto", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem keyframe_handle_type_items[] = { {HD_FREE, "FREE", 0, "Free", ""}, - {HD_AUTO, "AUTO", 0, "Auto", ""}, - {HD_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot"}, {HD_VECT, "VECTOR", 0, "Vector", ""}, {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, + {HD_AUTO, "AUTO", 0, "Automatic", ""}, + {HD_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped", "Auto handles clamped to not overshoot"}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem beztriple_interpolation_mode_items[] = { diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 2f37a6921d1..6bb1416e7fc 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -596,15 +596,15 @@ static void rna_FKeyframe_points_add(FCurve *fcu, int tot) else { fcu->bezt= MEM_callocN(sizeof(BezTriple) * tot, "rna_FKeyframe_points_add"); } - + bezt= fcu->bezt + fcu->totvert; fcu->totvert += tot; - + while(tot--) { /* defaults, no userprefs gives pradictable results for API */ bezt->f1= bezt->f2= bezt->f3= SELECT; bezt->ipo= BEZT_IPO_BEZ; - bezt->h1= bezt->h2= HD_AUTO; + bezt->h1= bezt->h2= HD_AUTO_ANIM; bezt++; } } -- cgit v1.2.3 From 861d15738890409067eead832ceab7645c3a4708 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 5 Aug 2011 11:31:41 +0000 Subject: Bugfix [#28106] Missing 3D view update after copy of constraints --- source/blender/editors/object/object_constraint.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index a3df25824a4..2055c906b41 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1115,14 +1115,19 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { /* if we're not handling the object we're copying from, copy all constraints over */ - if (obact != ob) + if (obact != ob) { copy_constraints(&ob->constraints, &obact->constraints, TRUE); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + } } CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ DAG_scene_sort(bmain, scene); /* sort order of objects */ - + + /* notifiers for updates */ + WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, NULL); + return OPERATOR_FINISHED; } -- cgit v1.2.3 From d368716aed1cf5b7fd3f4edc34dbd729160c2fad Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 5 Aug 2011 12:17:49 +0000 Subject: Timeline UI Nitpicks: * "Only Selected channels" -> "Only Selected Channels" * Use Keying Set icon for "only keying set" toggle for autokeying --- source/blender/makesrna/intern/rna_scene.c | 5 ++--- source/blender/makesrna/intern/rna_space.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 4b33d23cfe2..170e590522d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1010,9 +1010,8 @@ static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[]) static void rna_TimeLine_remove(Scene *scene, ReportList *reports, TimeMarker *marker) { - /* try to remove the F-Curve from the action */ if (!BLI_remlink_safe(&scene->markers, marker)) { - BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in action '%s'", marker->name, scene->id.name+2); + BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in scene '%s'", marker->name, scene->id.name+2); return; } @@ -1231,7 +1230,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) 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_icon(prop, ICON_KEY_HLT, 0); // XXX: we need a dedicated icon + RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0); /* UV */ prop= RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index fccd00d36df..2ad3022bceb 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2131,7 +2131,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 channels 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); -- cgit v1.2.3 From 9747e5f2a0f86517f4c96a363544d90f07821cbc Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Fri, 5 Aug 2011 17:19:31 +0000 Subject: --- source/blender/collada/AnimationExporter.cpp | 69 ++++++++++++++++++++++++++-- source/blender/collada/AnimationExporter.h | 2 + 2 files changed, 68 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 5a5ec4fea2d..be70ec137fb 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -366,6 +366,17 @@ void AnimationExporter::exportAnimations(Scene *sce) return; find_all_frames(ob_arm, fra); + + if (flag & ARM_RESTPOS) { + arm->flag &= ~ARM_RESTPOS; + where_is_pose(scene, ob_arm); + } + + if (fra.size()) { + //int total = fra.back() - fra.front(); + float *values = (float*)MEM_callocN(sizeof(float) * 16 * fra.size(), "temp. anim frames"); + sample_animation(values, fra, bone, ob_arm, pchan); + } } void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) @@ -431,6 +442,54 @@ void AnimationExporter::exportAnimations(Scene *sce) where_is_pose(scene, ob_arm); } + void AnimationExporter::sample_animation(float *v, std::vector &frames, Bone *bone, Object *ob_arm, bPoseChannel *pchan) + { + bPoseChannel *parchan = NULL; + bPose *pose = ob_arm->pose; + + pchan = get_pose_channel(pose, bone->name); + + if (!pchan) + return; + + parchan = pchan->parent; + + enable_fcurves(ob_arm->adt->action, bone->name); + + std::vector::iterator it; + int j = 0; + for (it = frames.begin(); it != frames.end(); it++) { + float mat[4][4], ipar[4][4]; + + float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); + + //BKE_animsys_evaluate_animdata(&ob_arm->id, ob_arm->adt, *it, ADT_RECALC_ANIM); + //BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); + where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); + + // compute bone local mat + if (bone->parent) { + invert_m4_m4(ipar, parchan->pose_mat); + mul_m4_m4m4(mat, pchan->pose_mat, ipar); + } + else + copy_m4_m4(mat, pchan->pose_mat); + + for ( int i = 0; i < 4 ; i++) + { + for ( int k = 0; k<4 ; k++ ) + { + v[j*16 + 4*i + k] = mat[i][k]; + } + + } + // copy_m4_m4(v[j*16 + i], mat ) ; + + j++; + } + + enable_fcurves(ob_arm->adt->action, NULL); + } void AnimationExporter::sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) { bPoseChannel *parchan = NULL; @@ -965,10 +1024,14 @@ void AnimationExporter::exportAnimations(Scene *sce) } std::sort(keys.begin(), keys.end()); - - for ( float fAll = *(keys.begin()) ; fAll != *(keys.end()) ; fAll+=1.0f ) + float first, last; + std::vector::reference ref = keys.front(); + first = ref; + ref = keys.back(); + last = ref; + for (float i = first ; i != last ; i+=1.0f ) { - fra.push_back(fAll); + fra.push_back(i); } return; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 388d7dbb24d..00a0402b810 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -106,6 +106,8 @@ protected: void sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan); + void sample_animation(float *v, std::vector &frames, Bone *bone, Object *ob_arm, bPoseChannel *pChan); + // dae_bone_animation -> add_bone_animation // (blend this into dae_bone_animation) void dae_bone_animation(std::vector &fra, float *v, int tm_type, int axis, std::string ob_name, std::string bone_name); -- cgit v1.2.3 From 6829b93c11a4a338e57509465a7d764d9802a013 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Fri, 5 Aug 2011 18:32:39 +0000 Subject: create_4x4_source function --- source/blender/collada/AnimationExporter.cpp | 88 ++++++++++++++++++++++++++-- source/blender/collada/AnimationExporter.h | 6 +- 2 files changed, 87 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index be70ec137fb..1ba9bc3cd28 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -376,6 +376,9 @@ void AnimationExporter::exportAnimations(Scene *sce) //int total = fra.back() - fra.front(); float *values = (float*)MEM_callocN(sizeof(float) * 16 * fra.size(), "temp. anim frames"); sample_animation(values, fra, bone, ob_arm, pchan); + + dae_baked_animation(fra ,values, id_name(ob_arm), bone->name ); + } } @@ -489,6 +492,8 @@ void AnimationExporter::exportAnimations(Scene *sce) } enable_fcurves(ob_arm->adt->action, NULL); + + } void AnimationExporter::sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) { @@ -540,6 +545,47 @@ void AnimationExporter::exportAnimations(Scene *sce) enable_fcurves(ob_arm->adt->action, NULL); } + void AnimationExporter::dae_baked_animation(std::vector &fra, float *values, std::string ob_name, std::string bone_name) + { + char anim_id[200]; + + if (!fra.size()) + return; + + BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(), + (char*)translate_id(bone_name).c_str(), "pose_matrix"); + + openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); + + // create input source + std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, false, anim_id, ""); + + // create output source + std::string output_id; + output_id = create_4x4_source( values, fra.size(), anim_id); + + // create interpolations source + std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, ""); + + std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; + COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); + std::string empty; + sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id)); + sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id)); + + // TODO create in/out tangents source + + // this input is required + sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id)); + + addSampler(sampler); + + std::string target = translate_id(ob_name + "_" + bone_name) + "/transform"; + addChannel(COLLADABU::URI(empty, sampler_id), target); + + closeAnimation(); + } + // dae_bone_animation -> add_bone_animation // (blend this into dae_bone_animation) void AnimationExporter::dae_bone_animation(std::vector &fra, float *values, int tm_type, int axis, std::string ob_name, std::string bone_name) @@ -628,7 +674,7 @@ void AnimationExporter::exportAnimations(Scene *sce) } void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param, - COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis) + COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform) { switch(semantic) { case COLLADASW::InputSemantic::INPUT: @@ -642,7 +688,11 @@ void AnimationExporter::exportAnimations(Scene *sce) if (axis) { param.push_back(axis); } - else { //assumes if axis isn't specified all axises are added + else + if ( transform ) + { + param.push_back("TRANSFORM"); + }else{ //assumes if axis isn't specified all axises are added param.push_back("X"); param.push_back("Y"); param.push_back("Z"); @@ -739,7 +789,7 @@ void AnimationExporter::exportAnimations(Scene *sce) COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, is_angle, axis_name); + add_source_parameters(param, semantic, is_angle, axis_name, false); source.prepareToAppendValues(); @@ -768,7 +818,7 @@ void AnimationExporter::exportAnimations(Scene *sce) source.setAccessorStride(1); COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, is_rot, axis_name); + add_source_parameters(param, semantic, is_rot, axis_name, false); source.prepareToAppendValues(); @@ -798,7 +848,7 @@ void AnimationExporter::exportAnimations(Scene *sce) source.setAccessorStride(1); COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, is_rot, axis_name); + add_source_parameters(param, semantic, is_rot, axis_name, false); source.prepareToAppendValues(); @@ -817,6 +867,32 @@ void AnimationExporter::exportAnimations(Scene *sce) return source_id; } + std::string AnimationExporter::create_4x4_source(float *v, int tot, const std::string& anim_id) + { + COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; + std::string source_id = anim_id + get_semantic_suffix(semantic); + + COLLADASW::Float4x4Source source(mSW); + source.setId(source_id); + source.setArrayId(source_id + ARRAY_ID_SUFFIX); + source.setAccessorCount(tot); + source.setAccessorStride(16); + + COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); + add_source_parameters(param, semantic, false, NULL, false); + + source.prepareToAppendValues(); + + for (int i = 0; i < tot; i++) { + for ( int j = 0 ; j < 4 ; j++ ) + source.appendValues(*(v+j*4), *(v + 4*j +1), *(v + 2 + 4*j), *(v+3 + 4*j)); + v += 16; + } + + source.finish(); + + return source_id; + } // only used for sources with OUTPUT semantic ( locations and scale) std::string AnimationExporter::create_xyz_source(float *v, int tot, const std::string& anim_id) { @@ -830,7 +906,7 @@ void AnimationExporter::exportAnimations(Scene *sce) source.setAccessorStride(3); COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, false, NULL); + add_source_parameters(param, semantic, false, NULL, false); source.prepareToAppendValues(); diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 00a0402b810..cadd6940e9d 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -111,6 +111,8 @@ protected: // dae_bone_animation -> add_bone_animation // (blend this into dae_bone_animation) void dae_bone_animation(std::vector &fra, float *v, int tm_type, int axis, std::string ob_name, std::string bone_name); + + void dae_baked_animation(std::vector &fra, float *values, std::string ob_name, std::string bone_name); float convert_time(float frame); @@ -119,7 +121,7 @@ protected: std::string get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic); void add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param, - COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis); + COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis , bool transform); void get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length); @@ -133,6 +135,8 @@ protected: std::string create_xyz_source(float *v, int tot, const std::string& anim_id); + std::string create_4x4_source(float *v, int tot, const std::string& anim_id); + std::string create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents); std::string fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name); -- cgit v1.2.3 From 7e0049d27a699d5eb9f9be0c0b014fe62a78add8 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 6 Aug 2011 00:35:16 +0000 Subject: BGE Animations: Making the ping pong mode for action actuators behave more like trunk. The behavior is a lot closer, but there are still differences when interrupting a ping pong action. I'm still trying to decide if these are acceptable differences as they don't look all that simple to fix. --- source/gameengine/Converter/BL_ActionActuator.cpp | 23 +++++++++++++++++++---- source/gameengine/Converter/BL_ActionActuator.h | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 7bfe87c773e..0932493ccb8 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -153,7 +153,18 @@ bool BL_ActionActuator::Update(double curtime, bool frame) else if (m_playtype == ACT_ACTION_LOOP_STOP) play_mode = BL_Action::ACT_MODE_LOOP; else if (m_playtype == ACT_ACTION_PINGPONG) - play_mode = BL_Action::ACT_MODE_PING_PONG; + { + // We handle ping pong ourselves to increase compabitility with the pre-Pepper actuator + play_mode = BL_Action::ACT_MODE_PLAY; + + if (m_flag & ACT_FLAG_REVERSE) + { + float tmp = start; + start = end; + end = tmp; + m_localtime = end; + } + } else if (m_playtype == ACT_ACTION_FROM_PROP) { CValue* prop = GetParent()->GetProperty(m_propname); @@ -173,13 +184,14 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (bPositiveEvent) { - if (m_flag & ACT_FLAG_ACTIVE && m_flag & ACT_FLAG_CONTINUE) + + if (m_playtype != ACT_ACTION_PINGPONG && m_flag & ACT_FLAG_ACTIVE && m_flag & ACT_FLAG_CONTINUE) start = m_localtime = obj->GetActionFrame(m_layer); if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, m_layer_weight, m_ipo_flags)) { m_flag |= ACT_FLAG_ACTIVE; - if (m_flag & ACT_FLAG_CONTINUE) + if (m_playtype != ACT_ACTION_PINGPONG && m_flag & ACT_FLAG_CONTINUE) obj->SetActionFrame(m_layer, m_localtime); if (m_playtype == ACT_ACTION_PLAY) @@ -211,7 +223,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) m_flag &= ~ACT_FLAG_ACTIVE; return false; } - else if (m_playtype == ACT_ACTION_LOOP_END) + else if (m_playtype == ACT_ACTION_LOOP_END || m_playtype == ACT_ACTION_PINGPONG) { // Convert into a play and let it finish start = obj->GetActionFrame(m_layer); @@ -219,6 +231,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame) obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags); m_flag |= ACT_FLAG_PLAY_END; + + if (m_playtype == ACT_ACTION_PINGPONG) + m_flag ^= ACT_FLAG_REVERSE; } else if (m_playtype == ACT_ACTION_FLIPPER) { diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h index ee8599a9052..ad57b675b0b 100644 --- a/source/gameengine/Converter/BL_ActionActuator.h +++ b/source/gameengine/Converter/BL_ActionActuator.h @@ -151,7 +151,7 @@ protected: STR_String m_framepropname; }; -// The first values are not used in BL_ActionActuator anymore, +// Not all of these values are used in BL_ActionActuator anymore, // but BL_ShapeActionActuator still uses them, so we keep them around // for now. enum { -- cgit v1.2.3 From d096f271513dd5e10098818d567f35b99ca9c6cb Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sat, 6 Aug 2011 06:11:31 +0000 Subject: Material ray trace transparency animation COLLADA export. --- source/blender/collada/AnimationExporter.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 1ba9bc3cd28..53f3cc9aae3 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -119,11 +119,13 @@ void AnimationExporter::exportAnimations(Scene *sce) transformName = extract_transform_name( fcu->rna_path ); if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color")) - ||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))) + ||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))|| + (!strcmp(transformName, "ior"))) dae_animation(ob ,fcu, transformName, true, ma ); fcu = fcu->next; } } + } //if (!ob->adt || !ob->adt->action) // fcu = (FCurve*)((Lamp*)ob->data)->adt->action->curves.first; //this is already checked in hasAnimations() @@ -318,7 +320,7 @@ void AnimationExporter::exportAnimations(Scene *sce) if( ma ) target = translate_id(id_name(ma)) + "-effect" - +"/common/" /* should take dynamically */ + get_transform_sid(fcu->rna_path, -1, axis_name, true); + +"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true); } addChannel(COLLADABU::URI(empty, sampler_id), target); @@ -467,7 +469,7 @@ void AnimationExporter::exportAnimations(Scene *sce) float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); //BKE_animsys_evaluate_animdata(&ob_arm->id, ob_arm->adt, *it, ADT_RECALC_ANIM); - //BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); + BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); // compute bone local mat @@ -1017,6 +1019,8 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_type = 13; else if (!strcmp(name, "alpha")) tm_type = 14; + else if (!strcmp(name, "ior")) + tm_type = 15; else tm_type = -1; @@ -1067,6 +1071,9 @@ void AnimationExporter::exportAnimations(Scene *sce) case 14: tm_name = "transparency"; break; + case 15: + tm_name = "index_of_refraction"; + break; default: tm_name = ""; -- cgit v1.2.3 From e73cf35f4ad470d553540d6adbe89af5cc0c1f4f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 6 Aug 2011 07:01:07 +0000 Subject: Graph Editor "Active Keyframe" settings This commit makes some tweaks to the way that the "active keyframe" settings in the Properties region in the Graph Editor work (for the better, hopefully). Basically, the problem was that previously, these were clunky and non- intuitive to use, since they were just directly displaying the RNA properties for those keyframes for editing purposes. But due to limitations of RNA (i.e. from a RNA pointer to a keyframe, you couldn't see which F-Curve you came from), several things were impossible, notably: 1) Doing proper updates, including validating that the handles are in a valid state - that requires access to the F-Curve to provide to the F-Curve-based curve validity checking functions 2) Having the values of the keyframes display in whatever unit that the property the F-Curve affects displays as - for this, you once again need to know the F-Curve in order to resolve the property that it affects; also the fact that only a single unit could be set for RNA properties further limited things This commit basically gets around these problems by moving away from a layout-engine based approach to one where we attach custom update callbacks and also override the units of the y-co widgets when creating the widgets for these, thus allowing the buttons to work in the ways that animators expect. --- source/blender/editors/interface/interface.c | 12 ++- source/blender/editors/space_graph/graph_buttons.c | 87 +++++++++++++++++++--- 2 files changed, 86 insertions(+), 13 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 40d86ec1147..c7c2235097f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3216,11 +3216,17 @@ void uiButSetUnitType(uiBut *but, const int unit_type) int uiButGetUnitType(uiBut *but) { - if(but->rnaprop) { - return RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop)); + int ownUnit = (int)but->unit_type; + + /* own unit define always takes precidence over RNA provided, allowing for overriding + * default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit) + */ + // XXX: this doesn't allow clearing unit completely, though the same could be said for icons + if ((ownUnit != 0) || (but->rnaprop == NULL)) { + return ownUnit << 16; } else { - return ((int)but->unit_type)<<16; + return RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop)); } } diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 3073ff13075..d8fd53b83d8 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -53,6 +53,7 @@ #include "BKE_fcurve.h" #include "BKE_main.h" #include "BKE_screen.h" +#include "BKE_unit.h" #include "WM_api.h" @@ -77,8 +78,7 @@ /* ******************* graph editor space & buttons ************** */ -#define B_NOP 1 -#define B_REDR 2 +#define B_REDR 1 /* -------------- */ @@ -244,6 +244,35 @@ static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezT return 0; } +/* 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)) +{ + 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); +} + +/* update callback for active keyframe properties - handle-editing wrapper */ +static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bezt_ptr) +{ + FCurve *fcu = (FCurve *)fcu_ptr; + BezTriple *bezt = (BezTriple *)bezt_ptr; + + /* since editing the handles, make sure they're set to types which are receptive to editing + * see transform_conversions.c :: createTransGraphEditData(), last step in second loop + */ + if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { + /* by changing to aligned handles, these can now be moved... */ + bezt->h1= HD_ALIGN; + bezt->h2= HD_ALIGN; + } + + /* now call standard updates */ + graphedit_activekey_update_cb(C, fcu_ptr, bezt_ptr); +} + static void graph_panel_key_properties(const bContext *C, Panel *pa) { bAnimListElem *ale; @@ -262,27 +291,66 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) /* only show this info if there are keyframes to edit */ if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) { - PointerRNA bezt_ptr; + PointerRNA bezt_ptr, id_ptr, fcu_prop_ptr; + PropertyRNA *fcu_prop = NULL; + uiBut *but; + int unit = B_UNIT_NONE; /* RNA pointer to keyframe, to allow editing */ RNA_pointer_create(ale->id, &RNA_Keyframe, bezt, &bezt_ptr); + /* get property that F-Curve affects, for some unit-conversion magic */ + RNA_id_pointer_create(ale->id, &id_ptr); + if (RNA_path_resolve(&id_ptr, fcu->rna_path, &fcu_prop_ptr, &fcu_prop) && fcu_prop) { + /* determine the unit for this property */ + unit = RNA_SUBTYPE_UNIT(RNA_property_subtype(fcu_prop)); + } + /* interpolation */ col= uiLayoutColumn(layout, 0); uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE); - /* numerical coordinate editing */ + /* numerical coordinate editing + * - we use the button-versions of the calls so that we can attach special update handlers + * and unit conversion magic that cannot be achieved using a purely RNA-approach + */ + // XXX: col= uiLayoutColumn(layout, 1); /* keyframe itself */ - uiItemR(col, &bezt_ptr, "co", 0, "Key", ICON_NONE); + { + uiItemL(col, "Key:", ICON_NONE); + + but = uiDefButR(block, NUM, B_REDR, "Frame", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt); + + but = uiDefButR(block, NUM, B_REDR, "Value", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_update_cb, fcu, bezt); + uiButSetUnitType(but, unit); + } /* previous handle - only if previous was Bezier interpolation */ - if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) - uiItemR(col, &bezt_ptr, "handle_left", 0, NULL, ICON_NONE); + if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) { + uiItemL(col, "Left Handle:", ICON_NONE); + + but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + + but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_left", 1, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + uiButSetUnitType(but, unit); + } /* next handle - only if current is Bezier interpolation */ - if (bezt->ipo == BEZT_IPO_BEZ) - uiItemR(col, &bezt_ptr, "handle_right", 0, NULL, ICON_NONE); + if (bezt->ipo == BEZT_IPO_BEZ) { + uiItemL(col, "Right Handle:", ICON_NONE); + + but = uiDefButR(block, NUM, B_REDR, "X", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + + but = uiDefButR(block, NUM, B_REDR, "Y", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "handle_right", 1, 0, 0, -1, -1, NULL); + uiButSetFunc(but, graphedit_activekey_handles_cb, fcu, bezt); + uiButSetUnitType(but, unit); + } } else { if ((fcu->bezt == NULL) && (fcu->modifiers.first)) { @@ -659,7 +727,6 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event) { switch (event) { - case B_REDR: case B_FMODIFIER_REDRAW: // XXX this should send depsgraph updates too WM_event_add_notifier(C, NC_ANIMATION, NULL); // XXX need a notifier specially for F-Modifiers break; -- cgit v1.2.3 From c334bf69a7282254bb80bb2896bd8716930a4adf Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 6 Aug 2011 17:57:20 +0000 Subject: 3D Audio GSoC: Mixdown functionality. * Mixdown possible via libsndfile and ffmpeg! * Fixed some ffmpeg deprecation warnings * Mixdown UI only shows working Container, Codec and Format combinations! * Minor bugs and warnings fixed --- source/blender/editors/sound/CMakeLists.txt | 8 + source/blender/editors/sound/sound_ops.c | 287 +++++++++++++++++++++++++++- 2 files changed, 287 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt index f66288812ad..11da4165ec8 100644 --- a/source/blender/editors/sound/CMakeLists.txt +++ b/source/blender/editors/sound/CMakeLists.txt @@ -47,4 +47,12 @@ if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() +if(WITH_CODEC_FFMPEG) + add_definitions(-DWITH_FFMPEG) +endif() + +if(WITH_CODEC_SNDFILE) + add_definitions(-DWITH_SNDFILE) +endif() + blender_add_lib(bf_editor_sound "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 8744ec5dfd6..c6a3663d512 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -82,7 +82,7 @@ static void open_init(bContext *C, wmOperator *op) { PropertyPointerRNA *pprop; - + op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA"); uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } @@ -101,7 +101,7 @@ static int open_exec(bContext *C, wmOperator *op) if(!op->customdata) open_init(C, op); - + if (sound==NULL || sound->playback_handle == NULL) { if(op->customdata) MEM_freeN(op->customdata); BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); @@ -120,15 +120,15 @@ static int open_exec(bContext *C, wmOperator *op) if (RNA_boolean_get(op->ptr, "cache")) { sound_cache(sound, 0); } - + /* hook into UI */ pprop= op->customdata; - + if(pprop->prop) { /* when creating new ID blocks, use is already 1, but RNA * pointer se also increases user, so this compensates it */ sound->id.us--; - + RNA_id_pointer_create(&sound->id, &idptr); RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr); RNA_property_update(C, &pprop->ptr, pprop->prop); @@ -153,12 +153,12 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) { if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - + if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); - + open_init(C, op); - + return WM_operator_filesel(C, op, event); } @@ -181,6 +181,276 @@ void SOUND_OT_open(wmOperatorType *ot) RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory."); } +/******************** mixdown operator ********************/ + +static int mixdown_exec(bContext *C, wmOperator *op) +{ + char path[FILE_MAX]; + char filename[FILE_MAX]; + Scene *scene; + Main *bmain; + + int bitrate, accuracy; + AUD_DeviceSpecs specs; + AUD_Container container; + AUD_Codec codec; + const char* result; + + RNA_string_get(op->ptr, "filepath", path); + bitrate = RNA_int_get(op->ptr, "bitrate") * 1000; + accuracy = RNA_int_get(op->ptr, "accuracy"); + specs.format = RNA_enum_get(op->ptr, "format"); + container = RNA_enum_get(op->ptr, "container"); + codec = RNA_enum_get(op->ptr, "codec"); + scene = CTX_data_scene(C); + bmain = CTX_data_main(C); + specs.channels = scene->r.ffcodecdata.audio_channels; + specs.rate = scene->r.ffcodecdata.audio_mixrate; + + BLI_strncpy(filename, path, sizeof(filename)); + BLI_path_abs(filename, bmain->name); + + result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS, + accuracy, filename, specs, container, codec, bitrate); + + if(result) + { + BKE_report(op->reports, RPT_ERROR, result); + return OPERATOR_CANCELLED; + } + + return OPERATOR_FINISHED; +} + +static int mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + if(!RNA_property_is_set(op->ptr, "relative_path")) + RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); + + if(RNA_property_is_set(op->ptr, "filepath")) + return mixdown_exec(C, op); + + return WM_operator_filesel(C, op, event); +} + +static int mixdown_draw_check_prop(PropertyRNA *prop) +{ + const char *prop_id= RNA_property_identifier(prop); + return !( strcmp(prop_id, "filepath") == 0 || + strcmp(prop_id, "directory") == 0 || + strcmp(prop_id, "filename") == 0 + ); +} + +static void mixdown_draw(bContext *C, wmOperator *op) +{ + static EnumPropertyItem pcm_format_items[] = { + {AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"}, + {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, +#ifdef WITH_SNDFILE + {AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"}, +#endif + {AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"}, + {AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"}, + {AUD_FORMAT_FLOAT64, "F64", 0, "F64", "64 bit floating point"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem mp3_format_items[] = { + {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, + {AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem ac3_format_items[] = { + {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, + {AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"}, + {0, NULL, 0, NULL, NULL}}; + +#ifdef WITH_SNDFILE + static EnumPropertyItem flac_format_items[] = { + {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, + {AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"}, + {0, NULL, 0, NULL, NULL}}; +#endif + + static EnumPropertyItem all_codec_items[] = { + {AUD_CODEC_AAC, "AAC", 0, "AAC", "Advanced Audio Coding"}, + {AUD_CODEC_AC3, "AC3", 0, "AC3", "Dolby Digital ATRAC 3"}, + {AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"}, + {AUD_CODEC_MP2, "MP2", 0, "MP2", "MPEG-1 Audio Layer II"}, + {AUD_CODEC_MP3, "MP3", 0, "MP3", "MPEG-2 Audio Layer III"}, + {AUD_CODEC_PCM, "PCM", 0, "PCM", "Pulse Code Modulation (RAW)"}, + {AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem ogg_codec_items[] = { + {AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"}, + {AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"}, + {0, NULL, 0, NULL, NULL}}; + + uiLayout *layout = op->layout; + wmWindowManager *wm= CTX_wm_manager(C); + PointerRNA ptr; + PropertyRNA *prop_format; + PropertyRNA *prop_codec; + PropertyRNA *prop_bitrate; + + AUD_Container container = RNA_enum_get(op->ptr, "container"); + AUD_Codec codec = RNA_enum_get(op->ptr, "codec"); + + prop_format = RNA_struct_find_property(op->ptr, "format"); + prop_codec = RNA_struct_find_property(op->ptr, "codec"); + prop_bitrate = RNA_struct_find_property(op->ptr, "bitrate"); + + RNA_def_property_clear_flag(prop_bitrate, PROP_HIDDEN); + RNA_def_property_flag(prop_codec, PROP_HIDDEN); + RNA_def_property_flag(prop_format, PROP_HIDDEN); + + switch(container) + { + case AUD_CONTAINER_AC3: + RNA_def_property_clear_flag(prop_format, PROP_HIDDEN); + RNA_def_property_enum_items(prop_format, ac3_format_items); + RNA_def_property_enum_items(prop_codec, all_codec_items); + RNA_enum_set(op->ptr, "codec", AUD_CODEC_AC3); + break; + case AUD_CONTAINER_FLAC: + RNA_def_property_flag(prop_bitrate, PROP_HIDDEN); + RNA_def_property_enum_items(prop_codec, all_codec_items); + RNA_enum_set(op->ptr, "codec", AUD_CODEC_FLAC); +#ifdef WITH_SNDFILE + RNA_def_property_clear_flag(prop_format, PROP_HIDDEN); + RNA_def_property_enum_items(prop_format, flac_format_items); +#else + RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); +#endif + break; + case AUD_CONTAINER_MATROSKA: + RNA_def_property_clear_flag(prop_codec, PROP_HIDDEN); + RNA_def_property_enum_items(prop_codec, all_codec_items); + + switch(codec) + { + case AUD_CODEC_AAC: + RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); + break; + case AUD_CODEC_AC3: + RNA_def_property_enum_items(prop_format, ac3_format_items); + RNA_def_property_clear_flag(prop_format, PROP_HIDDEN); + break; + case AUD_CODEC_FLAC: + RNA_def_property_flag(prop_bitrate, PROP_HIDDEN); + RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); + break; + case AUD_CODEC_MP2: + RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); + break; + case AUD_CODEC_MP3: + RNA_def_property_enum_items(prop_format, mp3_format_items); + RNA_def_property_clear_flag(prop_format, PROP_HIDDEN); + break; + case AUD_CODEC_PCM: + RNA_def_property_flag(prop_bitrate, PROP_HIDDEN); + RNA_def_property_enum_items(prop_format, pcm_format_items); + RNA_def_property_clear_flag(prop_format, PROP_HIDDEN); + break; + case AUD_CODEC_VORBIS: + RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); + break; + } + + break; + case AUD_CONTAINER_MP2: + RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); + RNA_enum_set(op->ptr, "codec", AUD_CODEC_MP2); + RNA_def_property_enum_items(prop_codec, all_codec_items); + break; + case AUD_CONTAINER_MP3: + RNA_def_property_clear_flag(prop_format, PROP_HIDDEN); + RNA_def_property_enum_items(prop_format, mp3_format_items); + RNA_def_property_enum_items(prop_codec, all_codec_items); + RNA_enum_set(op->ptr, "codec", AUD_CODEC_MP3); + break; + case AUD_CONTAINER_OGG: + RNA_def_property_clear_flag(prop_codec, PROP_HIDDEN); + RNA_def_property_enum_items(prop_codec, ogg_codec_items); + RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); + break; + case AUD_CONTAINER_WAV: + RNA_def_property_flag(prop_bitrate, PROP_HIDDEN); + RNA_def_property_clear_flag(prop_format, PROP_HIDDEN); + RNA_def_property_enum_items(prop_format, pcm_format_items); + RNA_def_property_enum_items(prop_codec, all_codec_items); + RNA_enum_set(op->ptr, "codec", AUD_CODEC_PCM); + break; + } + + RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + + /* main draw call */ + uiDefAutoButsRNA(layout, &ptr, mixdown_draw_check_prop, '\0'); +} + +void SOUND_OT_mixdown(wmOperatorType *ot) +{ + static EnumPropertyItem format_items[] = { + {AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"}, + {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, + {AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"}, + {AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"}, + {AUD_FORMAT_FLOAT32, "F32", 0, "F32", "32 bit floating point"}, + {AUD_FORMAT_FLOAT64, "F64", 0, "F64", "64 bit floating point"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem container_items[] = { +#ifdef WITH_FFMPEG + {AUD_CONTAINER_AC3, "AC3", 0, "ac3", "Dolby Digital ATRAC 3"}, +#endif + {AUD_CONTAINER_FLAC, "FLAC", 0, "flac", "Free Lossless Audio Codec"}, +#ifdef WITH_FFMPEG + {AUD_CONTAINER_MATROSKA, "MATROSKA", 0, "mkv", "Matroska"}, + {AUD_CONTAINER_MP2, "MP2", 0, "mp2", "MPEG-1 Audio Layer II"}, + {AUD_CONTAINER_MP3, "MP3", 0, "mp3", "MPEG-2 Audio Layer III"}, +#endif + {AUD_CONTAINER_OGG, "OGG", 0, "ogg", "Xiph.Org Ogg Container"}, + {AUD_CONTAINER_WAV, "WAV", 0, "wav", "Waveform Audio File Format"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem codec_items[] = { +#ifdef WITH_FFMPEG + {AUD_CODEC_AAC, "AAC", 0, "AAC", "Advanced Audio Coding"}, + {AUD_CODEC_AC3, "AC3", 0, "AC3", "Dolby Digital ATRAC 3"}, +#endif + {AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"}, +#ifdef WITH_FFMPEG + {AUD_CODEC_MP2, "MP2", 0, "MP2", "MPEG-1 Audio Layer II"}, + {AUD_CODEC_MP3, "MP3", 0, "MP3", "MPEG-2 Audio Layer III"}, +#endif + {AUD_CODEC_PCM, "PCM", 0, "PCM", "Pulse Code Modulation (RAW)"}, + {AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"}, + {0, NULL, 0, NULL, NULL}}; + + /* identifiers */ + ot->name= "Mixdown"; + ot->description= "Mixes the scene's audio to a sound file"; + ot->idname= "SOUND_OT_mixdown"; + + /* api callbacks */ + ot->exec= mixdown_exec; + ot->invoke= mixdown_invoke; + ot->ui= mixdown_draw; + + /* flags */ + ot->flag= OPTYPE_REGISTER; + + /* properties */ + WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH); + RNA_def_int(ot->srna, "accuracy", 1024, 1, 16777216, "Accuracy", "Sample accuracy. Important for animation data. The lower the value, the more accurate.", 1, 16777216); + RNA_def_enum(ot->srna, "container", container_items, AUD_CONTAINER_FLAC, "Container", "File format"); + RNA_def_enum(ot->srna, "codec", codec_items, AUD_CODEC_FLAC, "Codec", "Audio Codec"); + RNA_def_enum(ot->srna, "format", format_items, AUD_FORMAT_S16, "Format", "Sample format"); + RNA_def_int(ot->srna, "bitrate", 192, 32, 512, "Bitrate", "Bitrate in kbit/s", 32, 512); +} + /* ******************************************************* */ static int sound_poll(bContext *C) @@ -393,6 +663,7 @@ void SOUND_OT_bake_animation(wmOperatorType *ot) void ED_operatortypes_sound(void) { WM_operatortype_append(SOUND_OT_open); + WM_operatortype_append(SOUND_OT_mixdown); WM_operatortype_append(SOUND_OT_pack); WM_operatortype_append(SOUND_OT_unpack); WM_operatortype_append(SOUND_OT_update_animation_flags); -- cgit v1.2.3 From 5cc0bb0d1b3dbdc8494fe2ff444c683b82b7d15f Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 7 Aug 2011 04:57:23 +0000 Subject: BGE Animations: The IPO conversion code relied on objects having an adt, but this isn't always the case. object->adt can be NULL, which causes a crash. Now BL_InterpolatorLists are cached by action instead of adt. --- .../gameengine/Converter/KX_BlenderSceneConverter.cpp | 10 +++++----- source/gameengine/Converter/KX_BlenderSceneConverter.h | 4 ++-- source/gameengine/Converter/KX_IpoConvert.cpp | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 58089cc4b2d..3dd12cf6c8f 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -566,18 +566,18 @@ void KX_BlenderSceneConverter::RegisterPolyMaterial(RAS_IPolyMaterial *polymat) void KX_BlenderSceneConverter::RegisterInterpolatorList( - BL_InterpolatorList *adtList, - struct AnimData *for_adt) + BL_InterpolatorList *actList, + struct bAction *for_act) { - m_map_blender_to_gameAdtList.insert(CHashedPtr(for_adt), adtList); + m_map_blender_to_gameAdtList.insert(CHashedPtr(for_act), actList); } BL_InterpolatorList *KX_BlenderSceneConverter::FindInterpolatorList( - struct AnimData *for_adt) + struct bAction *for_act) { - BL_InterpolatorList **listp = m_map_blender_to_gameAdtList[CHashedPtr(for_adt)]; + BL_InterpolatorList **listp = m_map_blender_to_gameAdtList[CHashedPtr(for_act)]; return listp?*listp:NULL; } diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h index 2340e44d288..ba919eb9592 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h @@ -113,8 +113,8 @@ public: void RegisterBlenderMaterial(BL_Material *mat); - void RegisterInterpolatorList(BL_InterpolatorList *adtList, struct AnimData *for_adt); - BL_InterpolatorList *FindInterpolatorList(struct AnimData *for_adt); + void RegisterInterpolatorList(BL_InterpolatorList *actList, struct bAction *for_act); + BL_InterpolatorList *FindInterpolatorList(struct bAction *for_act); void RegisterGameActuator(SCA_IActuator *act, struct bActuator *for_actuator); SCA_IActuator *FindGameActuator(struct bActuator *for_actuator); diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index 27ae857f45c..0e526bc818d 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -73,12 +73,12 @@ #include "STR_HashedString.h" -static BL_InterpolatorList *GetAdtList(struct AnimData *for_adt, KX_BlenderSceneConverter *converter) { - BL_InterpolatorList *adtList= converter->FindInterpolatorList(for_adt); +static BL_InterpolatorList *GetAdtList(struct bAction *for_act, KX_BlenderSceneConverter *converter) { + BL_InterpolatorList *adtList= converter->FindInterpolatorList(for_act); if (!adtList) { - adtList = new BL_InterpolatorList(for_adt->action); - converter->RegisterInterpolatorList(adtList, for_adt); + adtList = new BL_InterpolatorList(for_act); + converter->RegisterInterpolatorList(adtList, for_act); } return adtList; @@ -128,7 +128,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B drotmode = "delta_rotation_euler"; } - BL_InterpolatorList *adtList= GetAdtList(blenderobject->adt, converter); + BL_InterpolatorList *adtList= GetAdtList(action, converter); // For each active channel in the adtList add an // interpolator to the game object. @@ -222,7 +222,7 @@ void BL_ConvertLampIpos(struct Lamp* blenderlamp, KX_GameObject *lightobj,KX_Ble ipocontr->m_col_rgb[2] = blenderlamp->b; ipocontr->m_dist = blenderlamp->dist; - BL_InterpolatorList *adtList= GetAdtList(blenderlamp->adt, converter); + BL_InterpolatorList *adtList= GetAdtList(blenderlamp->adt->action, converter); // For each active channel in the adtList add an // interpolator to the game object. @@ -268,7 +268,7 @@ void BL_ConvertCameraIpos(struct Camera* blendercamera, KX_GameObject *cameraobj ipocontr->m_clipstart = blendercamera->clipsta; ipocontr->m_clipend = blendercamera->clipend; - BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt, converter); + BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt->action, converter); // For each active channel in the adtList add an // interpolator to the game object. @@ -316,7 +316,7 @@ void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *co ipocontr->m_mist_rgb[1] = blenderworld->horg; ipocontr->m_mist_rgb[2] = blenderworld->horb; - BL_InterpolatorList *adtList= GetAdtList(blenderworld->adt, converter); + BL_InterpolatorList *adtList= GetAdtList(blenderworld->adt->action, converter); // For each active channel in the adtList add an // interpolator to the game object. @@ -358,7 +358,7 @@ static void ConvertMaterialIpos( gameobj->GetSGNode()->AddSGController(ipocontr); ipocontr->SetObject(gameobj->GetSGNode()); - BL_InterpolatorList *adtList= GetAdtList(blendermaterial->adt, converter); + BL_InterpolatorList *adtList= GetAdtList(blendermaterial->adt->action, converter); ipocontr->m_rgba[0] = blendermaterial->r; -- cgit v1.2.3 From 2d884fc035d403d43c7a18e3e61cd56ccdfbec2b Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sun, 7 Aug 2011 11:54:58 +0000 Subject: 3D Audio GSoC: * Pepper depends on ffmpeg 0.7.1 or higher now, windows and mac build systems set to ffmpeg-0.8 * Fixed orientation retrieval in OpenAL device code. * Added stopAll() method to AUD_IDevice (also for Python) and call it on BGE exit * Changed BGE to use audaspace via native C++ instead over the C API. * Made AUD_SequencerFactory and AUD_SequencerEntry thread safe. * Changed sound caching into a flag which fixes problems on file loading, especially with undo. * Removed unused parameter from sound_mute_scene_sound * Fixed bug: changing FPS didn't update the sequencer sound positions. * Fixed bug: Properties of sequencer strips weren't set correctly. * Minor warning fixes. --- source/blender/blenkernel/BKE_sequencer.h | 3 +- source/blender/blenkernel/BKE_sound.h | 6 +- source/blender/blenkernel/intern/sequencer.c | 36 +++- source/blender/blenkernel/intern/sound.c | 35 +++- source/blender/blenloader/intern/readfile.c | 12 +- source/blender/editors/sound/sound_ops.c | 6 +- .../editors/space_sequencer/sequencer_add.c | 2 +- .../editors/space_sequencer/sequencer_edit.c | 10 +- source/blender/makesdna/DNA_sound_types.h | 3 +- source/blender/makesrna/intern/rna_scene.c | 2 + source/blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/makesrna/intern/rna_sound.c | 4 +- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 24 ++- .../gameengine/Converter/KX_ConvertActuators.cpp | 4 +- source/gameengine/Ketsji/CMakeLists.txt | 1 + source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 21 ++- source/gameengine/Ketsji/KX_SoundActuator.cpp | 182 ++++++++++----------- source/gameengine/Ketsji/KX_SoundActuator.h | 9 +- source/gameengine/Ketsji/SConscript | 2 +- 19 files changed, 212 insertions(+), 152 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index cebf99097aa..773096d1e0d 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -282,8 +282,9 @@ void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_m struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence * seq, int dupe_flag); int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str); +void seq_update_sound_bounds_all(struct Scene *scene); void seq_update_sound_bounds(struct Scene* scene, struct Sequence *seq); -void seq_update_muting(struct Scene* scene, struct Editing *ed); +void seq_update_muting(struct Editing *ed); void seq_update_sound(struct Scene *scene, struct bSound *sound); void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase); void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq); diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 632a2a0bb3b..2cd006385e0 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -62,9 +62,9 @@ struct bSound* sound_new_limiter(struct bContext *C, struct bSound *source, floa void sound_delete(struct bContext *C, struct bSound* sound); -void sound_cache(struct bSound* sound, int ignore); +void sound_cache(struct bSound* sound); -void sound_cache_notifying(struct Main* main, struct bSound* sound, int ignore); +void sound_cache_notifying(struct Main* main, struct bSound* sound); void sound_delete_cache(struct bSound* sound); @@ -92,7 +92,7 @@ void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int void sound_remove_scene_sound(struct Scene *scene, void* handle); -void sound_mute_scene_sound(struct Scene *scene, void* handle, char mute); +void sound_mute_scene_sound(void* handle, char mute); void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, int endframe, int frameskip); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 9ff3ce7afe2..93e0c920745 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3145,6 +3145,28 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene) return offset? 0:1; } +void seq_update_sound_bounds_all(Scene *scene) +{ + Editing *ed = scene->ed; + + if(ed) + { + Sequence *seq; + + for(seq = ed->seqbase.first; seq; seq = seq->next) + { + if(seq->type == SEQ_META) + { + seq_update_sound_bounds_recursive(scene, seq); + } + else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) + { + seq_update_sound_bounds(scene, seq); + } + } + } +} + void seq_update_sound_bounds(Scene* scene, Sequence *seq) { if(seq->scene_sound) @@ -3154,7 +3176,7 @@ void seq_update_sound_bounds(Scene* scene, Sequence *seq) } } -static void seq_update_muting_recursive(Scene *scene, ListBase *seqbasep, Sequence *metaseq, int mute) +static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, int mute) { Sequence *seq; int seqmute; @@ -3170,26 +3192,26 @@ static void seq_update_muting_recursive(Scene *scene, ListBase *seqbasep, Sequen if(seq == metaseq) seqmute= 0; - seq_update_muting_recursive(scene, &seq->seqbase, metaseq, seqmute); + seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute); } else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) { if(seq->scene_sound) { - sound_mute_scene_sound(scene, seq->scene_sound, seqmute); + sound_mute_scene_sound(seq->scene_sound, seqmute); } } } } -void seq_update_muting(Scene *scene, Editing *ed) +void seq_update_muting(Editing *ed) { if(ed) { /* mute all sounds up to current metastack list */ MetaStack *ms= ed->metastack.last; if(ms) - seq_update_muting_recursive(scene, &ed->seqbase, ms->parseq, 1); + seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1); else - seq_update_muting_recursive(scene, &ed->seqbase, NULL, 0); + seq_update_muting_recursive(&ed->seqbase, NULL, 0); } } @@ -3469,7 +3491,7 @@ void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load) if(seq_load->flag & SEQ_LOAD_SOUND_CACHE) { if(seq->sound) - sound_cache(seq->sound, 0); + sound_cache(seq->sound); } seq_load->tot_success++; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 59f5cdb678e..890fc114e68 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -91,6 +91,7 @@ void sound_free(struct bSound* sound) if(sound->cache) { AUD_unload(sound->cache); + sound->cache = NULL; } #endif // WITH_AUDASPACE } @@ -250,23 +251,25 @@ void sound_delete(struct bContext *C, struct bSound* sound) } } -void sound_cache(struct bSound* sound, int ignore) +void sound_cache(struct bSound* sound) { - if(sound->cache && !ignore) + sound->flags |= SOUND_FLAGS_CACHING; + if(sound->cache) AUD_unload(sound->cache); sound->cache = AUD_bufferSound(sound->handle); sound->playback_handle = sound->cache; } -void sound_cache_notifying(struct Main* main, struct bSound* sound, int ignore) +void sound_cache_notifying(struct Main* main, struct bSound* sound) { - sound_cache(sound, ignore); + sound_cache(sound); sound_update_sequencer(main, sound); } void sound_delete_cache(struct bSound* sound) { + sound->flags &= ~SOUND_FLAGS_CACHING; if(sound->cache) { AUD_unload(sound->cache); @@ -279,6 +282,12 @@ void sound_load(struct Main *bmain, struct bSound* sound) { if(sound) { + if(sound->cache) + { + AUD_unload(sound->cache); + sound->cache = NULL; + } + if(sound->handle) { AUD_unload(sound->handle); @@ -330,6 +339,11 @@ void sound_load(struct Main *bmain, struct bSound* sound) break; } #endif + if(sound->flags & SOUND_FLAGS_CACHING) + { + sound->cache = AUD_bufferSound(sound->handle); + } + if(sound->cache) sound->playback_handle = sound->cache; else @@ -400,7 +414,12 @@ void* sound_scene_add_scene_sound(struct Scene *scene, struct Sequence* sequence void* sound_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip) { - return AUD_addSequence(scene->sound_scene, sequence->sound->playback_handle, startframe / FPS, endframe / FPS, frameskip / FPS); + void* handle = AUD_addSequence(scene->sound_scene, sequence->sound->playback_handle, startframe / FPS, endframe / FPS, frameskip / FPS); + AUD_muteSequence(handle, (sequence->flag & SEQ_MUTE) != 0); + AUD_setSequenceAnimData(handle, AUD_AP_VOLUME, CFRA, &sequence->volume, 0); + AUD_setSequenceAnimData(handle, AUD_AP_PITCH, CFRA, &sequence->pitch, 0); + AUD_setSequenceAnimData(handle, AUD_AP_PANNING, CFRA, &sequence->pan, 0); + return handle; } void sound_remove_scene_sound(struct Scene *scene, void* handle) @@ -408,7 +427,7 @@ void sound_remove_scene_sound(struct Scene *scene, void* handle) AUD_removeSequence(scene->sound_scene, handle); } -void sound_mute_scene_sound(struct Scene *scene, void* handle, char mute) +void sound_mute_scene_sound(void* handle, char mute) { AUD_muteSequence(handle, mute); } @@ -612,7 +631,7 @@ void sound_force_device(int UNUSED(device)) {} void sound_init_once(void) {} void sound_init(struct Main *UNUSED(bmain)) {} void sound_exit(void) {} -void sound_cache(struct bSound* UNUSED(sound), int UNUSED(ignore)) { } +void sound_cache(struct bSound* UNUSED(sound)) { } void sound_delete_cache(struct bSound* UNUSED(sound)) {} void sound_load(struct Main *UNUSED(bmain), struct bSound* UNUSED(sound)) {} void sound_create_scene(struct Scene *UNUSED(scene)) {} @@ -621,7 +640,7 @@ void sound_mute_scene(struct Scene *UNUSED(scene), int UNUSED(muted)) {} void* sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; } void* sound_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; } void sound_remove_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle)) {} -void sound_mute_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), char UNUSED(mute)) {} +void sound_mute_scene_sound(void* UNUSED(handle), char UNUSED(mute)) {} void sound_move_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) {} static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} void sound_play_scene(struct Scene *UNUSED(scene)) {} diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e22f5dcb3de..07e2bbf5bca 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4473,7 +4473,7 @@ static void lib_link_scene(FileData *fd, Main *main) #endif if(sce->ed) - seq_update_muting(sce, sce->ed); + seq_update_muting(sce->ed); if(sce->nodetree) { lib_link_ntree(fd, &sce->id, sce->nodetree); @@ -5608,6 +5608,13 @@ static void direct_link_sound(FileData *fd, bSound *sound) sound->handle = NULL; sound->playback_handle = NULL; + // versioning stuff, if there was a cache, then we enable caching: + if(sound->cache) + { + sound->flags |= SOUND_FLAGS_CACHING; + sound->cache = NULL; + } + sound->packedfile = direct_link_packedfile(fd, sound->packedfile); sound->newpackedfile = direct_link_packedfile(fd, sound->newpackedfile); } @@ -5623,9 +5630,6 @@ static void lib_link_sound(FileData *fd, Main *main) sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system sound_load(main, sound); - - if(sound->cache) - sound_cache_notifying(main, sound, 1); } sound= sound->id.next; } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index c6a3663d512..31d22f9dd54 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -118,7 +118,7 @@ static int open_exec(bContext *C, wmOperator *op) } if (RNA_boolean_get(op->ptr, "cache")) { - sound_cache(sound, 0); + sound_cache(sound); } /* hook into UI */ @@ -356,6 +356,8 @@ static void mixdown_draw(bContext *C, wmOperator *op) case AUD_CODEC_VORBIS: RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16); break; + default: + break; } break; @@ -382,6 +384,8 @@ static void mixdown_draw(bContext *C, wmOperator *op) RNA_def_property_enum_items(prop_codec, all_codec_items); RNA_enum_set(op->ptr, "codec", AUD_CODEC_PCM); break; + default: + break; } RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index b105b2507ab..54229a683a3 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -354,7 +354,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad } sort_seq(scene); - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 4252d051154..14dad30467f 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1228,7 +1228,7 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) } } - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1275,7 +1275,7 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) } } - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1901,7 +1901,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) } - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1965,7 +1965,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene); - seq_update_muting(scene, ed); + seq_update_muting(ed); seqbase_unique_name_recursive(&scene->ed->seqbase, seqm); @@ -2038,7 +2038,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) } sort_seq(scene); - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index 3e5f82a8052..56ad0e1ff84 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -106,7 +106,8 @@ typedef enum eSound_Type { #define SND_DRAWFRAMES 1 #define SND_CFRA_NUM 2 -#define SOUND_FLAGS_3D (1 << 3) +#define SOUND_FLAGS_3D (1 << 3) /* deprecated! used for sound actuator loading */ +#define SOUND_FLAGS_CACHING (1 << 4) /* to DNA_sound_types.h*/ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 170e590522d..6d0e9661e04 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -182,6 +182,7 @@ EnumPropertyItem image_type_items[] = { #include "BKE_mesh.h" #include "BKE_sound.h" #include "BKE_screen.h" +#include "BKE_sequencer.h" #include "BKE_animsys.h" #include "WM_api.h" @@ -335,6 +336,7 @@ static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { sound_update_fps(scene); + seq_update_sound_bounds_all(scene); } static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 0c889fd111f..6e18f955bf5 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -602,7 +602,7 @@ static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Editing *ed= seq_give_editing(scene, FALSE); - seq_update_muting(scene, ed); + seq_update_muting(ed); rna_Sequence_update(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index f471e5e0fe5..e78bc092040 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -49,14 +49,14 @@ static void rna_Sound_filepath_update(Main *bmain, Scene *UNUSED(scene), Pointer static int rna_Sound_caching_get(PointerRNA *ptr) { bSound *sound = (bSound*)(ptr->data); - return sound->cache != NULL; + return (sound->flags & SOUND_FLAGS_CACHING) != 0; } static void rna_Sound_caching_set(PointerRNA *ptr, const int value) { bSound *sound = (bSound*)(ptr->data); if(value) - sound_cache(sound, 0); + sound_cache(sound); else sound_delete_cache(sound); } diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index a3ea85b605c..3c766affe56 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -95,10 +95,6 @@ extern float BKE_screen_view3d_zoom_to_fac(float camzoom); #include "BKE_ipo.h" /***/ -#ifdef WITH_AUDASPACE -# include "AUD_C-API.h" -#endif - //XXX #include "BSE_headerbuttons.h" #include "BKE_context.h" #include "../../blender/windowmanager/WM_types.h" @@ -108,6 +104,11 @@ extern float BKE_screen_view3d_zoom_to_fac(float camzoom); } #endif +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +# include "AUD_I3DDevice.h" +# include "AUD_IDevice.h" +#endif static BlendFileData *load_game_data(char *filename) { @@ -394,9 +395,13 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext); // initialize 3D Audio Settings - AUD_setSpeedOfSound(scene->audio.speed_of_sound); - AUD_setDopplerFactor(scene->audio.doppler_factor); - AUD_setDistanceModel(AUD_DistanceModel(scene->audio.distance_model)); + AUD_I3DDevice* dev = AUD_get3DDevice(); + if(dev) + { + dev->setSpeedOfSound(scene->audio.speed_of_sound); + dev->setDopplerFactor(scene->audio.doppler_factor); + dev->setDistanceModel(AUD_DistanceModel(scene->audio.distance_model)); + } // from see blender.c: // FIXME: this version patching should really be part of the file-reading code, @@ -581,7 +586,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { delete canvas; canvas = NULL; - } + } + + // stop all remaining playing sounds + AUD_getDevice()->stopAll(); } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index a06e16b2f1d..7b9cba7770b 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -388,7 +388,7 @@ void BL_ConvertActuators(char* maggiename, { bSound* sound = soundact->sound; bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false; - AUD_Sound* snd_sound = NULL; + AUD_Reference snd_sound; KX_3DSoundSettings settings; settings.cone_inner_angle = soundact->sound3D.cone_inner_angle; settings.cone_outer_angle = soundact->sound3D.cone_outer_angle; @@ -406,7 +406,7 @@ void BL_ConvertActuators(char* maggiename, "\" has no sound datablock." << std::endl; } else - snd_sound = sound->playback_handle; + snd_sound = *reinterpret_cast*>(sound->playback_handle); KX_SoundActuator* tmpsoundact = new KX_SoundActuator(gameobj, snd_sound, diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index f10347e5473..73365860fce 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -251,6 +251,7 @@ endif() if(WITH_AUDASPACE) list(APPEND INC ../../../intern/audaspace/intern + ../../../intern/audaspace/FX ) add_definitions(-DWITH_AUDASPACE) endif() diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 651450f01bf..421e642a6df 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -70,6 +70,7 @@ #ifdef WITH_AUDASPACE # include "AUD_C-API.h" +# include "AUD_I3DDevice.h" #endif #include "NG_NetworkScene.h" @@ -995,16 +996,20 @@ void KX_KetsjiEngine::DoSound(KX_Scene* scene) if (!cam) return; - float f[4]; - - cam->NodeGetWorldPosition().getValue(f); - AUD_setListenerLocation(f); + AUD_I3DDevice* dev = AUD_get3DDevice(); + if(dev) + { + AUD_Vector3 v; + AUD_Quaternion q; + cam->NodeGetWorldPosition().getValue(v.get()); + dev->setListenerLocation(v); - cam->GetLinearVelocity().getValue(f); - AUD_setListenerVelocity(f); + cam->GetLinearVelocity().getValue(v.get()); + dev->setListenerVelocity(v); - cam->NodeGetWorldOrientation().getRotation().getValue(f); - AUD_setListenerOrientation(f); + cam->NodeGetWorldOrientation().getRotation().getValue(q.get()); + dev->setListenerOrientation(q); + } } diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 0f2597c336f..eb1a13f672d 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -39,6 +39,9 @@ #ifdef WITH_AUDASPACE # include "AUD_C-API.h" +# include "AUD_PingPongFactory.h" +# include "AUD_IDevice.h" +# include "AUD_I3DHandle.h" #endif #include "KX_GameObject.h" @@ -49,7 +52,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj, - AUD_Sound* sound, + AUD_Reference sound, float volume, float pitch, bool is3d, @@ -57,15 +60,11 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj, KX_SOUNDACT_TYPE type)//, : SCA_IActuator(gameobj, KX_ACT_SOUND) { - if(sound) - m_sound = AUD_copy(sound); - else - m_sound = NULL; + m_sound = sound; m_volume = volume; m_pitch = pitch; m_is3d = is3d; m_3d = settings; - m_handle = NULL; m_type = type; m_isplaying = false; } @@ -74,27 +73,20 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj, KX_SoundActuator::~KX_SoundActuator() { - if(m_handle) - AUD_stop(m_handle); - if(m_sound) - AUD_unload(m_sound); + if(!m_handle.isNull()) + m_handle->stop(); } void KX_SoundActuator::play() { - if(m_handle) - { - AUD_stop(m_handle); - m_handle = NULL; - } + if(!m_handle.isNull()) + m_handle->stop(); - if(!m_sound) + if(m_sound.isNull()) return; // this is the sound that will be played and not deleted afterwards - AUD_Sound* sound = m_sound; - // this sound is for temporary stacked sounds, will be deleted if not NULL - AUD_Sound* sound2 = NULL; + AUD_Reference sound = m_sound; bool loop = false; @@ -102,7 +94,7 @@ void KX_SoundActuator::play() { case KX_SOUNDACT_LOOPBIDIRECTIONAL: case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: - sound = sound2 = AUD_pingpongSound(sound); + sound = new AUD_PingPongFactory(sound); // fall through case KX_SOUNDACT_LOOPEND: case KX_SOUNDACT_LOOPSTOP: @@ -114,31 +106,27 @@ void KX_SoundActuator::play() break; } - m_handle = AUD_play(sound, 0); + m_handle = AUD_getDevice()->play(sound, 0); - if(sound2) - AUD_unload(sound2); + AUD_Reference handle3d = AUD_Reference(m_handle); - if(!m_handle) - return; - - if(m_is3d) + if(m_is3d && !handle3d.isNull()) { - AUD_setRelative(m_handle, false); - AUD_setVolumeMaximum(m_handle, m_3d.max_gain); - AUD_setVolumeMinimum(m_handle, m_3d.min_gain); - AUD_setDistanceReference(m_handle, m_3d.reference_distance); - AUD_setDistanceMaximum(m_handle, m_3d.max_distance); - AUD_setAttenuation(m_handle, m_3d.rolloff_factor); - AUD_setConeAngleInner(m_handle, m_3d.cone_inner_angle); - AUD_setConeAngleOuter(m_handle, m_3d.cone_outer_angle); - AUD_setConeVolumeOuter(m_handle, m_3d.cone_outer_gain); + handle3d->setRelative(false); + handle3d->setVolumeMaximum(m_3d.max_gain); + handle3d->setVolumeMinimum(m_3d.min_gain); + handle3d->setDistanceReference(m_3d.reference_distance); + handle3d->setDistanceMaximum(m_3d.max_distance); + handle3d->setAttenuation(m_3d.rolloff_factor); + handle3d->setConeAngleInner(m_3d.cone_inner_angle); + handle3d->setConeAngleOuter(m_3d.cone_outer_angle); + handle3d->setConeVolumeOuter(m_3d.cone_outer_gain); } if(loop) - AUD_setLoop(m_handle, -1); - AUD_setSoundPitch(m_handle, m_pitch); - AUD_setSoundVolume(m_handle, m_volume); + m_handle->setLoopCount(-1); + m_handle->setPitch(m_pitch); + m_handle->setVolume(m_volume); m_isplaying = true; } @@ -152,7 +140,7 @@ CValue* KX_SoundActuator::GetReplica() void KX_SoundActuator::ProcessReplica() { SCA_IActuator::ProcessReplica(); - m_handle = 0; + m_handle = AUD_Reference(); } bool KX_SoundActuator::Update(double curtime, bool frame) @@ -167,11 +155,11 @@ bool KX_SoundActuator::Update(double curtime, bool frame) RemoveAllEvents(); - if(!m_sound) + if(m_sound.isNull()) return false; // actual audio device playing state - bool isplaying = m_handle ? (AUD_getStatus(m_handle) == AUD_STATUS_PLAYING) : false; + bool isplaying = m_handle.isNull() ? false : (m_handle->getStatus() == AUD_STATUS_PLAYING); if (bNegativeEvent) { @@ -185,9 +173,9 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: { // stop immediately - if(m_handle) - AUD_stop(m_handle); - m_handle = NULL; + if(!m_handle.isNull()) + m_handle->stop(); + m_handle = AUD_Reference(); break; } case KX_SOUNDACT_PLAYEND: @@ -199,8 +187,8 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL: { // stop the looping so that the sound stops when it finished - if(m_handle) - AUD_setLoop(m_handle, 0); + if(!m_handle.isNull()) + m_handle->setLoopCount(0); break; } default: @@ -226,21 +214,24 @@ bool KX_SoundActuator::Update(double curtime, bool frame) play(); } // verify that the sound is still playing - isplaying = m_handle ? (AUD_getStatus(m_handle) == AUD_STATUS_PLAYING) : false; + isplaying = m_handle.isNull() ? false : (m_handle->getStatus() == AUD_STATUS_PLAYING); if (isplaying) { - if(m_is3d) + AUD_Reference handle3d = AUD_Reference(m_handle); + + if(m_is3d && !handle3d.isNull()) { KX_GameObject* obj = (KX_GameObject*)this->GetParent(); - float f[4]; - - obj->NodeGetWorldPosition().getValue(f); - AUD_setSourceLocation(m_handle, f); - obj->GetLinearVelocity().getValue(f); - AUD_setSourceVelocity(m_handle, f); - obj->NodeGetWorldOrientation().getRotation().getValue(f); - AUD_setSourceOrientation(m_handle, f); + AUD_Vector3 v; + AUD_Quaternion q; + + obj->NodeGetWorldPosition().getValue(v.get()); + handle3d->setSourceLocation(v); + obj->GetLinearVelocity().getValue(v.get()); + handle3d->setSourceVelocity(v); + obj->NodeGetWorldOrientation().getRotation().getValue(q.get()); + handle3d->setSourceOrientation(q); } result = true; } @@ -252,7 +243,6 @@ bool KX_SoundActuator::Update(double curtime, bool frame) return result; } - #ifdef WITH_PYTHON /* ------------------------------------------------------------------------- */ @@ -315,14 +305,14 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, startSound, "startSound()\n" "\tStarts the sound.\n") { - if(m_handle) + if(!m_handle.isNull()) { - switch(AUD_getStatus(m_handle)) + switch(m_handle->getStatus()) { case AUD_STATUS_PLAYING: break; case AUD_STATUS_PAUSED: - AUD_resume(m_handle); + m_handle->resume(); break; default: play(); @@ -335,8 +325,8 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, pauseSound, "pauseSound()\n" "\tPauses the sound.\n") { - if(m_handle) - AUD_pause(m_handle); + if(!m_handle.isNull()) + m_handle->pause(); Py_RETURN_NONE; } @@ -344,9 +334,9 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound, "stopSound()\n" "\tStops the sound.\n") { - if(m_handle) - AUD_stop(m_handle); - m_handle = NULL; + if(!m_handle.isNull()) + m_handle->stop(); + m_handle = AUD_Reference(); Py_RETURN_NONE; } @@ -394,8 +384,8 @@ PyObject* KX_SoundActuator::pyattr_get_audposition(void *self, const struct KX_P KX_SoundActuator * actuator = static_cast (self); float position = 0.0; - if(actuator->m_handle) - position = AUD_getPosition(actuator->m_handle); + if(!actuator->m_handle.isNull()) + position = actuator->m_handle->getPosition(); PyObject* result = PyFloat_FromDouble(position); @@ -425,8 +415,8 @@ PyObject* KX_SoundActuator::pyattr_get_pitch(void *self, const struct KX_PYATTRI PyObject* KX_SoundActuator::pyattr_get_sound(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) { KX_SoundActuator * actuator = static_cast (self); - if(actuator->m_sound) - return AUD_getPythonFactory(actuator->m_sound); + if(!actuator->m_sound.isNull()) + return AUD_getPythonFactory(&actuator->m_sound); else Py_RETURN_NONE; } @@ -440,49 +430,50 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI if (!PyArg_Parse(value, "f", &prop_value)) return PY_SET_ATTR_FAIL; + AUD_Reference handle3d = AUD_Reference(actuator->m_handle); // if sound is working and 3D, set the new setting if(!actuator->m_is3d) return PY_SET_ATTR_FAIL; if(!strcmp(prop, "volume_maximum")) { actuator->m_3d.max_gain = prop_value; - if(actuator->m_handle) - AUD_setVolumeMaximum(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setVolumeMaximum(prop_value); } else if (!strcmp(prop, "volume_minimum")) { actuator->m_3d.min_gain = prop_value; - if(actuator->m_handle) - AUD_setVolumeMinimum(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setVolumeMinimum(prop_value); } else if (!strcmp(prop, "distance_reference")) { actuator->m_3d.reference_distance = prop_value; - if(actuator->m_handle) - AUD_setDistanceReference(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setDistanceReference(prop_value); } else if (!strcmp(prop, "distance_maximum")) { actuator->m_3d.max_distance = prop_value; - if(actuator->m_handle) - AUD_setDistanceMaximum(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setDistanceMaximum(prop_value); } else if (!strcmp(prop, "attenuation")) { actuator->m_3d.rolloff_factor = prop_value; - if(actuator->m_handle) - AUD_setAttenuation(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setAttenuation(prop_value); } else if (!!strcmp(prop, "cone_angle_inner")) { actuator->m_3d.cone_inner_angle = prop_value; - if(actuator->m_handle) - AUD_setConeAngleInner(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setConeAngleInner(prop_value); } else if (!strcmp(prop, "cone_angle_outer")) { actuator->m_3d.cone_outer_angle = prop_value; - if(actuator->m_handle) - AUD_setConeAngleOuter(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setConeAngleOuter(prop_value); } else if (!strcmp(prop, "cone_volume_outer")) { actuator->m_3d.cone_outer_gain = prop_value; - if(actuator->m_handle) - AUD_setConeVolumeOuter(actuator->m_handle, prop_value); + if(!handle3d.isNull()) + handle3d->setConeVolumeOuter(prop_value); } else { return PY_SET_ATTR_FAIL; @@ -499,8 +490,8 @@ int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRI if (!PyArg_Parse(value, "f", &position)) return PY_SET_ATTR_FAIL; - if(actuator->m_handle) - AUD_seek(actuator->m_handle, position); + if(!actuator->m_handle.isNull()) + actuator->m_handle->seek(position); return PY_SET_ATTR_SUCCESS; } @@ -512,8 +503,8 @@ int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DE return PY_SET_ATTR_FAIL; actuator->m_volume = gain; - if(actuator->m_handle) - AUD_setSoundVolume(actuator->m_handle, gain); + if(!actuator->m_handle.isNull()) + actuator->m_handle->setVolume(gain); return PY_SET_ATTR_SUCCESS; } @@ -526,8 +517,8 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D return PY_SET_ATTR_FAIL; actuator->m_pitch = pitch; - if(actuator->m_handle) - AUD_setSoundPitch(actuator->m_handle, pitch); + if(!actuator->m_handle.isNull()) + actuator->m_handle->setPitch(pitch); return PY_SET_ATTR_SUCCESS; } @@ -539,12 +530,11 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D if (!PyArg_Parse(value, "O", &sound)) return PY_SET_ATTR_FAIL; - AUD_Sound* snd = AUD_getPythonSound(sound); + AUD_Reference* snd = reinterpret_cast*>(AUD_getPythonSound(sound)); if(snd) { - if(actuator->m_sound) - AUD_unload(actuator->m_sound); - actuator->m_sound = snd; + actuator->m_sound = *snd; + delete snd; return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h index 395064b66be..b1161e0cad2 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.h +++ b/source/gameengine/Ketsji/KX_SoundActuator.h @@ -38,6 +38,9 @@ #ifdef WITH_AUDASPACE # include "AUD_C-API.h" +# include "AUD_Reference.h" +# include "AUD_IFactory.h" +# include "AUD_IHandle.h" #endif #include "BKE_sound.h" @@ -58,12 +61,12 @@ class KX_SoundActuator : public SCA_IActuator { Py_Header; bool m_isplaying; - AUD_Sound* m_sound; + AUD_Reference m_sound; float m_volume; float m_pitch; bool m_is3d; KX_3DSoundSettings m_3d; - AUD_Handle* m_handle; + AUD_Reference m_handle; void play(); @@ -84,7 +87,7 @@ public: KX_SOUNDACT_TYPE m_type; KX_SoundActuator(SCA_IObject* gameobj, - AUD_Sound* sound, + AUD_Reference sound, float volume, float pitch, bool is3d, diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 4eb9ee8b3f0..c5509dd7de8 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -11,7 +11,7 @@ incs += ' #source/blender/python/mathutils' # Only for mathutils, be very carefu incs += ' #intern/string #intern/guardedalloc #intern/container' incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer' -incs += ' #intern/audaspace/intern #source/gameengine/Converter' +incs += ' #intern/audaspace/intern #intern/audaspace/FX #source/gameengine/Converter' incs += ' #source/gameengine/BlenderRoutines #source/blender/imbuf #intern/moto/include' incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/blender/blenlib #source/blender/blenfont' incs += ' #source/blender/blenkernel #source/blender #source/blender/editors/include' -- cgit v1.2.3 From 022e815fbd6d81f9b1baa177cce1abf2f42bcb21 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 7 Aug 2011 12:27:20 +0000 Subject: Sound clip NLA Strips for Nexyon These are basically just for specifying when a speaker should fire off it's soundclip, and as such, many NLA operations are irrelevant for it. They can only be specified on object-level for speaker objects. I've still got some UI tweaks I'll need to work on in order for these to be able to be added even when the speaker doesn't have any NLA tracks yet. (EDIT: while typing this, I had an idea for how to do this, but that'll be for next commit). In the mean time, you'll need to add a single keyframe for the object, snowflake that action and delete the NLA strip before you can start editing. --- source/blender/blenkernel/BKE_nla.h | 3 + source/blender/blenkernel/intern/anim_sys.c | 3 + source/blender/blenkernel/intern/nla.c | 40 +++++++++++ source/blender/editors/animation/anim_filter.c | 3 +- source/blender/editors/space_nla/nla_buttons.c | 80 +++++++++++++++------- source/blender/editors/space_nla/nla_draw.c | 19 +++++- source/blender/editors/space_nla/nla_edit.c | 95 +++++++++++++++++++++++++- source/blender/editors/space_nla/nla_intern.h | 1 + source/blender/editors/space_nla/nla_ops.c | 2 + source/blender/makesdna/DNA_anim_types.h | 5 +- source/blender/makesrna/intern/rna_nla.c | 2 +- 11 files changed, 222 insertions(+), 31 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 0206756a1ad..49c1f8acd24 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -39,6 +39,8 @@ struct AnimData; struct NlaStrip; struct NlaTrack; struct bAction; +struct Scene; +struct Speaker; /* ----------------------------- */ /* Data Management */ @@ -54,6 +56,7 @@ void copy_nladata(ListBase *dst, ListBase *src); struct NlaTrack *add_nlatrack(struct AnimData *adt, struct NlaTrack *prev); struct NlaStrip *add_nlastrip(struct bAction *act); struct NlaStrip *add_nlastrip_to_stack(struct AnimData *adt, struct bAction *act); +struct NlaStrip *add_nla_soundstrip(struct Scene *scene, struct Speaker *spk); /* ----------------------------- */ /* API */ diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index a43cdc8143e..832d13c9c2f 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1921,6 +1921,9 @@ void nlastrip_evaluate (PointerRNA *ptr, ListBase *channels, ListBase *modifiers case NLASTRIP_TYPE_META: /* meta */ nlastrip_evaluate_meta(ptr, channels, modifiers, nes); break; + + default: /* do nothing */ + break; } /* clear temp recursion safe-check */ diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index f2ce8e4e6f1..dad49646622 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -46,6 +46,8 @@ #include "DNA_anim_types.h" #include "DNA_scene_types.h" +#include "DNA_sound_types.h" +#include "DNA_speaker_types.h" #include "BKE_action.h" #include "BKE_fcurve.h" @@ -53,6 +55,9 @@ #include "BKE_global.h" #include "BKE_library.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #include "RNA_access.h" #include "nla_private.h" @@ -337,6 +342,41 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act) return strip; } +/* Add a NLA Strip referencing the given speaker's sound */ +NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker) +{ + NlaStrip *strip = MEM_callocN(sizeof(NlaStrip), "NlaSoundStrip"); + + /* if speaker has a sound, set the strip length to the length of the sound, + * otherwise default to length of 10 frames + */ +#ifdef WITH_AUDASPACE + if (speaker->sound) + { + AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle); + + strip->end = ceil(info.length * FPS); + } + else +#endif + { + strip->end = 10.0f; + } + + /* general settings */ + strip->type = NLASTRIP_TYPE_SOUND; + + strip->flag = NLASTRIP_FLAG_SELECT; + strip->extendmode = NLASTRIP_EXTEND_NOTHING; /* nothing to extend... */ + + /* strip should be referenced as-is */ + strip->scale= 1.0f; + strip->repeat = 1.0f; + + /* return this strip */ + return strip; +} + /* *************************************************** */ /* NLA Evaluation <-> Editing Stuff */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 4927b0f097a..b4d1253c764 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -397,6 +397,7 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) * 2A) nla tracks: include animdata block's data as there are NLA tracks+strips there * 2B) actions to convert to nla: include animdata block's data as there is an action that can be * converted to a new NLA strip, and the filtering options allow this + * 2C) allow non-animated datablocks to be included so that datablocks can be added * 3) drivers: include drivers from animdata block (for Drivers mode in Graph Editor) * 4) normal keyframes: only when there is an active action */ @@ -1625,7 +1626,7 @@ static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data, case OB_SPEAKER: /* ---------- Speaker ----------- */ { Speaker *spk= (Speaker *)ob->data; - + type= ANIMTYPE_DSSPK; expanded= FILTER_SPK_OBJD(spk); } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index b6de8e7fb59..0f0662d84b1 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -213,6 +213,24 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt) return (strip->type == NLASTRIP_TYPE_CLIP); } +static int nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + PointerRNA ptr; + NlaStrip *strip; + + if (!nla_panel_context(C, NULL, NULL, &ptr)) + return 0; + if (ptr.data == NULL) + return 0; + + strip= ptr.data; + + if (strip->type == NLASTRIP_TYPE_SOUND) + return 0; + + return 1; +} + /* -------------- */ /* active AnimData */ @@ -278,6 +296,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa) uiLayout *layout= pa->layout; uiLayout *column, *row, *subcol; uiBlock *block; + short showEvalProps = 1; if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) return; @@ -297,32 +316,41 @@ static void nla_panel_properties(const bContext *C, Panel *pa) uiItemR(column, &strip_ptr, "frame_start", 0, NULL, ICON_NONE); uiItemR(column, &strip_ptr, "frame_end", 0, NULL, ICON_NONE); - /* extrapolation */ - row= uiLayoutRow(layout, 1); - uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE); + /* Evaluation-Related Strip Properties ------------------ */ - /* blending */ - row= uiLayoutRow(layout, 1); - uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE); - - /* blend in/out + autoblending - * - blend in/out can only be set when autoblending is off - */ - column= uiLayoutColumn(layout, 1); - uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0); - uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle? - - subcol= uiLayoutColumn(column, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); - uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); - uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); + /* sound properties strips don't have these settings */ + if (RNA_enum_get(&strip_ptr, "type") == NLASTRIP_TYPE_SOUND) + showEvalProps = 0; + + /* only show if allowed to... */ + if (showEvalProps) { + /* extrapolation */ + row= uiLayoutRow(layout, 1); + uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE); - /* settings */ - column= uiLayoutColumn(layout, 1); - uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time"))); - uiItemL(column, "Playback Settings:", ICON_NONE); - uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE); - uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NONE); + /* blending */ + row= uiLayoutRow(layout, 1); + uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE); + + /* blend in/out + autoblending + * - blend in/out can only be set when autoblending is off + */ + column= uiLayoutColumn(layout, 1); + uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0); + uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle? + + subcol= uiLayoutColumn(column, 1); + uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); + uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); + uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); + + /* settings */ + column= uiLayoutColumn(layout, 1); + uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time"))); + uiItemL(column, "Playback Settings:", ICON_NONE); + uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE); + uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NONE); + } } @@ -476,14 +504,14 @@ void nla_buttons_register(ARegionType *art) strcpy(pt->idname, "NLA_PT_evaluation"); strcpy(pt->label, "Evaluation"); pt->draw= nla_panel_evaluation; - pt->poll= nla_strip_panel_poll; + pt->poll= nla_strip_eval_panel_poll; BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel modifiers"); strcpy(pt->idname, "NLA_PT_modifiers"); strcpy(pt->label, "Modifiers"); pt->draw= nla_panel_modifiers; - pt->poll= nla_strip_panel_poll; + pt->poll= nla_strip_eval_panel_poll; BLI_addtail(&art->paneltypes, pt); } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index bc0b9616836..eb9529b5186 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -198,7 +198,24 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co color[1]= 0.15f; color[2]= 0.26f; } - } + } + else if (strip->type == NLASTRIP_TYPE_SOUND) { + /* Sound Clip */ + if (strip->flag & NLASTRIP_FLAG_SELECT) { + /* selected - use a bright teal color */ + // FIXME: hardcoded temp-hack colors + color[0]= 0.12f; + color[1]= 0.48f; + color[2]= 0.48f; + } + else { + /* normal, unselected strip - use (hardly noticable) teal tinge */ + // FIXME: hardcoded temp-hack colors + color[0]= 0.17f; + color[1]= 0.24f; + color[2]= 0.24f; + } + } else { /* Action Clip (default/normal type of strip) */ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) && (adt && (adt->flag & ADT_NLA_EDIT_ON))) { diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index eb22495c977..fa24bd2f895 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -36,6 +36,7 @@ #include #include "DNA_anim_types.h" +#include "DNA_object_types.h" #include "DNA_scene_types.h" #include "MEM_guardedalloc.h" @@ -536,12 +537,15 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op) /* check if there's space between the two */ if (IS_EQ(s1->end, s2->start)) continue; - /* make neither one is a transition + /* make sure neither one is a transition * - although this is impossible to create with the standard tools, * the user may have altered the settings */ if (ELEM(NLASTRIP_TYPE_TRANSITION, s1->type, s2->type)) continue; + /* also make sure neither one is a soundclip */ + if (ELEM(NLASTRIP_TYPE_SOUND, s1->type, s2->type)) + continue; /* allocate new strip */ strip= MEM_callocN(sizeof(NlaStrip), "NlaStrip"); @@ -608,6 +612,91 @@ void NLA_OT_transition_add (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/* ******************** Add Sound Clip Operator ***************************** */ +/* Add a new sound clip */ + +static int nlaedit_add_sound_exec (bContext *C, wmOperator *op) +{ + bAnimContext ac; + + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + Scene *scene; + int cfra; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + scene = ac.scene; + cfra = CFRA; + + /* get a list of the editable tracks being shown in the NLA */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* for each track, add sound clips if it belongs to a speaker */ + // TODO: what happens if there aren't any tracks... well that's a more general problem for later + for (ale= anim_data.first; ale; ale= ale->next) { + Object *ob = (Object *)ale->id; /* may not be object until we actually check! */ + + AnimData *adt = ale->adt; + NlaTrack *nlt= (NlaTrack *)ale->data; + NlaStrip *strip; + + /* does this belong to speaker - assumed to live on Object level only */ + if ((GS(ale->id->name) != ID_OB) || (ob->type != OB_SPEAKER)) + continue; + + /* create a new strip, and offset it to start on the current frame */ + strip= add_nla_soundstrip(ac.scene, ob->data); + + strip->start += cfra; + strip->end += cfra; + + /* firstly try adding strip to our current track, but if that fails, add to a new track */ + if (BKE_nlatrack_add_strip(nlt, strip) == 0) { + /* trying to add to the current failed (no space), + * so add a new track to the stack, and add to that... + */ + nlt= add_nlatrack(adt, NULL); + BKE_nlatrack_add_strip(nlt, strip); + } + + /* auto-name it */ + BKE_nlastrip_validate_name(adt, strip); + } + + /* free temp data */ + BLI_freelistN(&anim_data); + + /* refresh auto strip properties */ + ED_nla_postop_refresh(&ac); + + /* set notifier that things have changed */ + WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL); + + /* done */ + return OPERATOR_FINISHED; +} + +void NLA_OT_soundclip_add (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add Sound Clip"; + ot->idname= "NLA_OT_soundclip_add"; + ot->description= "Add a strip for controlling when speaker plays its sound clip"; + + /* api callbacks */ + ot->exec= nlaedit_add_sound_exec; + ot->poll= nlaop_poll_tweakmode_off; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* ******************** Add Meta-Strip Operator ***************************** */ /* Add new meta-strips incorporating the selected strips */ @@ -1923,6 +2012,10 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) continue; } + /* sound clips are not affected by FModifiers */ + if (strip->type == NLASTRIP_TYPE_SOUND) + continue; + /* add F-Modifier of specified type to selected, and make it the active one */ fcm= add_fmodifier(&strip->modifiers, type); diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 43ef5beb216..bd76d2484dd 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -99,6 +99,7 @@ void NLA_OT_view_selected(wmOperatorType *ot); void NLA_OT_actionclip_add(wmOperatorType *ot); void NLA_OT_transition_add(wmOperatorType *ot); +void NLA_OT_soundclip_add(wmOperatorType *ot); void NLA_OT_meta_add(wmOperatorType *ot); void NLA_OT_meta_remove(wmOperatorType *ot); diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 38e12c46060..8ed117755c7 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -140,6 +140,7 @@ void nla_operatortypes(void) WM_operatortype_append(NLA_OT_actionclip_add); WM_operatortype_append(NLA_OT_transition_add); + WM_operatortype_append(NLA_OT_soundclip_add); WM_operatortype_append(NLA_OT_meta_add); WM_operatortype_append(NLA_OT_meta_remove); @@ -233,6 +234,7 @@ static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap) /* add strips */ WM_keymap_add_item(keymap, "NLA_OT_actionclip_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "NLA_OT_transition_add", TKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "NLA_OT_soundclip_add", KKEY, KM_PRESS, KM_SHIFT, 0); /* meta-strips */ WM_keymap_add_item(keymap, "NLA_OT_meta_add", GKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 374799ecf08..5a031e04fe4 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -651,7 +651,10 @@ typedef enum eNlaStrip_Type { /* 'transition' - blends between the adjacent strips */ NLASTRIP_TYPE_TRANSITION, /* 'meta' - a strip which acts as a container for a few others */ - NLASTRIP_TYPE_META + NLASTRIP_TYPE_META, + + /* 'emit sound' - a strip which is used for timing when speaker emits sounds */ + NLASTRIP_TYPE_SOUND } eNlaStrip_Type; /* NLA Tracks ------------------------------------- */ diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 01bfbc0e133..5756044d12b 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -380,6 +380,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) {NLASTRIP_TYPE_CLIP, "CLIP", 0, "Action Clip", "NLA Strip references some Action"}, {NLASTRIP_TYPE_TRANSITION, "TRANSITION", 0, "Transition", "NLA Strip 'transitions' between adjacent strips"}, {NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips"}, + {NLASTRIP_TYPE_SOUND, "SOUND", 0, "Sound Clip", "NLA Strip representing a sound event for speakers"}, {0, NULL, 0, NULL, NULL}}; /* struct definition */ @@ -447,7 +448,6 @@ static void rna_def_nlastrip(BlenderRNA *brna) RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */ /* Action */ - // TODO: this should only be editable if it is not being edited atm... prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll"); -- cgit v1.2.3 From b057cf1bb118a070e2eeb3b2029aa80fad00a9b2 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 7 Aug 2011 12:43:44 +0000 Subject: Nla Sound Strips + Add Speaker Second part of previous commit. Now, when speaker objects are created, they are created by default with an NLA sound strip so that it is easy to just start immediately using this to do cool stuff (i.e. timing when you want the sound to start). --- source/blender/editors/object/object_add.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source') diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 22e6a5243c7..97d109118d1 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -35,6 +35,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_anim_types.h" #include "DNA_curve_types.h" #include "DNA_group_types.h" #include "DNA_lamp_types.h" @@ -69,6 +70,7 @@ #include "BKE_mball.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_nla.h" #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_report.h" @@ -778,6 +780,25 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; ob= ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer); + + /* to make it easier to start using this immediately in NLA, a default sound clip is created + * ready to be moved around to retime the sound and/or make new sound clips + */ + { + /* create new data for NLA hierarchy */ + AnimData *adt = BKE_id_add_animdata(&ob->id); + NlaTrack *nlt = add_nlatrack(adt, NULL); + NlaStrip *strip = add_nla_soundstrip(CTX_data_scene(C), ob->data); + + /* hook them up */ + BKE_nlatrack_add_strip(nlt, strip); + + /* auto-name the strip, and give the track an interesting name */ + strcpy(nlt->name, "SoundTrack"); + BKE_nlastrip_validate_name(adt, strip); + + WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL); + } return OPERATOR_FINISHED; } -- cgit v1.2.3 From c095397c988cd2ef6a956ce2742814ea2d3e7f0d Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 7 Aug 2011 18:15:40 +0000 Subject: Armature bake animation export ( not as pose matrices. Still needs fixing ) --- source/blender/collada/AnimationExporter.cpp | 21 ++++++++++++++++++++- source/blender/collada/AnimationExporter.h | 1 + source/blender/collada/AnimationImporter.cpp | 7 +++++++ source/blender/collada/AnimationImporter.h | 3 ++- 4 files changed, 30 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 53f3cc9aae3..b1b26fa2915 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -367,7 +367,7 @@ void AnimationExporter::exportAnimations(Scene *sce) if (!pchan) return; - find_all_frames(ob_arm, fra); + find_frames(ob_arm, fra); if (flag & ARM_RESTPOS) { arm->flag &= ~ARM_RESTPOS; @@ -1119,6 +1119,25 @@ void AnimationExporter::exportAnimations(Scene *sce) return; } + + void AnimationExporter::find_frames(Object *ob, std::vector &fra) + { + FCurve *fcu= (FCurve*)ob->adt->action->curves.first; + + for (; fcu; fcu = fcu->next) { + + for (unsigned int i = 0; i < fcu->totvert; i++) { + float f = fcu->bezt[i].vec[1][0]; // + if (std::find(fra.begin(), fra.end(), f) == fra.end()) + fra.push_back(f); + } + } + + // keep the keys in ascending order + std::sort(fra.begin(), fra.end()); + } + + void AnimationExporter::find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name) { FCurve *fcu= (FCurve*)ob->adt->action->curves.first; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index cadd6940e9d..d4559782ff4 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -144,6 +144,7 @@ protected: std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); void find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name); + void find_frames(Object *ob, std::vector &fra); void find_all_frames(Object *ob, std::vector &fra); diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 8ae2d6970cd..0fc01e51020 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -929,6 +929,12 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , Assign_float_animations( listid, AnimCurves , "specular_hardness" ); } + if((animType->material & MATERIAL_IOR) != 0){ + const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction()); + const COLLADAFW::UniqueId& listid = ior->getAnimationList(); + Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" ); + } + if((animType->material & MATERIAL_SPEC_COLOR) != 0){ const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular()); const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); @@ -1010,6 +1016,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); + types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); } } return types; diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 02b7b05afec..ea7de961382 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -111,7 +111,8 @@ private: MATERIAL_SHININESS = 2, MATERIAL_SPEC_COLOR = 4, MATERIAL_DIFF_COLOR = 1 << 3, - MATERIAL_TRANSPARENCY = 1 << 4 + MATERIAL_TRANSPARENCY = 1 << 4, + MATERIAL_IOR = 1 << 5 }; enum AnimationType -- cgit v1.2.3 From 3aa0953d95e43296e756f9763144c8c127be5ca5 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 7 Aug 2011 19:22:39 +0000 Subject: COLLADA Armature bake animation export fixed( needs more testing ) --- source/blender/collada/AnimationExporter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index b1b26fa2915..fc13207dd2e 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -382,6 +382,10 @@ void AnimationExporter::exportAnimations(Scene *sce) dae_baked_animation(fra ,values, id_name(ob_arm), bone->name ); } + + if (flag & ARM_RESTPOS) + arm->flag = flag; + where_is_pose(scene, ob_arm); } void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) @@ -458,7 +462,7 @@ void AnimationExporter::exportAnimations(Scene *sce) return; parchan = pchan->parent; - + enable_fcurves(ob_arm->adt->action, bone->name); std::vector::iterator it; -- cgit v1.2.3 From a8096ef0acb780d5a6d93aef422ce3d82877a60c Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 7 Aug 2011 19:32:22 +0000 Subject: Updating CMake to install the correct ffmpeg libs. --- source/creator/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 43fec85b5bf..da08547e803 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -547,11 +547,11 @@ elseif(WIN32) if(WITH_CODEC_FFMPEG) install( FILES - ${LIBDIR}/ffmpeg/lib/avcodec-52.dll - ${LIBDIR}/ffmpeg/lib/avformat-52.dll - ${LIBDIR}/ffmpeg/lib/avdevice-52.dll - ${LIBDIR}/ffmpeg/lib/avutil-50.dll - ${LIBDIR}/ffmpeg/lib/swscale-0.dll + ${LIBDIR}/ffmpeg-0.8/lib/avcodec-53.dll + ${LIBDIR}/ffmpeg-0.8/lib/avformat-53.dll + ${LIBDIR}/ffmpeg-0.8/lib/avdevice-53.dll + ${LIBDIR}/ffmpeg-0.8/lib/avutil-51.dll + ${LIBDIR}/ffmpeg-0.8/lib/swscale-2.dll DESTINATION ${TARGETDIR} ) -- cgit v1.2.3 From 8883702f8a3b57d0316811e9412bd46ce0dd9c0d Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 8 Aug 2011 04:28:30 +0000 Subject: BGE Animations: Various compatibility fixes: * Blendin for Loop End works even after a negative pulse. Flipper could still use some work in this area. * Continuous works a lot better. * BL_Action::SetFrame() should work a little smoother. --- source/gameengine/Converter/BL_ActionActuator.cpp | 18 +++++----- source/gameengine/Ketsji/BL_Action.cpp | 43 ++++++++++++++++------- source/gameengine/Ketsji/BL_Action.h | 4 +++ source/gameengine/Ketsji/BL_ActionManager.cpp | 12 +++++++ source/gameengine/Ketsji/BL_ActionManager.h | 10 ++++++ source/gameengine/Ketsji/KX_GameObject.cpp | 10 ++++++ source/gameengine/Ketsji/KX_GameObject.h | 10 ++++++ 7 files changed, 86 insertions(+), 21 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 0932493ccb8..8efcdd8c551 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -139,6 +139,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) { bool bNegativeEvent = false; bool bPositiveEvent = false; + bool use_continue = false; KX_GameObject *obj = (KX_GameObject*)GetParent(); short play_mode = BL_Action::ACT_MODE_PLAY; float start = m_startframe, end = m_endframe; @@ -172,6 +173,10 @@ bool BL_ActionActuator::Update(double curtime, bool frame) play_mode = BL_Action::ACT_MODE_PLAY; start = end = prop->GetNumber(); } + + // Continue only really makes sense for play stop. All other modes go until they are complete. + if (m_flag & ACT_FLAG_CONTINUE && m_playtype == ACT_ACTION_LOOP_STOP) + use_continue = true; // Handle events @@ -184,14 +189,10 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (bPositiveEvent) { - - if (m_playtype != ACT_ACTION_PINGPONG && m_flag & ACT_FLAG_ACTIVE && m_flag & ACT_FLAG_CONTINUE) - start = m_localtime = obj->GetActionFrame(m_layer); - if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, m_layer_weight, m_ipo_flags)) { m_flag |= ACT_FLAG_ACTIVE; - if (m_playtype != ACT_ACTION_PINGPONG && m_flag & ACT_FLAG_CONTINUE) + if (use_continue) obj->SetActionFrame(m_layer, m_localtime); if (m_playtype == ACT_ACTION_PLAY) @@ -217,6 +218,8 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (m_playtype == ACT_ACTION_LOOP_STOP) { 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; obj->StopAction(m_layer); // Stop the action after getting the frame // We're done @@ -226,9 +229,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) else if (m_playtype == ACT_ACTION_LOOP_END || m_playtype == ACT_ACTION_PINGPONG) { // Convert into a play and let it finish - start = obj->GetActionFrame(m_layer); - obj->StopAction(m_layer); - obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags); + obj->SetPlayMode(m_layer, BL_Action::ACT_MODE_PLAY); m_flag |= ACT_FLAG_PLAY_END; @@ -240,7 +241,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) // Convert into a play action and play back to the beginning end = start; start = obj->GetActionFrame(m_layer); - obj->StopAction(m_layer); obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags); m_flag |= ACT_FLAG_PLAY_END; diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index caffd3cd8ca..4cf6f982006 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -67,7 +67,8 @@ BL_Action::BL_Action(class KX_GameObject* gameobj) m_priority(0), m_playmode(0), m_ipo_flags(0), - m_done(true) + m_done(true), + m_calc_localtime(true) { if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) { @@ -215,24 +216,25 @@ float BL_Action::GetFrame() void BL_Action::SetFrame(float frame) { - float dt; - // Clamp the frame to the start and end frame if (frame < min(m_startframe, m_endframe)) frame = min(m_startframe, m_endframe); else if (frame > max(m_startframe, m_endframe)) frame = max(m_startframe, m_endframe); - // We don't set m_localtime directly since it's recalculated - // in the next update. So, we modify the value (m_starttime) - // used to calculate m_localtime the next time SetLocalTime() is called. - - dt = frame-m_startframe; + m_localtime = frame; + m_calc_localtime = false; +} - if (m_endframe < m_startframe) - dt = -dt; +void BL_Action::SetPlayMode(short play_mode) +{ + m_playmode = play_mode; +} - m_starttime -= dt / (KX_KetsjiEngine::GetAnimFrameRate()*m_speed); +void BL_Action::SetTimes(float start, float end) +{ + m_startframe = start; + m_endframe = end; } void BL_Action::SetLocalTime(float curtime) @@ -245,6 +247,16 @@ void BL_Action::SetLocalTime(float curtime) m_localtime = m_startframe + dt; } +void BL_Action::ResetStartTime(float curtime) +{ + float dt = m_localtime - m_startframe; + + m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate()*m_speed); + printf("Before: %f, ", m_localtime); + SetLocalTime(curtime); + printf("After: %f\n", m_localtime); +} + void BL_Action::IncrementBlending(float curtime) { // Setup m_blendstart if we need to @@ -285,7 +297,14 @@ void BL_Action::Update(float curtime) return; curtime -= KX_KetsjiEngine::GetSuspendedDelta(); - SetLocalTime(curtime); + + if (m_calc_localtime) + SetLocalTime(curtime); + else + { + ResetStartTime(curtime); + m_calc_localtime = true; + } // Handle wrap around if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) diff --git a/source/gameengine/Ketsji/BL_Action.h b/source/gameengine/Ketsji/BL_Action.h index 14312e158c0..75bda56419a 100644 --- a/source/gameengine/Ketsji/BL_Action.h +++ b/source/gameengine/Ketsji/BL_Action.h @@ -71,9 +71,11 @@ private: short m_ipo_flags; bool m_done; + bool m_calc_localtime; void InitIPO(); void SetLocalTime(float curtime); + void ResetStartTime(float curtime); void IncrementBlending(float curtime); void BlendShape(struct Key* key, float srcweight, std::vector& blendshape); public: @@ -111,6 +113,8 @@ public: // Mutators void SetFrame(float frame); + void SetPlayMode(short play_mode); + void SetTimes(float start, float end); enum { diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp index 2ee0b58574a..af0d4bff8f0 100644 --- a/source/gameengine/Ketsji/BL_ActionManager.cpp +++ b/source/gameengine/Ketsji/BL_ActionManager.cpp @@ -63,6 +63,18 @@ struct bAction *BL_ActionManager::GetCurrentAction(short layer) return 0; } +void BL_ActionManager::SetPlayMode(short layer, short mode) +{ + if (m_layers[layer]) + m_layers[layer]->SetPlayMode(mode); +} + +void BL_ActionManager::SetTimes(short layer, float start, float end) +{ + if (m_layers[layer]) + m_layers[layer]->SetTimes(start, end); +} + bool BL_ActionManager::PlayAction(const char* name, float start, float end, diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h index 3818f643b1c..c310e231ed7 100644 --- a/source/gameengine/Ketsji/BL_ActionManager.h +++ b/source/gameengine/Ketsji/BL_ActionManager.h @@ -70,6 +70,16 @@ public: */ struct bAction *GetCurrentAction(short layer); + /** + * Sets play mode of the action on the given layer + */ + void SetPlayMode(short layer, short mode); + + /** + * Sets the start and end times of the action on the given layer + */ + void SetTimes(short layer, float start, float end); + /** * Stop playing the action on the given layer */ diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 91e62442646..4f8860f4767 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -404,6 +404,16 @@ bAction *KX_GameObject::GetCurrentAction(short layer) return GetActionManager()->GetCurrentAction(layer); } +void KX_GameObject::SetPlayMode(short layer, short mode) +{ + GetActionManager()->SetPlayMode(layer, mode); +} + +void KX_GameObject::SetTimes(short layer, float start, float end) +{ + GetActionManager()->SetTimes(layer, start, end); +} + void KX_GameObject::ProcessReplica() { SCA_IObject::ProcessReplica(); diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 40bd86fed1b..6e79914172b 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -238,6 +238,16 @@ public: */ bAction *GetCurrentAction(short layer); + /** + * Sets play mode of the action on the given layer + */ + void SetPlayMode(short layer, short mode); + + /** + * Sets the start and end times of the action on the given layer + */ + void SetTimes(short layer, float start, float end); + /** * Stop playing the action on the given layer */ -- cgit v1.2.3 From cbec4e2768022596ff6acb145db3ae073e528397 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Mon, 8 Aug 2011 16:38:57 +0000 Subject: export bone transform matrix with sid. --- source/blender/collada/AnimationExporter.cpp | 2 +- source/blender/collada/TransformWriter.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index fc13207dd2e..4beab6f7608 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -586,7 +586,7 @@ void AnimationExporter::exportAnimations(Scene *sce) addSampler(sampler); - std::string target = translate_id(ob_name + "_" + bone_name) + "/transform"; + std::string target = translate_id(bone_name) + "/transform"; addChannel(COLLADABU::URI(empty, sampler_id), target); closeAnimation(); diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 546ca3e3019..3ac0654c866 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -48,8 +48,13 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4], copy_m4_m4(local, mat); } + double dmat[4][4]; + for ( int i = 0 ; i< 4 ; i ++ ) + for ( int j =0 ; j < 4 ; j++) + dmat[i][j] = (double)local[i][j]; + TransformBase::decompose(local, loc, rot, NULL, scale); - + node.addMatrix("transform",dmat); add_transform(node, loc, rot, scale); } -- cgit v1.2.3 From 88786f6fca00aa042c5b6fb2665666d9fccb6237 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Tue, 9 Aug 2011 03:06:22 +0000 Subject: BGE Animations: Fixing the Continue option when using the Flipper play type. Also removing a couple of debug prints. --- source/gameengine/Converter/BL_ActionActuator.cpp | 17 ++++++++++++----- source/gameengine/Ketsji/BL_Action.cpp | 2 -- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 8efcdd8c551..4e4d838d8ff 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -174,8 +174,10 @@ bool BL_ActionActuator::Update(double curtime, bool frame) start = end = prop->GetNumber(); } - // Continue only really makes sense for play stop. All other modes go until they are complete. - if (m_flag & ACT_FLAG_CONTINUE && m_playtype == ACT_ACTION_LOOP_STOP) + // 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)) use_continue = true; @@ -189,6 +191,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (bPositiveEvent) { + if (use_continue && m_flag & ACT_FLAG_ACTIVE) + start = m_localtime = obj->GetActionFrame(m_layer); + if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, m_layer_weight, m_ipo_flags)) { m_flag |= ACT_FLAG_ACTIVE; @@ -215,11 +220,13 @@ 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; + if (m_playtype == ACT_ACTION_LOOP_STOP) { - 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; obj->StopAction(m_layer); // Stop the action after getting the frame // We're done diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 4cf6f982006..6682b0cea41 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -252,9 +252,7 @@ void BL_Action::ResetStartTime(float curtime) float dt = m_localtime - m_startframe; m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate()*m_speed); - printf("Before: %f, ", m_localtime); SetLocalTime(curtime); - printf("After: %f\n", m_localtime); } void BL_Action::IncrementBlending(float curtime) -- cgit v1.2.3 From 802f69df78a937cd94d855264c658212e3467c2a Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Tue, 9 Aug 2011 03:27:05 +0000 Subject: BGE Animations: Fixing issues with initialization order in BL_ShapeDeformer --- source/gameengine/Converter/BL_ShapeDeformer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp index 82c73529a94..befe0f6e784 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.cpp +++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp @@ -73,8 +73,8 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj, RAS_MeshObject *mesh) : BL_SkinDeformer(gameobj,bmeshobj, mesh), - m_lastShapeUpdate(-1), - m_useShapeDrivers(false) + m_useShapeDrivers(false), + m_lastShapeUpdate(-1) { m_key = m_bmesh->key; m_bmesh->key = copy_key(m_key); @@ -90,8 +90,8 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj, BL_ArmatureObject* arma) : BL_SkinDeformer(gameobj, bmeshobj_old, bmeshobj_new, mesh, release_object, recalc_normal, arma), - m_lastShapeUpdate(-1), - m_useShapeDrivers(false) + m_useShapeDrivers(false), + m_lastShapeUpdate(-1) { m_key = m_bmesh->key; m_bmesh->key = copy_key(m_key); -- cgit v1.2.3 From 13249b925eda7752b65a36d8270a3af3bdc02981 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 9 Aug 2011 08:38:14 +0000 Subject: 3D Audio GSoC: Speaker objects fully functional! Minor changes: * Fixed three memory bugs found via valgrind. * Fixed bug with jack transport crashing after file loading. * Sound NLA Strips now start at CFRA instead of 0. --- source/blender/blenkernel/BKE_sound.h | 4 ++ source/blender/blenkernel/intern/blender.c | 3 + source/blender/blenkernel/intern/library.c | 2 +- source/blender/blenkernel/intern/scene.c | 3 + source/blender/blenkernel/intern/sound.c | 88 +++++++++++++++++++++++++++++- source/blender/editors/object/object_add.c | 3 + source/blender/makesdna/DNA_anim_types.h | 2 + 7 files changed, 103 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 2cd006385e0..c36532ee4cc 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -46,6 +46,8 @@ void sound_init_once(void); void sound_init(struct Main *main); +void sound_init_main(struct Main *bmain); + void sound_exit(void); void sound_force_device(int device); @@ -124,6 +126,8 @@ int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, flo int sound_get_channels(struct bSound* sound); +void sound_update_scene(struct Main* bmain, struct Scene* scene); + void* sound_get_factory(void* sound); #endif diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index a3a4c5b555b..5f33059e117 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -82,6 +82,7 @@ #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_sequencer.h" +#include "BKE_sound.h" #include "BLO_undofile.h" @@ -247,6 +248,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath G.main= bfd->main; CTX_data_main_set(C, G.main); + + sound_init_main(G.main); if (bfd->user) { diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8668168936b..c362f3eb2fe 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -533,7 +533,6 @@ int set_listbasepointers(Main *main, ListBase **lb) lb[a++]= &(main->latt); lb[a++]= &(main->lamp); lb[a++]= &(main->camera); - lb[a++]= &(main->speaker); lb[a++]= &(main->text); lb[a++]= &(main->sound); @@ -541,6 +540,7 @@ int set_listbasepointers(Main *main, ListBase **lb) lb[a++]= &(main->brush); lb[a++]= &(main->script); lb[a++]= &(main->particle); + lb[a++]= &(main->speaker); lb[a++]= &(main->world); lb[a++]= &(main->screen); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 74126fd57a1..12e81e8296e 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -966,6 +966,9 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen /* scene drivers... */ scene_update_drivers(bmain, scene); + + /* update sound system animation */ + sound_update_scene(bmain, scene); } /* this is called in main loop, doing tagged updates before redraw */ diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 890fc114e68..17df6ba23cb 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -13,13 +13,16 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" +#include "BLI_math.h" #include "DNA_anim_types.h" +#include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_packedFile_types.h" #include "DNA_screen_types.h" #include "DNA_sound_types.h" +#include "DNA_speaker_types.h" #ifdef WITH_AUDASPACE # include "AUD_C-API.h" @@ -175,7 +178,12 @@ void sound_init(struct Main *bmain) if(!AUD_init(device, specs, buffersize)) AUD_init(AUD_NULL_DEVICE, specs, buffersize); - + + sound_init_main(bmain); +} + +void sound_init_main(struct Main *bmain) +{ #ifdef WITH_JACK AUD_setSyncCallback(sound_sync_callback, bmain); #else @@ -617,6 +625,84 @@ int sound_get_channels(struct bSound* sound) return info.specs.channels; } +void sound_update_scene(struct Main* bmain, struct Scene* scene) +{ + Object* ob; + NlaTrack* track; + NlaStrip* strip; + Speaker* speaker; + + void* new_set = AUD_createSet(); + void* handle; + float quat[4]; + + for(ob = bmain->object.first; ob; ob = ob->id.next) + { + if(ob->type == OB_SPEAKER) + { + if(ob->adt) + { + for(track = ob->adt->nla_tracks.first; track; track = track->next) + { + for(strip = track->strips.first; strip; strip = strip->next) + { + if(strip->type == NLASTRIP_TYPE_SOUND) + { + speaker = (Speaker*)ob->data; + + if(AUD_removeSet(scene->speaker_handles, strip->speaker_handle)) + { + AUD_moveSequence(strip->speaker_handle, strip->start / FPS, -1, 0); + } + else + { + if(speaker && speaker->sound) + { + strip->speaker_handle = AUD_addSequence(scene->sound_scene, speaker->sound->playback_handle, strip->start / FPS, -1, 0); + AUD_setRelativeSequence(strip->speaker_handle, 0); + } + } + + if(strip->speaker_handle) + { + AUD_addSet(new_set, strip->speaker_handle); + AUD_updateSequenceData(strip->speaker_handle, speaker->volume_max, + speaker->volume_min, speaker->distance_max, + speaker->distance_reference, speaker->attenuation, + speaker->cone_angle_outer, speaker->cone_angle_inner, + speaker->cone_volume_outer); + + mat4_to_quat(quat, ob->obmat); + AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_LOCATION, CFRA, ob->obmat[3], 1); + AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_ORIENTATION, CFRA, quat, 1); + AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_VOLUME, CFRA, &speaker->volume, 1); + AUD_setSequenceAnimData(strip->speaker_handle, AUD_AP_PITCH, CFRA, &speaker->pitch, 1); + AUD_updateSequenceSound(strip->speaker_handle, speaker->sound->playback_handle); + AUD_muteSequence(strip->speaker_handle, ((strip->flag & NLASTRIP_FLAG_MUTED) != 0) || ((speaker->flag & SPK_MUTED) != 0)); + } + } + } + } + } + } + } + + while((handle = AUD_getSet(scene->speaker_handles))) + { + AUD_removeSequence(scene->sound_scene, handle); + } + + if(scene->camera) + { + mat4_to_quat(quat, scene->camera->obmat); + AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_LOCATION, CFRA, scene->camera->obmat[3], 1); + AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_ORIENTATION, CFRA, quat, 1); + } + + AUD_destroySet(scene->speaker_handles); + scene->speaker_handles = new_set; +} + void* sound_get_factory(void* sound) { return ((struct bSound*) sound)->playback_handle; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 97d109118d1..09ce2562e3b 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -774,6 +774,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op) int enter_editmode; unsigned int layer; float loc[3], rot[3]; + Scene *scene = CTX_data_scene(C); object_add_generic_invoke_options(C, op); if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer)) @@ -789,6 +790,8 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op) AnimData *adt = BKE_id_add_animdata(&ob->id); NlaTrack *nlt = add_nlatrack(adt, NULL); NlaStrip *strip = add_nla_soundstrip(CTX_data_scene(C), ob->data); + strip->start = CFRA; + strip->end += strip->start; /* hook them up */ BKE_nlatrack_add_strip(nlt, strip); diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 5a031e04fe4..c0030cd0e5e 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -585,6 +585,8 @@ typedef struct NlaStrip { short type; /* type of NLA strip */ + void *speaker_handle; /* handle for speaker objects */ + int flag; /* settings */ int pad2; } NlaStrip; -- cgit v1.2.3 From a672ab5e737202bede956a88357a96cf2728df15 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 9 Aug 2011 14:10:32 +0000 Subject: 3D Audio GSoC: Improved waveform drawing in the sequencer. * Drawing the waveform of a sequencer strip is now independent from whether the sound is cached or not. * Improved drawing of the waveform in the sequencer (especially speed!). * Making it possible to vertically zoom more in the sequencer to better see the waveform for lipsync. * Fixed a bug which crashed blender on loading a sound file via ffmpeg. --- source/blender/blenkernel/BKE_sound.h | 12 ++++- source/blender/blenkernel/intern/sound.c | 35 +++++++++++-- source/blender/blenloader/intern/readfile.c | 31 +++++++++++ .../editors/space_sequencer/sequencer_draw.c | 61 +++++++++++++++++----- .../editors/space_sequencer/space_sequencer.c | 2 +- source/blender/makesdna/DNA_sequence_types.h | 1 + source/blender/makesdna/DNA_sound_types.h | 5 ++ source/blender/makesrna/intern/rna_sequencer.c | 5 ++ 8 files changed, 131 insertions(+), 21 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index c36532ee4cc..ecf0d7e459a 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -35,6 +35,8 @@ * \author nzc */ +#define SOUND_WAVE_SAMPLES_PER_SECOND 250 + struct PackedFile; struct bSound; struct bContext; @@ -42,6 +44,12 @@ struct ListBase; struct Main; struct Sequence; +typedef struct SoundWaveform +{ + int length; + float *data; +} SoundWaveform; + void sound_init_once(void); void sound_init(struct Main *main); @@ -122,7 +130,9 @@ float sound_sync_scene(struct Scene *scene); int sound_scene_playing(struct Scene *scene); -int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end); +void sound_free_waveform(struct bSound* sound); + +void sound_read_waveform(struct bSound* sound); int sound_get_channels(struct bSound* sound); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 17df6ba23cb..888c719a304 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -24,6 +24,7 @@ #include "DNA_sound_types.h" #include "DNA_speaker_types.h" +#define WITH_AUDASPACE #ifdef WITH_AUDASPACE # include "AUD_C-API.h" #endif @@ -96,6 +97,8 @@ void sound_free(struct bSound* sound) AUD_unload(sound->cache); sound->cache = NULL; } + + sound_free_waveform(sound); #endif // WITH_AUDASPACE } @@ -608,12 +611,34 @@ int sound_scene_playing(struct Scene *scene) return -1; } -int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end) +void sound_free_waveform(struct bSound* sound) +{ + if(sound->waveform) + { + MEM_freeN(((SoundWaveform*)sound->waveform)->data); + MEM_freeN(sound->waveform); + } + + sound->waveform = NULL; +} + +void sound_read_waveform(struct bSound* sound) { - AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end); - int ret= AUD_readSound(limiter, buffer, length); - AUD_unload(limiter); - return ret; + AUD_SoundInfo info; + + info = AUD_getInfo(sound->playback_handle); + + if(info.length > 0) + { + SoundWaveform* waveform = MEM_mallocN(sizeof(SoundWaveform), "SoundWaveform");; + int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND; + + waveform->data = MEM_mallocN(length * sizeof(float) * 3, "SoundWaveform.samples"); + waveform->length = AUD_readSound(sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND); + + sound_free_waveform(sound); + sound->waveform = waveform; + } } int sound_get_channels(struct bSound* sound) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ef71df31df4..ae5bafa2d08 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5609,6 +5609,7 @@ static void direct_link_sound(FileData *fd, bSound *sound) { sound->handle = NULL; sound->playback_handle = NULL; + sound->waveform = NULL; // versioning stuff, if there was a cache, then we enable caching: if(sound->cache) @@ -11766,6 +11767,36 @@ static void do_versions(FileData *fd, Library *lib, Main *main) SEQ_END } } + { + bScreen *screen; + for(screen= main->screen.first; screen; screen= screen->id.next) { + ScrArea *sa; + /* add regions */ + for(sa= screen->areabase.first; sa; sa= sa->next) { + SpaceLink *sl= sa->spacedata.first; + if(sl->spacetype==SPACE_SEQ) { + ARegion *ar; + for (ar=sa->regionbase.first; ar; ar= ar->next) { + if(ar->regiontype == RGN_TYPE_WINDOW) { + if(ar->v2d.min[1] == 4.0f) + ar->v2d.min[1]= 0.5f; + } + } + } + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if(sl->spacetype==SPACE_SEQ) { + ARegion *ar; + for (ar=sl->regionbase.first; ar; ar= ar->next) { + if(ar->regiontype == RGN_TYPE_WINDOW) { + if(ar->v2d.min[1] == 4.0f) + ar->v2d.min[1]= 0.5f; + } + } + } + } + } + } + } { /* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve * diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7e4207c75fe..bc97ff341db 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -173,30 +173,63 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x x2 the end x value, same for y1 and y2 stepsize is width of a pixel. */ - if(seq->sound->cache) + if(seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) { - int i; + int i, j, pos; int length = floor((x2-x1)/stepsize)+1; float ymid = (y1+y2)/2; float yscale = (y2-y1)/2; - float* samples = MEM_mallocN(length * sizeof(float) * 2, "seqwave_samples"); - if(!samples) - return; - if(sound_read_sound_buffer(seq->sound, samples, length, - (seq->startofs + seq->anim_startofs)/FPS, - (seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS) != length) + float samplestep; + float startsample, endsample; + float value; + + SoundWaveform* waveform; + + if(!seq->sound->waveform) + sound_read_waveform(seq->sound); + + waveform = seq->sound->waveform; + + startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); + endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); + samplestep = (endsample-startsample) * stepsize / (x2-x1); + + if(length > floor((waveform->length - startsample) / samplestep)) + length = floor((waveform->length - startsample) / samplestep); + + glBegin(GL_LINE_STRIP); + for(i = 0; i < length; i++) { - MEM_freeN(samples); - return; + pos = startsample + i * samplestep; + + value = waveform->data[pos * 3]; + + for(j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++) + { + if(value > waveform->data[j * 3]) + value = waveform->data[j * 3]; + } + + glVertex2f(x1+i*stepsize, ymid + value * yscale); } - glBegin(GL_LINES); + glEnd(); + + glBegin(GL_LINE_STRIP); for(i = 0; i < length; i++) { - glVertex2f(x1+i*stepsize, ymid + samples[i * 2] * yscale); - glVertex2f(x1+i*stepsize, ymid + samples[i * 2 + 1] * yscale); + pos = startsample + i * samplestep; + + value = waveform->data[pos * 3 + 1]; + + for(j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++) + { + if(value < waveform->data[j * 3 + 1]) + value = waveform->data[j * 3 + 1]; + } + + glVertex2f(x1+i*stepsize, ymid + value * yscale); } glEnd(); - MEM_freeN(samples); } } diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index d1df9699fa3..36471c7ffcf 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -223,7 +223,7 @@ static SpaceLink *sequencer_new(const bContext *C) ar->v2d.cur= ar->v2d.tot; ar->v2d.min[0]= 10.0f; - ar->v2d.min[1]= 4.0f; + ar->v2d.min[1]= 0.5f; ar->v2d.max[0]= MAXFRAMEF; ar->v2d.max[1]= MAXSEQ; diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index aa04dc9ac13..359ef8449e9 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -288,6 +288,7 @@ typedef struct SpeedControlVars { #define SEQ_AUDIO_VOLUME_ANIMATED (1<<24) #define SEQ_AUDIO_PITCH_ANIMATED (1<<25) #define SEQ_AUDIO_PAN_ANIMATED (1<<26) +#define SEQ_AUDIO_DRAW_WAVEFORM (1<<27) #define SEQ_INVALID_EFFECT (1<<31) diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index 56ad0e1ff84..d7546e84bbf 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -84,6 +84,11 @@ typedef struct bSound { */ void *cache; + /** + * Waveform display data. + */ + void *waveform; + /** * The audaspace handle that should actually be played back. * Should be cache if cache != NULL; otherwise it's handle diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 6e18f955bf5..38575242fd6 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -976,6 +976,11 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it can't be transformed"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + prop= RNA_def_property(srna, "waveform", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM); + RNA_def_property_ui_text(prop, "Draw Waveform", "Whether to draw the sound's waveform."); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); + /* strip positioning */ prop= RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME); -- cgit v1.2.3 From 8655385c9edb5e61416018406f8a3fe3b8e7d141 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 9 Aug 2011 14:34:42 +0000 Subject: Fix for last commit: MSVC dislikes ;; --- source/blender/blenkernel/intern/sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 888c719a304..80cb2072357 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -630,7 +630,7 @@ void sound_read_waveform(struct bSound* sound) if(info.length > 0) { - SoundWaveform* waveform = MEM_mallocN(sizeof(SoundWaveform), "SoundWaveform");; + SoundWaveform* waveform = MEM_mallocN(sizeof(SoundWaveform), "SoundWaveform"); int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND; waveform->data = MEM_mallocN(length * sizeof(float) * 3, "SoundWaveform.samples"); -- cgit v1.2.3 From 407ec19431971c4e408fa9e6cda63a71a9b1e9b0 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Tue, 9 Aug 2011 16:28:08 +0000 Subject: temporary fix for quat rotations --- source/blender/collada/AnimationExporter.cpp | 2 ++ source/blender/collada/AnimationImporter.cpp | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 4beab6f7608..337fd89a7fa 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -208,10 +208,12 @@ void AnimationExporter::exportAnimations(Scene *sce) if ( !strcmp(transformName, "rotation_quaternion") ) { + fprintf(stderr, "quaternion rotations are not supported. rotation curves will not be exported\n"); quatRotation = true; /*const char *axis_names[] = {"", "X", "Y", "Z"}; if (fcu->array_index < 4) axis_name = axis_names[fcu->array_index];*/ + return; } //maybe a list or a vector of float animations else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")|| diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 0fc01e51020..4b467c4a149 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -90,11 +90,12 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) { COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues(); COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues(); - + if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ) { COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); } + float fps = (float)FPS; size_t dim = curve->getOutDimension(); unsigned int i; @@ -661,6 +662,14 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * } case COLLADAFW::Transformation::MATRIX: + /*{ + COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform; + COLLADABU::Math::Matrix4 mat4 = mat->getMatrix(); + switch (binding->animationClass) { + case COLLADAFW::AnimationList::TRANSFORM: + + } + }*/ case COLLADAFW::Transformation::SKEW: case COLLADAFW::Transformation::LOOKAT: fprintf(stderr, "Animation of MATRIX, SKEW and LOOKAT transformations is not supported yet.\n"); -- cgit v1.2.3 From ef40d8e4f0c69f4a2da24ea6bd8ce560aa3b180a Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 9 Aug 2011 17:37:12 +0000 Subject: Another error in last bigger commit. --- source/blender/blenkernel/intern/sound.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 80cb2072357..1b09db84125 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -24,7 +24,6 @@ #include "DNA_sound_types.h" #include "DNA_speaker_types.h" -#define WITH_AUDASPACE #ifdef WITH_AUDASPACE # include "AUD_C-API.h" #endif -- cgit v1.2.3 From 944a891b48e707eded78c0a59f14715e04302c40 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Tue, 9 Aug 2011 19:30:17 +0000 Subject: sid addressing fix --- source/blender/collada/AnimationExporter.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 337fd89a7fa..0f7edc9ad7d 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -169,7 +169,7 @@ void AnimationExporter::exportAnimations(Scene *sce) fcu = fcu->next; } - for ( int i = 0 ; i < fcu->totvert ; i++){ + for ( int i = 0 ; i < keys ; i++){ for ( int j = 0;j<4;j++) temp_quat[j] = quat[(i*4)+j]; @@ -208,7 +208,7 @@ void AnimationExporter::exportAnimations(Scene *sce) if ( !strcmp(transformName, "rotation_quaternion") ) { - fprintf(stderr, "quaternion rotations are not supported. rotation curves will not be exported\n"); + fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n"); quatRotation = true; /*const char *axis_names[] = {"", "X", "Y", "Z"}; if (fcu->array_index < 4) @@ -261,18 +261,18 @@ void AnimationExporter::exportAnimations(Scene *sce) // create output source std::string output_id ; - /*if(quatRotation) + if(quatRotation) { float * eul = get_eul_source_for_quat(ob); - float * eul_axis = + float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values"); for ( int i = 0 ; i< fcu->totvert ; i++) eul_axis[i] = eul[i*3 + fcu->array_index]; output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name); } - else*/ - - output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name); - + else + { + output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name); + } // create interpolations source std::string interpolation_id = create_interpolation_source(fcu, anim_id, axis_name, &has_tangents); @@ -1085,12 +1085,15 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = ""; break; } - + if (tm_name.size()) { if (is_rotation) - return tm_name + std::string(axis_name); + return tm_name + std::string(axis_name) + ".ANGLE"; else - return tm_name; + if (axis_name != "") + return tm_name + "." + std::string(axis_name); + else + return tm_name; } return std::string(""); -- cgit v1.2.3 From fafe6e354044d28be71ab76c2211d785773a9c0f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 10 Aug 2011 00:46:20 +0000 Subject: Gianmichele request: Pose Sliding tools show percentage indicator in header --- source/blender/editors/armature/poseSlide.c | 43 +++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 3d6888d87dc..9b92bccd979 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -93,7 +93,8 @@ /* Temporary data shared between these operators */ typedef struct tPoseSlideOp { Scene *scene; /* current scene */ - ARegion *ar; /* region that we're operating in (needed for */ + ScrArea *sa; /* area that we're operating in (needed for modal()) */ + ARegion *ar; /* region that we're operating in (needed for modal()) */ Object *ob; /* active object that Pose Info comes from */ bArmature *arm; /* armature for pose */ @@ -132,6 +133,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) pso->scene= CTX_data_scene(C); pso->ob= ED_object_pose_armature(CTX_data_active_object(C)); pso->arm= (pso->ob)? pso->ob->data : NULL; + pso->sa= CTX_wm_area(C); /* only really needed when doing modal() */ pso->ar= CTX_wm_region(C); /* only really needed when doing modal() */ pso->cframe= pso->scene->r.cfra; @@ -519,6 +521,33 @@ static void pose_slide_reset (tPoseSlideOp *pso) /* ------------------------------------ */ +/* draw percentage indicator in header */ +static void pose_slide_draw_status (bContext *C, tPoseSlideOp *pso) +{ + char statusStr[32]; + char mode[32]; + + switch (pso->mode) { + case POSESLIDE_PUSH: + strcpy(mode, "Push Pose"); + break; + case POSESLIDE_RELAX: + strcpy(mode, "Relax Pose"); + break; + case POSESLIDE_BREAKDOWN: + strcpy(mode, "Breakdown"); + break; + + default: + // unknown + strcpy(mode, "Sliding-Tool"); + break; + } + + sprintf(statusStr, "%s: %d %%", mode, (int)(pso->percentage*100.0f)); + ED_area_headerprint(pso->sa, statusStr); +} + /* common code for invoke() methods */ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp *pso) { @@ -587,6 +616,9 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp * /* set cursor to indicate modal */ WM_cursor_modal(win, BC_EW_SCROLLCURSOR); + /* header print */ + pose_slide_draw_status(C, pso); + /* add a modal handler for this operator */ WM_event_add_modal_handler(C, op); return OPERATOR_RUNNING_MODAL; @@ -601,7 +633,8 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) switch (evt->type) { case LEFTMOUSE: /* confirm */ { - /* return to normal cursor */ + /* return to normal cursor and header status */ + ED_area_headerprint(pso->sa, NULL); WM_cursor_restore(win); /* insert keyframes as required... */ @@ -615,7 +648,8 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) case ESCKEY: /* cancel */ case RIGHTMOUSE: { - /* return to normal cursor */ + /* return to normal cursor and header status */ + ED_area_headerprint(pso->sa, NULL); WM_cursor_restore(win); /* reset transforms back to original state */ @@ -639,6 +673,9 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) pso->percentage= (evt->x - pso->ar->winrct.xmin) / ((float)pso->ar->winx); RNA_float_set(op->ptr, "percentage", pso->percentage); + /* update percentage indicator in header */ + pose_slide_draw_status(C, pso); + /* reset transforms (to avoid accumulation errors) */ pose_slide_reset(pso); -- cgit v1.2.3 From 11d4cfaa715bc1acb194c3b71ffb1635155d39ec Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Wed, 10 Aug 2011 17:51:18 +0000 Subject: Baked Animation re-Import fix --- source/blender/collada/AnimationImporter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 4b467c4a149..6f3406e88f7 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -667,7 +667,7 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * COLLADABU::Math::Matrix4 mat4 = mat->getMatrix(); switch (binding->animationClass) { case COLLADAFW::AnimationList::TRANSFORM: - + } }*/ case COLLADAFW::Transformation::SKEW: @@ -815,9 +815,10 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , //Add the curves of the current animation to the object for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve * fcu = *iter; - if (ob->type == OB_ARMATURE) + if ((ob->type == OB_ARMATURE)){ + if ( !is_matrix) add_bone_fcurve( ob, node , fcu ); - else + } else BLI_addtail(AnimCurves, fcu); } } -- cgit v1.2.3 From 286a6d39c7b9306b49878f07f560c89f25e65a9b Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Wed, 10 Aug 2011 19:43:40 +0000 Subject: import only transform matrix animation method ( in progress ) --- source/blender/collada/AnimationImporter.cpp | 168 ++++++++++++++++++++++++++- source/blender/collada/AnimationImporter.h | 2 + 2 files changed, 168 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 6f3406e88f7..14d081c2c53 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -750,6 +750,165 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list } +void AnimationImporter::apply_matrix_curves_to_bone( Object * ob, std::vector& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, + COLLADAFW::Transformation * tm , char * joint_path, bool is_joint,const char * bone_name) +{ + std::vector frames; + find_frames(&frames, &animcurves); + + float irest_dae[4][4]; + float rest[4][4], irest[4][4]; + + if (is_joint) { + get_joint_rest_mat(irest_dae, root, node); + invert_m4(irest_dae); + + Bone *bone = get_named_bone((bArmature*)ob->data, bone_name); + if (!bone) { + fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); + return; + } + + unit_m4(rest); + copy_m4_m4(rest, bone->arm_mat); + invert_m4_m4(irest, rest); + } + // new curves to assign matrix transform animation + FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale + unsigned int totcu = 10 ; + const char *tm_str = NULL; + char rna_path[200]; + for (int i = 0; i < totcu; i++) { + + int axis = i; + + if (i < 4) { + tm_str = "rotation_quaternion"; + axis = i; + } + else if (i < 7) { + tm_str = "location"; + axis = i - 4; + } + else { + tm_str = "scale"; + axis = i - 7; + } + + + if (is_joint) + BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); + else + strcpy(rna_path, tm_str); + newcu[i] = create_fcurve(axis, rna_path); + +#ifdef ARMATURE_TEST + if (is_joint) + job_curves[i] = create_fcurve(axis, tm_str); +#endif + } + +// Object *job = NULL; + +#ifdef ARMATURE_TEST + FCurve *job_curves[10]; + job = get_joint_object(root, node, par_job); +#endif + + if (frames.size() == 0) + return; + +std::sort(frames.begin(), frames.end()); + //if (is_joint) + // armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); + + + std::vector::iterator it; + + // sample values at each frame + for (it = frames.begin(); it != frames.end(); it++) { + float fra = *it; + + float mat[4][4]; + float matfra[4][4]; + + unit_m4(matfra); + + float m[4][4]; + + unit_m4(m); + dae_matrix_to_mat4(tm, m); + + float temp[4][4]; + copy_m4_m4(temp, mat); + + mul_m4_m4m4(mat, m, temp); + + // for joints, we need a special matrix + if (is_joint) { + // special matrix: iR * M * iR_dae * R + // where R, iR are bone rest and inverse rest mats in world space (Blender bones), + // iR_dae is joint inverse rest matrix (DAE) and M is an evaluated joint world-space matrix (DAE) + float temp[4][4], par[4][4]; + + // calc M + calc_joint_parent_mat_rest(par, NULL, root, node); + mul_m4_m4m4(temp, matfra, par); + + // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra); + + // calc special matrix + mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL); + } + else { + copy_m4_m4(mat, matfra); + } + + float rot[4], loc[3], scale[3]; + + mat4_to_quat(rot, mat); + copy_v3_v3(loc, mat[3]); + mat4_to_size(scale, mat); + + // add keys + for (int i = 0; i < totcu; i++) { + if (i < 4) + add_bezt(newcu[i], fra, rot[i]); + else if (i < 7) + add_bezt(newcu[i], fra, loc[i - 4]); + else + add_bezt(newcu[i], fra, scale[i - 7]); + } + } + verify_adt_action((ID*)&ob->id, 1); + + ListBase *curves = &ob->adt->action->curves; + + // add curves + for (int i= 0; i < totcu; i++) { + if (is_joint) + add_bone_fcurve(ob, node, newcu[i]); + else + BLI_addtail(curves, newcu[i]); + +#ifdef ARMATURE_TEST + if (is_joint) + BLI_addtail(&job->adt->action->curves, job_curves[i]); +#endif + } + + if (is_joint) { + bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + chan->rotmode = ROT_MODE_QUAT; + } + else { + ob->rotmode = ROT_MODE_QUAT; + } + + return; + +} + void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , std::map& root_map, std::map& object_map, @@ -816,8 +975,13 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve * fcu = *iter; if ((ob->type == OB_ARMATURE)){ - if ( !is_matrix) - add_bone_fcurve( ob, node , fcu ); + if ( is_matrix){ + float irest_dae[4][4]; + get_joint_rest_mat(irest_dae, root, node); + apply_matrix_curves_to_bone(ob, animcurves, root , node, transform ,joint_path , true , bone_name ); + } + else + add_bone_fcurve( ob, node , fcu ); } else BLI_addtail(AnimCurves, fcu); } diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index ea7de961382..944e3ba5be5 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -152,6 +152,8 @@ public: AnimMix* get_animation_type( const COLLADAFW::Node * node , std::map FW_object_map ) ; + void apply_matrix_curves_to_bone( Object * ob, std::vector& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, + COLLADAFW::Transformation * tm , char * joint_path, bool is_joint,const char * bone_name); void Assign_transform_animations(COLLADAFW::Transformation* transform , const COLLADAFW::AnimationList::AnimationBinding * binding, -- cgit v1.2.3 From 7707140fd1b227378a29361daaa9402a343fcaf1 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 10 Aug 2011 20:05:30 +0000 Subject: BGE Animations: Always update the localtime used for continuous animations. Previously this was only done on a positive or negative pulse, which could lead to some issues with a continuous flipper animation. --- source/gameengine/Converter/BL_ActionActuator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 4e4d838d8ff..cfaede5cd41 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -188,12 +188,12 @@ bool BL_ActionActuator::Update(double curtime, bool frame) bPositiveEvent = m_posevent; RemoveAllEvents(); } + + if (use_continue && m_flag & ACT_FLAG_ACTIVE) + m_localtime = obj->GetActionFrame(m_layer); if (bPositiveEvent) { - if (use_continue && m_flag & ACT_FLAG_ACTIVE) - start = m_localtime = obj->GetActionFrame(m_layer); - if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, m_layer_weight, m_ipo_flags)) { m_flag |= ACT_FLAG_ACTIVE; -- cgit v1.2.3 From 17e88915fdd7048365df1be48d615d69c0924b4c Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 11 Aug 2011 03:27:47 +0000 Subject: BGE Animations: Updating BL_ActionActuator.frame to work with the new actuator. --- source/gameengine/Converter/BL_ActionActuator.cpp | 17 ++++++++++++++++- source/gameengine/Converter/BL_ActionActuator.h | 15 ++------------- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index cfaede5cd41..ec5ab423f60 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -461,7 +461,7 @@ PyAttributeDef BL_ActionActuator::Attributes[] = { KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action), KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names), KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority), - KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame), + KX_PYATTRIBUTE_RW_FUNCTION("frame", BL_ActionActuator, pyattr_get_frame, pyattr_set_frame), KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname), KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ActionActuator, m_framepropname), KX_PYATTRIBUTE_RW_FUNCTION("useContinue", BL_ActionActuator, pyattr_get_use_continue, pyattr_set_use_continue), @@ -542,4 +542,19 @@ int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUT return PY_SET_ATTR_SUCCESS; } +PyObject* BL_ActionActuator::pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + BL_ActionActuator* self= static_cast(self_v); + return PyFloat_FromDouble(((KX_GameObject*)self->m_gameobj)->GetActionFrame(self->m_layer)); +} + +int BL_ActionActuator::pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + BL_ActionActuator* self= static_cast(self_v); + + ((KX_GameObject*)self->m_gameobj)->SetActionFrame(self->m_layer, PyFloat_AsDouble(value)); + + return PY_SET_ATTR_SUCCESS; +} + #endif // WITH_PYTHON diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h index ad57b675b0b..126f2f29136 100644 --- a/source/gameengine/Converter/BL_ActionActuator.h +++ b/source/gameengine/Converter/BL_ActionActuator.h @@ -78,19 +78,8 @@ public: static PyObject* pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - /* attribute check */ - static int CheckFrame(void *self, const PyAttributeDef*) - { - BL_ActionActuator* act = reinterpret_cast(self); - - if (act->m_localtime < act->m_startframe) - act->m_localtime = act->m_startframe; - else if (act->m_localtime > act->m_endframe) - act->m_localtime = act->m_endframe; - - return 0; - } + static PyObject* pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static int CheckBlendTime(void *self, const PyAttributeDef*) { -- cgit v1.2.3 From 78f89c3bbf6c7faa3b364f75f7fd52d9f62762e6 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 11 Aug 2011 07:19:37 +0000 Subject: BGE Animations: Animation updates are now handled separately from logic/physics updates. This allows the animations to be updated at the full fps specified by the user. Before, updates were not happening frequently enough. For example, a 30fps animation my only update at 20~30fps, which would cause some noticeable lag. This my not be the best solution since at this point we may be dropping frames (not being in the while(frames) loop), and we're not updating as often as the physics engine might want for bone parented physics objects. --- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 421e642a6df..6fb03d0a573 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -581,7 +581,7 @@ else framestep = (frames*timestep)/m_maxLogicFrame; frames = m_maxLogicFrame; } - + while (frames) { @@ -655,16 +655,6 @@ else scene->LogicUpdateFrame(m_frameTime, true); scene->LogicEndFrame(); - - // Handle animations - double anim_timestep = 1.0/scene->GetAnimationFPS(); - if (m_clockTime - m_previousAnimTime > anim_timestep) - { - m_previousAnimTime = m_clockTime; - m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); - scene->UpdateAnimations(m_frameTime); - } // Actuators can affect the scenegraph m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); @@ -777,7 +767,22 @@ else } } + + // Handle the animations independently of the logic time step + m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); + SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); + double anim_timestep = 1.0/KX_GetActiveScene()->GetAnimationFPS(); + if (m_clockTime - m_previousAnimTime > anim_timestep) + { + // Sanity/debug print to make sure we're actually going at the fps we want (should be close to anim_timestep) + // printf("Anim fps: %f\n", 1.0/(m_clockTime - m_previousAnimTime)); + m_previousAnimTime = m_clockTime; + for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit) + { + (*sceneit)->UpdateAnimations(m_frameTime); + } + } m_previousClockTime = m_clockTime; // Start logging time spend outside main loop -- cgit v1.2.3 From fee7337249342c3d5a332358883af9afe961f38d Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Thu, 11 Aug 2011 11:41:24 +0000 Subject: 3D Audio GSoC: Adding a mono flag to mixdown non-mono sounds for 3D audio. * Added mono sound loading. * Bugfix: AUD_COMPARE_SPECS usage was wrong. * Bugfix: JOS resampler = instead of ==. * Bugfix: Change of a sound should apply settings in AUD_SequencerHandle. * Bugfix: Memory leak when canceling open sound operator. --- source/blender/blenkernel/intern/sound.c | 7 ++++++ source/blender/editors/sound/sound_ops.c | 39 +++++++++++++++++++++++++++++- source/blender/makesdna/DNA_sound_types.h | 1 + source/blender/makesrna/intern/rna_sound.c | 9 +++++-- 4 files changed, 53 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 1b09db84125..9c62b92a924 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -349,6 +349,13 @@ void sound_load(struct Main *bmain, struct bSound* sound) break; } #endif + if(sound->flags & SOUND_FLAGS_MONO) + { + void* handle = AUD_monoSound(sound->handle); + AUD_unload(sound->handle); + sound->handle = handle; + } + if(sound->flags & SOUND_FLAGS_CACHING) { sound->cache = AUD_bufferSound(sound->handle); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 31d22f9dd54..fb4355d0df7 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -79,6 +79,13 @@ /******************** open sound operator ********************/ +static int open_cancel(bContext *UNUSED(C), wmOperator *op) +{ + MEM_freeN(op->customdata); + op->customdata= NULL; + return OPERATOR_CANCELLED; +} + static void open_init(bContext *C, wmOperator *op) { PropertyPointerRNA *pprop; @@ -95,9 +102,10 @@ static int open_exec(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; PointerRNA idptr; AUD_SoundInfo info; + Main *bmain = CTX_data_main(C); RNA_string_get(op->ptr, "filepath", path); - sound = sound_new_file(CTX_data_main(C), path); + sound = sound_new_file(bmain, path); if(!op->customdata) open_init(C, op); @@ -117,6 +125,11 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + if(RNA_boolean_get(op->ptr, "mono")) { + sound->flags |= SOUND_FLAGS_MONO; + sound_load(bmain, sound); + } + if (RNA_boolean_get(op->ptr, "cache")) { sound_cache(sound); } @@ -172,6 +185,28 @@ void SOUND_OT_open(wmOperatorType *ot) /* api callbacks */ ot->exec= open_exec; ot->invoke= open_invoke; + ot->cancel= open_cancel; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH); + RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory."); + RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono."); +} + +void SOUND_OT_open_mono(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Open Sound Mono"; + ot->description= "Load a sound file as mono"; + ot->idname= "SOUND_OT_open_mono"; + + /* api callbacks */ + ot->exec= open_exec; + ot->invoke= open_invoke; + ot->cancel= open_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -179,6 +214,7 @@ void SOUND_OT_open(wmOperatorType *ot) /* properties */ WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH); RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory."); + RNA_def_boolean(ot->srna, "mono", TRUE, "Mono", "Mixdown the sound to mono."); } /******************** mixdown operator ********************/ @@ -667,6 +703,7 @@ void SOUND_OT_bake_animation(wmOperatorType *ot) void ED_operatortypes_sound(void) { WM_operatortype_append(SOUND_OT_open); + WM_operatortype_append(SOUND_OT_open_mono); WM_operatortype_append(SOUND_OT_mixdown); WM_operatortype_append(SOUND_OT_pack); WM_operatortype_append(SOUND_OT_unpack); diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h index d7546e84bbf..4f727b3586b 100644 --- a/source/blender/makesdna/DNA_sound_types.h +++ b/source/blender/makesdna/DNA_sound_types.h @@ -113,6 +113,7 @@ typedef enum eSound_Type { #define SOUND_FLAGS_3D (1 << 3) /* deprecated! used for sound actuator loading */ #define SOUND_FLAGS_CACHING (1 << 4) +#define SOUND_FLAGS_MONO (1 << 5) /* to DNA_sound_types.h*/ diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index e78bc092040..b224b55c20c 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -41,7 +41,7 @@ #include "BKE_sound.h" #include "BKE_context.h" -static void rna_Sound_filepath_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Sound_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { sound_load(bmain, (bSound*)ptr->data); } @@ -83,7 +83,7 @@ static void rna_def_sound(BlenderRNA *brna) prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Path", "Sound sample file used by this Sound datablock"); - RNA_def_property_update(prop, 0, "rna_Sound_filepath_update"); + RNA_def_property_update(prop, 0, "rna_Sound_update"); prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); @@ -93,6 +93,11 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set"); 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); + 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 mixdown to a signle one."); + RNA_def_property_update(prop, 0, "rna_Sound_update"); } void RNA_def_sound(BlenderRNA *brna) -- cgit v1.2.3 From db72192c22787fdf99bc7b20c6864b37b8e871f4 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 12 Aug 2011 07:20:49 +0000 Subject: Bye bye vile relics of extinct version control systems, Causing a flurry of refresh file prompts post-commit, Confusing local diffs and causing merge conflicts, Stating the obvious; redundant and useless... We shall not miss thou, blasted expand $keywords$ --- source/blender/blenkernel/BKE_action.h | 2 -- source/blender/blenkernel/BKE_anim.h | 2 -- source/blender/blenkernel/BKE_animsys.h | 2 -- source/blender/blenkernel/BKE_armature.h | 2 -- source/blender/blenkernel/BKE_constraint.h | 2 -- source/blender/blenkernel/BKE_nla.h | 2 -- source/blender/blenkernel/intern/action.c | 2 -- source/blender/blenkernel/intern/anim.c | 6 +----- source/blender/blenkernel/intern/anim_sys.c | 2 -- source/blender/blenkernel/intern/armature.c | 2 -- source/blender/blenkernel/intern/constraint.c | 2 -- source/blender/blenkernel/intern/fcurve.c | 2 -- source/blender/blenkernel/intern/fmodifier.c | 2 -- source/blender/blenkernel/intern/gpencil.c | 2 -- source/blender/blenkernel/intern/ipo.c | 5 +---- source/blender/blenkernel/intern/nla.c | 2 -- source/blender/editors/animation/anim_channels_defines.c | 2 -- source/blender/editors/animation/anim_channels_edit.c | 2 -- source/blender/editors/animation/anim_deps.c | 2 -- source/blender/editors/animation/anim_draw.c | 2 -- source/blender/editors/animation/anim_filter.c | 2 -- source/blender/editors/animation/anim_intern.h | 2 -- source/blender/editors/animation/anim_ipo_utils.c | 2 -- source/blender/editors/animation/anim_markers.c | 2 -- source/blender/editors/animation/anim_ops.c | 2 -- source/blender/editors/animation/drivers.c | 2 -- source/blender/editors/animation/fmodifier_ui.c | 2 -- source/blender/editors/animation/keyframes_draw.c | 2 -- source/blender/editors/animation/keyframes_edit.c | 2 -- source/blender/editors/animation/keyframes_general.c | 2 -- source/blender/editors/animation/keyframing.c | 2 -- source/blender/editors/animation/keyingsets.c | 2 -- source/blender/editors/armature/armature_intern.h | 2 -- source/blender/editors/armature/armature_ops.c | 2 -- source/blender/editors/armature/editarmature.c | 2 -- source/blender/editors/armature/poseSlide.c | 2 -- source/blender/editors/armature/poseUtils.c | 2 -- source/blender/editors/armature/poselib.c | 2 -- source/blender/editors/armature/poseobject.c | 2 -- source/blender/editors/gpencil/drawgpencil.c | 2 -- source/blender/editors/gpencil/editaction_gpencil.c | 2 -- source/blender/editors/gpencil/gpencil_buttons.c | 2 -- source/blender/editors/gpencil/gpencil_edit.c | 2 -- source/blender/editors/gpencil/gpencil_intern.h | 2 -- source/blender/editors/gpencil/gpencil_ops.c | 2 -- source/blender/editors/gpencil/gpencil_paint.c | 2 -- source/blender/editors/include/ED_anim_api.h | 2 -- source/blender/editors/include/ED_gpencil.h | 2 -- source/blender/editors/include/ED_keyframes_draw.h | 2 -- source/blender/editors/include/ED_keyframes_edit.h | 2 -- source/blender/editors/include/ED_keyframing.h | 2 -- source/blender/editors/include/ED_markers.h | 2 -- source/blender/editors/space_action/action_draw.c | 2 -- source/blender/editors/space_action/action_edit.c | 2 -- source/blender/editors/space_action/action_intern.h | 2 -- source/blender/editors/space_action/action_ops.c | 2 -- source/blender/editors/space_action/action_select.c | 2 -- source/blender/editors/space_action/space_action.c | 2 -- source/blender/editors/space_graph/graph_draw.c | 2 -- source/blender/editors/space_nla/nla_buttons.c | 2 -- source/blender/editors/space_nla/nla_channels.c | 2 -- source/blender/editors/space_nla/nla_draw.c | 2 -- source/blender/editors/space_nla/nla_edit.c | 2 -- source/blender/editors/space_nla/nla_intern.h | 2 -- source/blender/editors/space_nla/nla_ops.c | 2 -- source/blender/editors/space_nla/nla_select.c | 2 -- source/blender/editors/space_nla/space_nla.c | 2 -- source/blender/editors/space_outliner/outliner_intern.h | 2 -- source/blender/editors/space_outliner/outliner_ops.c | 2 -- source/blender/editors/space_outliner/space_outliner.c | 2 -- source/blender/editors/space_time/space_time.c | 2 -- source/blender/editors/space_time/time_intern.h | 2 -- source/blender/editors/space_time/time_ops.c | 2 -- source/blender/makesdna/DNA_action_types.h | 4 +--- source/blender/makesdna/DNA_anim_types.h | 4 +--- source/blender/makesdna/DNA_armature_types.h | 2 -- source/blender/makesdna/DNA_constraint_types.h | 2 -- source/blender/makesdna/DNA_gpencil_types.h | 2 -- source/blender/makesdna/DNA_ipo_types.h | 2 -- source/blender/makesdna/DNA_nla_types.h | 2 -- source/blender/makesrna/intern/rna_action.c | 2 -- source/blender/makesrna/intern/rna_animation.c | 2 -- source/blender/makesrna/intern/rna_animation_api.c | 2 -- source/blender/makesrna/intern/rna_animviz.c | 2 -- source/blender/makesrna/intern/rna_armature.c | 2 -- source/blender/makesrna/intern/rna_constraint.c | 2 -- source/blender/makesrna/intern/rna_fcurve.c | 2 -- source/blender/makesrna/intern/rna_gpencil.c | 2 -- source/blender/makesrna/intern/rna_nla.c | 2 -- source/blender/makesrna/intern/rna_pose.c | 2 -- 90 files changed, 4 insertions(+), 187 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 7d3de68c005..67efb7752ea 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 25165eeaee7..44aebdf6205 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index bf619d76e68..98f9ee14c7e 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index efa87532859..7d60c00156d 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index ddff45c5422..925d1180dbd 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 49c1f8acd24..773c5ced1cb 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index a6539f00605..9c2467505cd 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 7ddb078ef8e..b965d14af00 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1,8 +1,4 @@ -/* anim.c - * - * - * $Id$ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 832d13c9c2f..1c4746b1828 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 0b31e51d62e..62ce184a2d7 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a321e718bbb..91091d3880f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 28f17b3cf86..2e532222d5b 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index dcf81c19479..64e51023816 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index db0c9d2735f..c2e94cc97db 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index d41a3a36b2d..0d3f3cc5ae4 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1,7 +1,4 @@ -/* ipo.c - * - * $Id$ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index dad49646622..463f3bdd5cb 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 20597ca5cdd..806af4c0ef5 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 551bc7e263e..ffa0b2d5ff5 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 13061113926..fdccf5d4baa 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 2c2a8045b64..70974386917 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index b4d1253c764..0472731dd6d 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h index 7818e8118a3..0ac941e5630 100644 --- a/source/blender/editors/animation/anim_intern.h +++ b/source/blender/editors/animation/anim_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index fc05f46929b..9c43671cdf4 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 732fc0bd267..48ddc8df5ef 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 7a94a21d41e..eaba8343f4d 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 3df65a942da..28195be943c 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 8197d6b25dd..b22a8a1cc37 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 56bc37709bc..c1e81cd0901 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index d5fb8b17440..cc360b34516 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index e2afda04d30..3d3311b35eb 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index fbedb466f7e..4e87409b7fd 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 69e7c4eb73a..69abd1cb5a4 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 9c466a79822..cc654f6d2bc 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index faf06f09141..28454fa0fa9 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index dcbbd424cdf..ec190f05987 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 9b92bccd979..b3ea568abf4 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c index e1e346ab920..4b22d76ad0b 100644 --- a/source/blender/editors/armature/poseUtils.c +++ b/source/blender/editors/armature/poseUtils.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index d09c4f1b5e0..ff6deb6a836 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 20165a67879..48d349ce837 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index a275a5f908a..440d5ee7c4d 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index e70fd2f9abf..937d24eed04 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index d95f64c31e1..192f5c10d07 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 2860d467cef..9dc764b7aac 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 6ecdc2b054b..c31de8d30a7 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index f2efada8406..e1e4c8d5457 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 2311f4a3a64..ffe2e334772 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index b0df4070d23..b730913a368 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index e5715316a31..07dcc959e32 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 3c1bb814c82..91723a1a33f 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index d9e7317fc66..5881e8c4bfe 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 0ca3a932266..9dbe86bc5ac 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h index a8e91add348..30a0d47eda2 100644 --- a/source/blender/editors/include/ED_markers.h +++ b/source/blender/editors/include/ED_markers.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index d4d665171bc..f541423e69d 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 5276e62b9eb..b5dfdcdc668 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index 512b6e329dd..2a23f105737 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index 2ccad308676..491d436741e 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 68dd0a8c256..aa29e54f436 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index a05d1d3df93..8cd6e388b08 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 7e40f2e5159..d65297e068d 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 0f0662d84b1..4392e49e5d7 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 08a4de81013..8775d256b80 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index eb9529b5186..9ce5aafd48a 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index fa24bd2f895..df638107bc3 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index bd76d2484dd..ec2e22e65fa 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 8ed117755c7..821e302c13d 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 5dc937d3ce1..c33316620eb 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index f2e0abe1e60..48859acff6a 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 85bbbd4fffb..e87b68a9ac3 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index b79bb000201..3e83da13e55 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 603be557a3c..49d8b6b5da4 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index a1347f6c306..6ea7a94b288 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_time/time_intern.h b/source/blender/editors/space_time/time_intern.h index 03ba617de14..094b0bc9e86 100644 --- a/source/blender/editors/space_time/time_intern.h +++ b/source/blender/editors/space_time/time_intern.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index e9559426b81..78d903a2997 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index f40d41f59bd..a820e59779f 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -1,6 +1,4 @@ -/* - * $Id$ - * +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index c0030cd0e5e..e1dfd652900 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -586,7 +584,7 @@ typedef struct NlaStrip { short type; /* type of NLA strip */ void *speaker_handle; /* handle for speaker objects */ - + int flag; /* settings */ int pad2; } NlaStrip; diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 1675fdd3e90..442fc3ddcce 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index c2c0c6f1611..1be2c811a1b 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 6eb5f64ffc3..b259d592864 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 5dba9154a3a..43a4b99bc33 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h index c64dda2afd0..b92cf5c67e4 100644 --- a/source/blender/makesdna/DNA_nla_types.h +++ b/source/blender/makesdna/DNA_nla_types.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 25c08a57889..f24e0a92f78 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index a3b3d0ac8c9..0395a54be8e 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c index 4f1a94d62c5..b3d2c02d0e4 100644 --- a/source/blender/makesrna/intern/rna_animation_api.c +++ b/source/blender/makesrna/intern/rna_animation_api.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index 5e8c5692abe..e65b137e846 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 19a6b482621..e2399b5b57c 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 2887232b659..22d9a19f933 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 6bb1416e7fc..e922a007249 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 423b4e4f76b..9811d7bd797 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 5756044d12b..ef4adde6fb4 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 635fc967a5a..0dd8218d1b9 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or -- cgit v1.2.3 From ebbd232555d9671161539a6d758bc789546d5ffb Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 12 Aug 2011 07:21:44 +0000 Subject: Fixing compiler warning --- source/blender/editors/space_graph/graph_buttons.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index d8fd53b83d8..c713bc54d25 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -257,7 +257,6 @@ static void graphedit_activekey_update_cb(bContext *UNUSED(C), void *fcu_ptr, vo /* update callback for active keyframe properties - handle-editing wrapper */ static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bezt_ptr) { - FCurve *fcu = (FCurve *)fcu_ptr; BezTriple *bezt = (BezTriple *)bezt_ptr; /* since editing the handles, make sure they're set to types which are receptive to editing -- cgit v1.2.3 From 059bbee2da03cd88cf8b28803e1917f9f065c1f9 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 12 Aug 2011 07:22:29 +0000 Subject: Drat... missed one --- source/blender/editors/space_graph/graph_buttons.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index c713bc54d25..f3a70c496ef 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or -- cgit v1.2.3 From 83f0c6e56991f1312598b013a2972e3dc79d8e09 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Fri, 12 Aug 2011 20:38:29 +0000 Subject: Transform matrix Animation import fix. --- source/blender/collada/AnimationImporter.cpp | 54 +++++++++++++--------------- source/blender/collada/ArmatureImporter.cpp | 3 +- 2 files changed, 26 insertions(+), 31 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 14d081c2c53..b0e636c2aa6 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -65,7 +65,6 @@ static const char *bc_get_joint_name(T *node) FCurve *AnimationImporter::create_fcurve(int array_index, const char *rna_path) { FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve"); - fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED); fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path)); fcu->array_index = array_index; @@ -801,20 +800,11 @@ void AnimationImporter::apply_matrix_curves_to_bone( Object * ob, std::vectortotvert = frames.size(); } // Object *job = NULL; -#ifdef ARMATURE_TEST - FCurve *job_curves[10]; - job = get_joint_object(root, node, par_job); -#endif - if (frames.size() == 0) return; @@ -833,17 +823,11 @@ std::sort(frames.begin(), frames.end()); float matfra[4][4]; unit_m4(matfra); + + // calc object-space mat + evaluate_transform_at_frame(matfra, node, fra); - float m[4][4]; - - unit_m4(m); - dae_matrix_to_mat4(tm, m); - - float temp[4][4]; - copy_m4_m4(temp, mat); - mul_m4_m4m4(mat, m, temp); - // for joints, we need a special matrix if (is_joint) { // special matrix: iR * M * iR_dae * R @@ -865,8 +849,12 @@ std::sort(frames.begin(), frames.end()); } float rot[4], loc[3], scale[3]; - + mat4_to_quat(rot, mat); + for ( int i = 0 ; i < 4 ; i ++ ) + { + rot[i] = rot[i] * (180 / M_PI); + } copy_v3_v3(loc, mat[3]); mat4_to_size(scale, mat); @@ -979,6 +967,7 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , float irest_dae[4][4]; get_joint_rest_mat(irest_dae, root, node); apply_matrix_curves_to_bone(ob, animcurves, root , node, transform ,joint_path , true , bone_name ); + break; } else add_bone_fcurve( ob, node , fcu ); @@ -990,8 +979,8 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , if (is_rotation || is_matrix) { if (is_joint) { - bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); - chan->rotmode = ROT_MODE_EUL; + /*bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + chan->rotmode = ROT_MODE_Quat;*/ } else { @@ -1534,10 +1523,12 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW:: float m[4][4]; unit_m4(m); + if ( type != COLLADAFW::Transformation::MATRIX ) + continue; std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId(); if (!evaluate_animation(tm, m, fra, nodename.c_str())) { - switch (type) { + /*switch (type) { case COLLADAFW::Transformation::ROTATE: dae_rotate_to_mat4(tm, m); break; @@ -1552,7 +1543,9 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW:: break; default: fprintf(stderr, "unsupported transformation type %d\n", type); - } + }*/ + dae_matrix_to_mat4(tm, m); + } float temp[4][4]; @@ -1588,9 +1581,9 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float bool is_scale = (type == COLLADAFW::Transformation::SCALE); bool is_translate = (type == COLLADAFW::Transformation::TRANSLATE); - if (type == COLLADAFW::Transformation::SCALE) + if (is_scale) dae_scale_to_v3(tm, vec); - else if (type == COLLADAFW::Transformation::TRANSLATE) + else if (is_translate) dae_translate_to_v3(tm, vec); for (unsigned int j = 0; j < bindings.getCount(); j++) { @@ -1618,7 +1611,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) { fprintf(stderr, "%s: UNKNOWN animation class\n", path); - continue; + //continue; } if (type == COLLADAFW::Transformation::ROTATE) { @@ -1858,11 +1851,12 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value) { + //float fps = (float)FPS; BezTriple bez; memset(&bez, 0, sizeof(BezTriple)); - bez.vec[1][0] = fra; + bez.vec[1][0] = fra ; bez.vec[1][1] = value; - bez.ipo = U.ipo_new; /* use default interpolation mode here... */ + bez.ipo = BEZT_IPO_LIN ;/* use default interpolation mode here... */ bez.f1 = bez.f2 = bez.f3 = SELECT; bez.h1 = bez.h2 = HD_AUTO; insert_bezt_fcurve(fcu, &bez, 0); diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 9489ddd1525..7a3c6a0644f 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -276,7 +276,8 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW: etit = uid_tags_map.find(node->getUniqueId().toAscii()); if(etit != uid_tags_map.end()) et = etit->second; - + else return; + float x,y,z; et->setData("tip_x",&x); et->setData("tip_y",&y); -- cgit v1.2.3 From c5ef9b62c1f7f407c42bb48fe3362fa6cf3cf101 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 12 Aug 2011 20:53:29 +0000 Subject: BGE Animations: Adding an option to let users choose whether or not to lock animation updates to the framerate. If this option is enabled, animations are only updated at the same speed as the animation framerate. This can give a significant speed up in performance, but at the cost of smoothness in animations. I'm defaulting this behavior to off for now, which is the behavior seen in trunk. --- source/blender/makesdna/DNA_scene_types.h | 2 + source/blender/makesrna/intern/rna_scene.c | 4 ++ .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 + .../GamePlayer/ghost/GPG_Application.cpp | 2 + source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 45 ++++++++++++++++------ source/gameengine/Ketsji/KX_KetsjiEngine.h | 12 ++++++ 6 files changed, 55 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 542aea00b00..be2a78ac774 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -479,6 +479,7 @@ typedef struct GameData { #define WOPHY_BULLET 5 /* GameData.flag */ +#define GAME_RESTRICT_ANIM_UPDATES (1 << 0) #define GAME_ENABLE_ALL_FRAMES (1 << 1) #define GAME_SHOW_DEBUG_PROPS (1 << 2) #define GAME_SHOW_FRAMERATE (1 << 3) @@ -494,6 +495,7 @@ typedef struct GameData { #define GAME_ENABLE_ANIMATION_RECORD (1 << 13) #define GAME_SHOW_MOUSE (1 << 14) #define GAME_GLSL_NO_COLOR_MANAGEMENT (1 << 15) +/* Note: GameData.flag is a short (max 16 flags). To add more flags, GameData.flag needs to be an int */ /* GameData.matmode */ #define GAME_MAT_TEXFACE 0 diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7313a39e5ec..7f8aeb65209 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1919,6 +1919,10 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set"); RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time"); + + prop= RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES); + RNA_def_property_ui_text(prop, "Restrict Animation Updates", "Restrict the number of animation updates to the animation FPS. This is better for performance, but can cause issues with smooth playback."); /* materials */ prop= RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE); diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 3c766affe56..4850c1459f4 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -187,6 +187,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c #endif bool novertexarrays = (SYS_GetCommandLineInt(syshandle, "novertexarrays", 0) != 0); bool mouse_state = startscene->gm.flag & GAME_SHOW_MOUSE; + bool restrictAnimFPS = startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES; if(animation_record) usefixed= true; /* override since you's always want fixed time for sim recording */ @@ -237,6 +238,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetNetworkDevice(networkdevice); ketsjiengine->SetUseFixedTime(usefixed); ketsjiengine->SetTimingDisplay(frameRate, profile, properties); + ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS); #ifdef WITH_PYTHON CValue::SetDeprecationWarnings(nodepwarnings); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index f2b322084ed..1c6d3efc318 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -545,6 +545,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0); bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0); + bool restrictAnimFPS = gm->flag & GAME_RESTRICT_ANIM_UPDATES; if(GLEW_ARB_multitexture && GLEW_VERSION_1_1) m_blendermat = (SYS_GetCommandLineInt(syshandle, "blender_material", 1) != 0); @@ -627,6 +628,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) m_ketsjiengine->SetUseFixedTime(fixed_framerate); m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties); + m_ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS); m_engineInitialized = true; } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 6fb03d0a573..0b83e3247ff 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -110,6 +110,7 @@ double KX_KetsjiEngine::m_anim_framerate = 25.0; double KX_KetsjiEngine::m_suspendedtime = 0.0; double KX_KetsjiEngine::m_suspendeddelta = 0.0; double KX_KetsjiEngine::m_average_framerate = 0.0; +bool KX_KetsjiEngine::m_restrict_anim_fps = false; /** @@ -660,7 +661,14 @@ else m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_ACTUATOR_UPDATE); scene->UpdateParents(m_frameTime); - + + if (!GetRestrictAnimationFPS()) + { + m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); + SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); + scene->UpdateAnimations(m_frameTime); + } + m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_PHYSICS2); scene->GetPhysicsEnvironment()->beginFrame(); @@ -769,21 +777,24 @@ else // Handle the animations independently of the logic time step - m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); - - double anim_timestep = 1.0/KX_GetActiveScene()->GetAnimationFPS(); - if (m_clockTime - m_previousAnimTime > anim_timestep) + if (GetRestrictAnimationFPS()) { - // Sanity/debug print to make sure we're actually going at the fps we want (should be close to anim_timestep) - // printf("Anim fps: %f\n", 1.0/(m_clockTime - m_previousAnimTime)); - m_previousAnimTime = m_clockTime; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit) + m_logger->StartLog(tc_animations, m_kxsystem->GetTimeInSeconds(), true); + SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE); + + double anim_timestep = 1.0/KX_GetActiveScene()->GetAnimationFPS(); + if (m_clockTime - m_previousAnimTime > anim_timestep) { - (*sceneit)->UpdateAnimations(m_frameTime); + // Sanity/debug print to make sure we're actually going at the fps we want (should be close to anim_timestep) + // printf("Anim fps: %f\n", 1.0/(m_clockTime - m_previousAnimTime)); + m_previousAnimTime = m_clockTime; + for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit) + { + (*sceneit)->UpdateAnimations(m_frameTime); + } } + m_previousClockTime = m_clockTime; } - m_previousClockTime = m_clockTime; // Start logging time spend outside main loop m_logger->StartLog(tc_outside, m_kxsystem->GetTimeInSeconds(), true); @@ -1821,6 +1832,16 @@ void KX_KetsjiEngine::SetMaxPhysicsFrame(int frame) m_maxPhysicsFrame = frame; } +bool KX_KetsjiEngine::GetRestrictAnimationFPS() +{ + return m_restrict_anim_fps; +} + +void KX_KetsjiEngine::SetRestrictAnimationFPS(bool bRestrictAnimFPS) +{ + m_restrict_anim_fps = bRestrictAnimFPS; +} + double KX_KetsjiEngine::GetAnimFrameRate() { return m_anim_framerate; diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 89419bb7773..95a6b3401a7 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -116,6 +116,8 @@ private: static double m_ticrate; static double m_anim_framerate; /* for animation playback only - ipo and action */ + static bool m_restrict_anim_fps; + static double m_suspendedtime; static double m_suspendeddelta; @@ -322,6 +324,16 @@ public: */ static void SetMaxPhysicsFrame(int frame); + /** + * Gets whether or not to lock animation updates to the animframerate + */ + static bool GetRestrictAnimationFPS(); + + /** + * Sets whether or not to lock animation updates to the animframerate + */ + static void SetRestrictAnimationFPS(bool bRestrictAnimFPS); + /** * Gets the framerate for playing animations. (actions and ipos) */ -- cgit v1.2.3 From c106f7bee96b8b420f0c6a28cd6866305eed39f3 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sat, 13 Aug 2011 16:20:28 +0000 Subject: Light blender profile param sid addressing --- source/blender/collada/LightExporter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp index 3258b63b0c3..31ade5604a7 100644 --- a/source/blender/collada/LightExporter.cpp +++ b/source/blender/collada/LightExporter.cpp @@ -141,18 +141,18 @@ bool LightsExporter::exportBlenderProfile(COLLADASW::Light &cla, Lamp *la) cla.addExtraTechniqueParameter("blender", "type", la->type); cla.addExtraTechniqueParameter("blender", "flag", la->flag); cla.addExtraTechniqueParameter("blender", "mode", la->mode); - cla.addExtraTechniqueParameter("blender", "gamma", la->k); + cla.addExtraTechniqueParameter("blender", "gamma", la->k, "blender_gamma"); cla.addExtraTechniqueParameter("blender", "red", la->r); cla.addExtraTechniqueParameter("blender", "green", la->g); cla.addExtraTechniqueParameter("blender", "blue", la->b); - cla.addExtraTechniqueParameter("blender", "shadow_r", la->shdwr); - cla.addExtraTechniqueParameter("blender", "shadow_g", la->shdwg); - cla.addExtraTechniqueParameter("blender", "shadow_b", la->shdwb); - cla.addExtraTechniqueParameter("blender", "energy", la->energy); - cla.addExtraTechniqueParameter("blender", "dist", la->dist); + cla.addExtraTechniqueParameter("blender", "shadow_r", la->shdwr, "blender_shadow_r"); + cla.addExtraTechniqueParameter("blender", "shadow_g", la->shdwg, "blender_shadow_g"); + cla.addExtraTechniqueParameter("blender", "shadow_b", la->shdwb, "blender_shadow_b"); + cla.addExtraTechniqueParameter("blender", "energy", la->energy, "blender_energy"); + cla.addExtraTechniqueParameter("blender", "dist", la->dist, "blender_dist"); cla.addExtraTechniqueParameter("blender", "spotsize", la->spotsize); cla.addExtraTechniqueParameter("blender", "spotblend", la->spotblend); - cla.addExtraTechniqueParameter("blender", "halo_intensity", la->haint); + cla.addExtraTechniqueParameter("blender", "halo_intensity", la->haint, "blnder_halo_intensity"); cla.addExtraTechniqueParameter("blender", "att1", la->att1); cla.addExtraTechniqueParameter("blender", "att2", la->att2); // \todo figure out how we can have falloff curve supported here -- cgit v1.2.3 From a4b6cfd87229a3d838544f9474e257ab4aecd371 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sat, 13 Aug 2011 16:21:41 +0000 Subject: light parameter export expansion. --- source/blender/collada/AnimationExporter.cpp | 104 +++++++++++++++++---------- source/blender/collada/AnimationExporter.h | 1 + 2 files changed, 69 insertions(+), 36 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 0f7edc9ad7d..ecaa05e3497 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -85,9 +85,8 @@ void AnimationExporter::exportAnimations(Scene *sce) while (fcu) { transformName = extract_transform_name( fcu->rna_path ); - if ((!strcmp(transformName, "color")) || - (!strcmp(transformName, "spot_size"))|| - (!strcmp(transformName, "spot_blend"))) + if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))|| (!strcmp(transformName, "spot_blend"))|| + (!strcmp(transformName, "distance")) ) dae_animation(ob , fcu, transformName, true ); fcu = fcu->next; } @@ -314,7 +313,7 @@ void AnimationExporter::exportAnimations(Scene *sce) { if ( ob->type == OB_LAMP ) target = get_light_id(ob) - + "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true); + + "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true); if ( ob->type == OB_CAMERA ) target = get_camera_id(ob) @@ -986,6 +985,54 @@ void AnimationExporter::exportAnimations(Scene *sce) return source_id; } + std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) + { + std::string tm_name; + bool is_rotation =false; + // when given rna_path, determine tm_type from it + if (rna_path) { + char *name = extract_transform_name(rna_path); + + if (!strcmp(name, "color")) + tm_type = 1; + else if (!strcmp(name, "spot_size")) + tm_type = 2; + else if (!strcmp(name, "spot_blend")) + tm_type = 3; + else if (!strcmp(name, "distance")) + tm_type = 4; + else + tm_type = -1; + } + + switch (tm_type) { + case 1: + tm_name = "color"; + break; + case 2: + tm_name = "fall_off_angle"; + break; + case 3: + tm_name = "fall_off_exponent"; + break; + case 4: + tm_name = "blender_dist"; + break; + + default: + tm_name = ""; + break; + } + + if (tm_name.size()) { + if (axis_name != "") + return tm_name + "." + std::string(axis_name); + else + return tm_name; + } + + return std::string(""); + } // for rotation, axis name is always appended and the value of append_axis is ignored std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) { @@ -1003,30 +1050,24 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_type = 2; else if (!strcmp(name, "location")) tm_type = 3; - else if (!strcmp(name, "color")) - tm_type = 4; - else if (!strcmp(name, "spot_size")) - tm_type = 5; - else if (!strcmp(name, "spot_blend")) - tm_type = 6; else if (!strcmp(name, "lens")) - tm_type = 7; + tm_type = 4; else if (!strcmp(name, "ortho_scale")) - tm_type = 8; + tm_type = 5; else if (!strcmp(name, "clip_end")) - tm_type = 9; + tm_type = 6; else if (!strcmp(name, "clip_start")) - tm_type = 10; + tm_type = 7; else if (!strcmp(name, "specular_hardness")) - tm_type = 11; + tm_type = 8; else if (!strcmp(name, "specular_color")) - tm_type = 12; + tm_type = 9; else if (!strcmp(name, "diffuse_color")) - tm_type = 13; + tm_type = 10; else if (!strcmp(name, "alpha")) - tm_type = 14; + tm_type = 11; else if (!strcmp(name, "ior")) - tm_type = 15; + tm_type = 12; else tm_type = -1; @@ -1045,39 +1086,30 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = "location"; break; case 4: - tm_name = "color"; - break; - case 5: - tm_name = "fall_off_angle"; - break; - case 6: - tm_name = "fall_off_exponent"; - break; - case 7: tm_name = "xfov"; break; - case 8: + case 5: tm_name = "xmag"; break; - case 9: + case 6: tm_name = "zfar"; break; - case 10: + case 7: tm_name = "znear"; break; - case 11: + case 8: tm_name = "shininess"; break; - case 12: + case 9: tm_name = "specular"; break; - case 13: + case 10: tm_name = "diffuse"; break; - case 14: + case 11: tm_name = "transparency"; break; - case 15: + case 12: tm_name = "index_of_refraction"; break; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index d4559782ff4..a4268122333 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -142,6 +142,7 @@ protected: std::string fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name); // for rotation, axis name is always appended and the value of append_axis is ignored std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); + std::string get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); void find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name); void find_frames(Object *ob, std::vector &fra); -- cgit v1.2.3 From c86bcd50658f03215d93fe059d11b61401847b79 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sat, 13 Aug 2011 16:22:14 +0000 Subject: transform matrix animation import fix. --- source/blender/collada/AnimationImporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index b0e636c2aa6..d8e6ae24b3b 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -976,11 +976,11 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , } } } - if (is_rotation || is_matrix) { + if (is_rotation) { if (is_joint) { - /*bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); - chan->rotmode = ROT_MODE_Quat;*/ + bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + chan->rotmode = ROT_MODE_EUL; } else { -- cgit v1.2.3 From 656adc53b42194e0b9da8d7ead307a023b8753e9 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 14 Aug 2011 04:55:52 +0000 Subject: Show dopesheet summary for new DopeSheet editors While I originally made these so that they wouldn't be on by default due to concerns over the filtering used for these leading to reduced framerates/interactive speed, I'd since found while doing some profiling that this isn't the case. Rather, decreased framerates were more likely to stem from trying to perform the checks necessary for the long-keyframe drawing when many "child" channels are involved (affecting other channels too). So, since these are generally useful, they are now enabled by default :) --- source/blender/editors/space_action/space_action.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source') diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 8cd6e388b08..4baaa469127 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -76,6 +76,8 @@ static SpaceLink *action_new(const bContext *C) saction->autosnap = SACTSNAP_FRAME; saction->mode= SACTCONT_DOPESHEET; + saction->ads.filterflag |= ADS_FILTER_SUMMARY; + /* header */ ar= MEM_callocN(sizeof(ARegion), "header for action"); -- cgit v1.2.3 From b8473d70e2da98c90c0c085ba3e38d4e327c0d9b Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 14 Aug 2011 10:19:21 +0000 Subject: Bugfix [#28244] Setting vector handle in fcurve can fail So apparently this was a regression from 2.4x, since vector handles were one of the handle types which could be set independently for each handle (vs both needing to be the same, for example, Auto Handles) --- source/blender/editors/animation/keyframes_edit.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index cc360b34516..2305848e7b3 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -792,12 +792,8 @@ static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *b /* Sets the selected bezier handles to type 'vector' */ static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { - if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { - if (bezt->f1 & SELECT) bezt->h1= HD_VECT; - if (bezt->f3 & SELECT) bezt->h2= HD_VECT; - - ENSURE_HANDLES_MATCH(bezt); - } + if (bezt->f1 & SELECT) bezt->h1= HD_VECT; + if (bezt->f3 & SELECT) bezt->h2= HD_VECT; return 0; } -- cgit v1.2.3 From fc0a5ede01d9db29471c495b18f47c0e8864e518 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 14 Aug 2011 16:13:35 +0000 Subject: Cleanup --- source/blender/collada/AnimationExporter.cpp | 26 +------------------------- source/blender/collada/AnimationExporter.h | 2 -- 2 files changed, 1 insertion(+), 27 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index ecaa05e3497..a777f4ae984 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -1016,7 +1016,7 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = "fall_off_exponent"; break; case 4: - tm_name = "blender_dist"; + tm_name = "blender/blender_dist"; break; default: @@ -1137,30 +1137,6 @@ void AnimationExporter::exportAnimations(Scene *sce) return dot ? (dot + 1) : rna_path; } - void AnimationExporter::find_all_frames(Object *ob, std::vector &fra) - { - FCurve *fcu= (FCurve*)ob->adt->action->curves.first; - std::vector keys; - for (unsigned int i = 0; i < fcu->totvert; i++) { - float f = fcu->bezt[i].vec[1][0]; // - if (std::find(keys.begin(), keys.end(), f) == keys.end()) - keys.push_back(f); - } - - std::sort(keys.begin(), keys.end()); - float first, last; - std::vector::reference ref = keys.front(); - first = ref; - ref = keys.back(); - last = ref; - for (float i = first ; i != last ; i+=1.0f ) - { - fra.push_back(i); - } - return; - - } - void AnimationExporter::find_frames(Object *ob, std::vector &fra) { FCurve *fcu= (FCurve*)ob->adt->action->curves.first; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index a4268122333..6cf3207b8a0 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -147,8 +147,6 @@ protected: void find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name); void find_frames(Object *ob, std::vector &fra); - void find_all_frames(Object *ob, std::vector &fra); - void find_rotation_frames(Object *ob, std::vector &fra, const char *prefix, int rotmode); // enable fcurves driving a specific bone, disable all the rest -- cgit v1.2.3 From e93444f8167a4df8f4bfe81ed62baf5d31807ab5 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 14 Aug 2011 16:14:32 +0000 Subject: Matrix transformation animation import for other objects under the new system. --- source/blender/collada/AnimationImporter.cpp | 67 ++++++++++++++++------------ source/blender/collada/AnimationImporter.h | 6 ++- 2 files changed, 42 insertions(+), 31 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index d8e6ae24b3b..0549f133031 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -90,7 +90,8 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues(); COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues(); - if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ) { + if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER || + curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP ) { COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); } @@ -126,7 +127,8 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) bez.vec[1][1] = bc_get_float_value(output, j * dim + i); - if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ) + if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER || + curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP) { COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues(); @@ -138,7 +140,10 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) // outtangent bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps; bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1); - bez.ipo = BEZT_IPO_BEZ; + if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) + bez.ipo = BEZT_IPO_BEZ; + else + bez.ipo = BEZT_IPO_CONST; //bez.h1 = bez.h2 = HD_AUTO; } else @@ -276,11 +281,12 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim) switch (interp) { case COLLADAFW::AnimationCurve::INTERPOLATION_LINEAR: case COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER: + case COLLADAFW::AnimationCurve::INTERPOLATION_STEP: animation_to_fcurves(curve); break; default: // TODO there're also CARDINAL, HERMITE, BSPLINE and STEP types - fprintf(stderr, "CARDINAL, HERMITE, BSPLINE and STEP anim interpolation types not supported yet.\n"); + fprintf(stderr, "CARDINAL, HERMITE and BSPLINE anim interpolation types not supported yet.\n"); break; } } @@ -749,9 +755,15 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list } -void AnimationImporter::apply_matrix_curves_to_bone( Object * ob, std::vector& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, - COLLADAFW::Transformation * tm , char * joint_path, bool is_joint,const char * bone_name) +void AnimationImporter::apply_matrix_curves( Object * ob, std::vector& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, + COLLADAFW::Transformation * tm ) { + bool is_joint = node->getType() == COLLADAFW::Node::JOINT; + const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; + char joint_path[200]; + if ( is_joint ) + armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); + std::vector frames; find_frames(&frames, &animcurves); @@ -878,11 +890,6 @@ std::sort(frames.begin(), frames.end()); add_bone_fcurve(ob, node, newcu[i]); else BLI_addtail(curves, newcu[i]); - -#ifdef ARMATURE_TEST - if (is_joint) - BLI_addtail(&job->adt->action->curves, job_curves[i]); -#endif } if (is_joint) { @@ -955,25 +962,22 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , std::vector animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; - //calculate rnapaths and array index of fcurves according to transformation and animation class - Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); - - 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; - if ((ob->type == OB_ARMATURE)){ - if ( is_matrix){ - float irest_dae[4][4]; - get_joint_rest_mat(irest_dae, root, node); - apply_matrix_curves_to_bone(ob, animcurves, root , node, transform ,joint_path , true , bone_name ); - break; - } - else + if ( is_matrix ) + apply_matrix_curves(ob, animcurves, root , node, transform ); + else { + //calculate rnapaths and array index of fcurves according to transformation and animation class + Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); + + 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; + if ((ob->type == OB_ARMATURE)) add_bone_fcurve( ob, node , fcu ); - } else - BLI_addtail(AnimCurves, fcu); - } + else + BLI_addtail(AnimCurves, fcu); + } + } } } if (is_rotation) { @@ -1862,3 +1866,8 @@ void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value) insert_bezt_fcurve(fcu, &bez, 0); calchandles_fcurve(fcu); } + +void AnimationImporter::extra_data_importer(std::string elementName ) +{ + +} diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 944e3ba5be5..9aec7df1099 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -152,8 +152,8 @@ public: AnimMix* get_animation_type( const COLLADAFW::Node * node , std::map FW_object_map ) ; - void apply_matrix_curves_to_bone( Object * ob, std::vector& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, - COLLADAFW::Transformation * tm , char * joint_path, bool is_joint,const char * bone_name); + void apply_matrix_curves( Object * ob, std::vector& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, + COLLADAFW::Transformation * tm ); void Assign_transform_animations(COLLADAFW::Transformation* transform , const COLLADAFW::AnimationList::AnimationBinding * binding, @@ -203,6 +203,8 @@ public: void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu); void add_bezt(FCurve *fcu, float fra, float value); + + void extra_data_importer(std::string elementName); }; #endif -- cgit v1.2.3 From cc3b9aa467bd9a43a28eccf990e00fddd5ed9564 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 14 Aug 2011 16:15:41 +0000 Subject: blender extra parameter animation import ( on hold ); --- source/blender/collada/DocumentImporter.cpp | 2 +- source/blender/collada/ExtraHandler.cpp | 4 +++- source/blender/collada/ExtraHandler.h | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 27442420f90..a4d1c1b451f 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -116,7 +116,7 @@ bool DocumentImporter::import() /** TODO Add error handler (implement COLLADASaxFWL::IErrorHandler */ COLLADASaxFWL::Loader loader; COLLADAFW::Root root(&loader, this); - ExtraHandler *ehandler = new ExtraHandler(this); + ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer)); loader.registerExtraDataCallbackHandler(ehandler); diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp index 9999a61a470..a60ef8b2ea5 100644 --- a/source/blender/collada/ExtraHandler.cpp +++ b/source/blender/collada/ExtraHandler.cpp @@ -31,9 +31,10 @@ #include "ExtraHandler.h" -ExtraHandler::ExtraHandler(DocumentImporter *dimp) : currentExtraTags(0) +ExtraHandler::ExtraHandler(DocumentImporter *dimp, AnimationImporter *aimp) : currentExtraTags(0) { this->dimp = dimp; + this->aimp = aimp; } ExtraHandler::~ExtraHandler() {} @@ -42,6 +43,7 @@ bool ExtraHandler::elementBegin( const char* elementName, const char** attribute { // \todo attribute handling for profile tags currentElement = std::string(elementName); + //addToSidTree(attributes[0], attributes[1]); return true; } diff --git a/source/blender/collada/ExtraHandler.h b/source/blender/collada/ExtraHandler.h index de3b063290d..7296aaf1eb4 100644 --- a/source/blender/collada/ExtraHandler.h +++ b/source/blender/collada/ExtraHandler.h @@ -32,8 +32,10 @@ #include // sort() #include "COLLADASaxFWLIExtraDataCallbackHandler.h" +#include "COLLADASaxFWLFilePartLoader.h" #include "DocumentImporter.h" +#include "AnimationImporter.h" /** \brief Handler class for data, through which different * profiles can be handled @@ -42,7 +44,7 @@ class ExtraHandler : public COLLADASaxFWL::IExtraDataCallbackHandler { public: /** Constructor. */ - ExtraHandler(DocumentImporter *dimp); + ExtraHandler(DocumentImporter *dimp, AnimationImporter *aimp); /** Destructor. */ virtual ~ExtraHandler(); @@ -69,6 +71,7 @@ private: /** Handle to DocumentImporter for interface to extra element data saving. */ DocumentImporter* dimp; + AnimationImporter* aimp; /** Holds Id of element for which XML elements are handled. */ COLLADAFW::UniqueId currentUid; ExtraTags* currentExtraTags; -- cgit v1.2.3 From 674d1b8d68330113967fd0bb6b34edaf9c619cae Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 15 Aug 2011 10:37:26 +0000 Subject: Select by Keying Set... * Split off code to refresh relative/builtin KeyingSets for the current context before they get used to a separate function. * Hooked this up to a new PyAPI/RNA function: KeyingSet.refresh(). Call this before checking the paths that a Keying Set has, especially if it is not "absolute" * Added option for "Select Grouped" operator (for Objects), which will select all objects affected by the active Keying Set. This is probably more useful for absolute KeyingSets, where changing the selection is less likely to affect the result. - The equivalent for bones is currently still in development, but is likely to be more useful for animators, where rigs are the primary animation entities they deal with --- source/blender/editors/animation/keyingsets.c | 69 +++++++++++++++------- source/blender/editors/include/ED_keyframing.h | 3 + source/blender/editors/object/object_select.c | 40 +++++++++++++ source/blender/makesrna/intern/rna_animation_api.c | 33 ++++++++++- 4 files changed, 120 insertions(+), 25 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 69abd1cb5a4..dcd1c3abbde 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -875,33 +875,19 @@ void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA * /* KeyingSet Operations (Insert/Delete Keyframes) ------------ */ -/* Given a KeyingSet and context info (if required), modify keyframes for the channels specified - * by the KeyingSet. This takes into account many of the different combinations of using KeyingSets. - * Returns the number of channels that keyframes were added to +/* Given a KeyingSet and context info, validate Keying Set's paths. + * This is only really necessary with relative/built-in KeyingSets + * where their list of paths is dynamically generated based on the + * current context info. + * + * Returns 0 if succeeded, otherwise an error code: eModifyKey_Returns */ -int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra) +short ANIM_validate_keyingset (bContext *C, ListBase *dsources, KeyingSet *ks) { - Scene *scene= CTX_data_scene(C); - ReportList *reports = CTX_wm_reports(C); - KS_Path *ksp; - int kflag=0, success= 0; - char *groupname= NULL; - - /* sanity checks */ + /* sanity check */ if (ks == NULL) return 0; - /* get flags to use */ - if (mode == MODIFYKEY_MODE_INSERT) { - /* use KeyingSet's flags as base */ - kflag= ks->keyingflag; - - /* suppliment with info from the context */ - kflag |= ANIM_get_keyframing_flags(scene, 1); - } - else if (mode == MODIFYKEY_MODE_DELETE) - kflag= 0; - /* if relative Keying Sets, poll and build up the paths */ if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo); @@ -936,6 +922,45 @@ int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingS } } + /* succeeded; return 0 to tag error free */ + return 0; +} + +/* Given a KeyingSet and context info (if required), modify keyframes for the channels specified + * by the KeyingSet. This takes into account many of the different combinations of using KeyingSets. + * Returns the number of channels that keyframes were added to + */ +int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra) +{ + Scene *scene= CTX_data_scene(C); + ReportList *reports = CTX_wm_reports(C); + KS_Path *ksp; + int kflag=0, success= 0; + char *groupname= NULL; + + /* sanity checks */ + if (ks == NULL) + return 0; + + /* get flags to use */ + if (mode == MODIFYKEY_MODE_INSERT) { + /* use KeyingSet's flags as base */ + kflag= ks->keyingflag; + + /* suppliment with info from the context */ + kflag |= ANIM_get_keyframing_flags(scene, 1); + } + else if (mode == MODIFYKEY_MODE_DELETE) + kflag= 0; + + /* if relative Keying Sets, poll and build up the paths */ + success = ANIM_validate_keyingset(C, dsources, ks); + + if (success != 0) { + /* return error code if failed */ + return success; + } + /* apply the paths as specified in the KeyingSet now */ for (ksp= ks->paths.first; ksp; ksp= ksp->next) { int arraylen, i; diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 9dbe86bc5ac..cda3c4f3e71 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -176,6 +176,9 @@ typedef enum eModifyKey_Returns { MODIFYKEY_MISSING_TYPEINFO = -2, } eModifyKey_Returns; +/* poll the current KeyingSet, updating it's set of paths (if "builtin"/"relative") for context changes */ +short ANIM_validate_keyingset(struct bContext *C, ListBase *dsources, struct KeyingSet *ks); + /* use the specified KeyingSet to add/remove various Keyframes on the specified frame */ int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction *act, struct KeyingSet *ks, short mode, float cfra); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index a3bd399a60c..b3c4ffc0ac9 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -37,6 +37,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_anim_types.h" #include "DNA_group_types.h" #include "DNA_material_types.h" #include "DNA_modifier_types.h" @@ -65,6 +66,7 @@ #include "ED_object.h" #include "ED_screen.h" +#include "ED_keyframing.h" #include "UI_interface.h" #include "UI_resources.h" @@ -363,6 +365,7 @@ static EnumPropertyItem prop_select_grouped_types[] = { {9, "PASS", 0, "Pass", "Render pass Index"}, {10, "COLOR", 0, "Color", "Object Color"}, {11, "PROPERTIES", 0, "Properties", "Game Properties"}, + {12, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"}, {0, NULL, 0, NULL, NULL} }; @@ -574,6 +577,42 @@ static short select_grouped_gameprops(bContext *C, Object *ob) return changed; } +static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob)) +{ + KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C)); + short changed = 0; + + /* firstly, validate KeyingSet */ + if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 0)) + return 0; + + /* select each object that Keying Set refers to */ + // TODO: perhaps to be more in line with the rest of these, we should only take objects + // if the passed in object is included in this too + CTX_DATA_BEGIN(C, Base*, base, selectable_bases) + { + /* only check for this object if it isn't selected already, to limit time wasted */ + if ((base->flag & SELECT) == 0) { + KS_Path *ksp; + + /* this is the slow way... we could end up with > 500 items here, + * with none matching, but end up doing this on 1000 objects... + */ + for (ksp = ks->paths.first; ksp; ksp = ksp->next) { + /* if id matches, select then stop looping (match found) */ + if (ksp->id == base->object) { + ED_base_object_select(base, BA_SELECT); + changed = 1; + break; + } + } + } + } + CTX_DATA_END; + + return changed; +} + static int object_select_grouped_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -608,6 +647,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) else if(nr==9) changed |= select_grouped_index_object(C, ob); else if(nr==10) changed |= select_grouped_color(C, ob); else if(nr==11) changed |= select_grouped_gameprops(C, ob); + else if(nr==12) changed |= select_grouped_keyingset(C, ob); if (changed) { WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C)); diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c index b3d2c02d0e4..714a74ec424 100644 --- a/source/blender/makesrna/intern/rna_animation_api.c +++ b/source/blender/makesrna/intern/rna_animation_api.c @@ -39,16 +39,43 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" + #ifdef RNA_RUNTIME -#include "BKE_animsys.h" +#include "BKE_context.h" +#include "BKE_report.h" + +#include "ED_keyframing.h" + +static void rna_KeyingSet_context_refresh(KeyingSet *ks, bContext *C, ReportList *reports) +{ + // TODO: enable access to providing a list of overrides (dsources)? + int success = ANIM_validate_keyingset(C, NULL, ks); + + if (success != 0) { + switch (success) { + case MODIFYKEY_INVALID_CONTEXT: + BKE_report(reports, RPT_ERROR, "Invalid context for Keying Set"); + break; + + case MODIFYKEY_MISSING_TYPEINFO: + BKE_report(reports, RPT_ERROR, "Incomplete built-in Keying Set. Appears to be missing type info"); + break; + } + } +} #else void RNA_api_keyingset(StructRNA *srna) { -// FunctionRNA *func; -// PropertyRNA *parm; + FunctionRNA *func; + //PropertyRNA *parm; + + /* validate relative Keying Set (used to ensure paths are ok for context) */ + func= RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh"); + RNA_def_function_ui_description(func, "Refresh Keying Set to ensure that it is valid for the current context. Call before each use of one"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); } #endif -- cgit v1.2.3 From 0745f31306ce8954a2fc019b94bd301a39674d10 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 15 Aug 2011 11:34:29 +0000 Subject: "Select Grouped" by Keying Set for Bones --- source/blender/editors/armature/poseobject.c | 63 +++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 48d349ce837..be9641c10a3 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -603,6 +603,63 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend) return changed; } +static int pose_select_same_keyingset(bContext *C, Object *ob, short extend) +{ + KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C)); + KS_Path *ksp; + + bArmature *arm = (ob)? ob->data : NULL; + bPose *pose= (ob)? ob->pose : NULL; + short changed= 0; + + /* sanity checks: validate Keying Set and object */ + if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 0)) + return 0; + + if (ELEM3(NULL, ob, pose, arm)) + return 0; + + /* if not extending selection, deselect all selected first */ + if (extend == 0) { + CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) + { + if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) + pchan->bone->flag &= ~BONE_SELECTED; + } + CTX_DATA_END; + } + + /* iterate over elements in the Keying Set, setting selection depending on whether + * that bone is visible or not... + */ + for (ksp = ks->paths.first; ksp; ksp = ksp->next) { + /* only items related to this object will be relevant */ + if ((ksp->id == ob) && (ksp->rna_path != NULL)) { + if (strstr(ksp->rna_path, "bones")) { + char *boneName = BLI_getQuotedStr(ksp->rna_path, "bones["); + + if (boneName) { + bPoseChannel *pchan = get_pose_channel(pose, boneName); + + if (pchan) { + /* select if bone is visible and can be affected */ + if ((PBONE_VISIBLE(arm, pchan->bone)) && + (pchan->bone->flag & BONE_UNSELECTABLE)==0) + { + pchan->bone->flag |= BONE_SELECTED; + changed = 1; + } + } + + /* free temp memory */ + MEM_freeN(boneName); + } + } + } + } + + return changed; +} static int pose_select_grouped_exec (bContext *C, wmOperator *op) { @@ -621,6 +678,9 @@ static int pose_select_grouped_exec (bContext *C, wmOperator *op) case 1: /* group */ changed= pose_select_same_group(C, ob, extend); break; + case 2: /* Keying Set */ + changed= pose_select_same_keyingset(C, ob, extend); + break; default: /* layer */ changed= pose_select_same_layer(C, ob, extend); break; @@ -641,6 +701,7 @@ void POSE_OT_select_grouped (wmOperatorType *ot) static EnumPropertyItem prop_select_grouped_types[] = { {0, "LAYER", 0, "Layer", "Shared layers"}, {1, "GROUP", 0, "Group", "Shared group"}, + {2, "KEYINGSET", 0, "Keying Set", "All bones affected by active Keying Set"}, {0, NULL, 0, NULL, NULL} }; @@ -2139,7 +2200,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op)) if (pchan->rotmode == ROT_MODE_QUAT) { /* quaternions have 720 degree range */ negate_v4(pchan->quat); - + /* tagging */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { ListBase dsources = {NULL, NULL}; -- cgit v1.2.3 From 87e8b853a64ea14d7d038ac2c9c16b469d6e0228 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 15 Aug 2011 11:51:42 +0000 Subject: Remove some unused code + warning fix --- source/blender/editors/armature/poseobject.c | 75 ++++++++-------------------- 1 file changed, 21 insertions(+), 54 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index be9641c10a3..961c556b246 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -107,24 +107,6 @@ Object *ED_object_pose_armature(Object *ob) return NULL; } - -/* This function is used to indicate that a bone is selected and needs keyframes inserted */ -static void set_pose_keys (Object *ob) -{ - bArmature *arm= ob->data; - bPoseChannel *chan; - - if (ob->pose){ - for (chan=ob->pose->chanbase.first; chan; chan=chan->next){ - Bone *bone= chan->bone; - if ((bone) && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer)) - chan->flag |= POSE_KEY; - else - chan->flag &= ~POSE_KEY; - } - } -} - /* This function is used to process the necessary updates for */ void ED_armature_enter_posemode(bContext *C, Base *base) { @@ -634,7 +616,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend) */ for (ksp = ks->paths.first; ksp; ksp = ksp->next) { /* only items related to this object will be relevant */ - if ((ksp->id == ob) && (ksp->rna_path != NULL)) { + if ((ksp->id == &ob->id) && (ksp->rna_path != NULL)) { if (strstr(ksp->rna_path, "bones")) { char *boneName = BLI_getQuotedStr(ksp->rna_path, "bones["); @@ -1005,6 +987,25 @@ void free_posebuf(void) g_posebuf=NULL; } +/* This function is used to indicate that a bone is selected + * and needs to be included in copy buffer (used to be for inserting keys) + */ +static void set_pose_keys (Object *ob) +{ + bArmature *arm= ob->data; + bPoseChannel *chan; + + if (ob->pose){ + for (chan=ob->pose->chanbase.first; chan; chan=chan->next){ + Bone *bone= chan->bone; + if ((bone) && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer)) + chan->flag |= POSE_KEY; + else + chan->flag &= ~POSE_KEY; + } + } +} + /* ---- */ static int pose_copy_exec (bContext *C, wmOperator *op) @@ -1239,7 +1240,7 @@ void POSE_OT_paste (wmOperatorType *ot) } /* ********************************************** */ - +/* Bone Groups */ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op)) { @@ -2253,40 +2254,6 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot) /* context: active channel */ #if 0 -void pose_special_editmenu(Scene *scene) -{ - Object *obedit= scene->obedit; // XXX context - Object *ob= OBACT; - short nr; - - /* paranoia checks */ - if(!ob && !ob->pose) return; - if(ob==obedit || (ob->mode & OB_MODE_POSE)==0) return; - - nr= pupmenu("Specials%t|Select Constraint Target%x1|Flip Left-Right Names%x2|Calculate Paths%x3|Clear Paths%x4|Clear User Transform %x5|Relax Pose %x6|%l|AutoName Left-Right%x7|AutoName Front-Back%x8|AutoName Top-Bottom%x9"); - if(nr==1) { - pose_select_constraint_target(scene); - } - else if(nr==2) { - pose_flip_names(); - } - else if(nr==3) { - pose_calculate_path(C, ob); - } - else if(nr==4) { - pose_clear_paths(ob); - } - else if(nr==5) { - pose_clear_user_transforms(ob); - } - else if(nr==6) { - pose_relax(); - } - else if(ELEM3(nr, 7, 8, 9)) { - pose_autoside_names(nr-7); - } -} - /* Restore selected pose-bones to 'action'-defined pose */ static void pose_clear_user_transforms(Object *ob) -- cgit v1.2.3 From cbbbf31315bf57aed5ccfec02f29495b2e3767ec Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 15 Aug 2011 13:24:53 +0000 Subject: Restoring "Clear User Transforms" operator This can now be found as Pose -> Clear Transforms -> Reset Unkeyed, or via the operator search (known by its old name there) --- source/blender/editors/armature/armature_intern.h | 1 + source/blender/editors/armature/armature_ops.c | 1 + source/blender/editors/armature/poseobject.c | 329 +++++++++++++--------- 3 files changed, 196 insertions(+), 135 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index cc654f6d2bc..47123b7fb4d 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -93,6 +93,7 @@ void POSE_OT_rot_clear(struct wmOperatorType *ot); void POSE_OT_loc_clear(struct wmOperatorType *ot); void POSE_OT_scale_clear(struct wmOperatorType *ot); void POSE_OT_transforms_clear(struct wmOperatorType *ot); +void POSE_OT_user_transforms_clear(struct wmOperatorType *ot); void POSE_OT_copy(struct wmOperatorType *ot); void POSE_OT_paste(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 28454fa0fa9..81ece9ddc9a 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -108,6 +108,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(POSE_OT_loc_clear); WM_operatortype_append(POSE_OT_scale_clear); WM_operatortype_append(POSE_OT_transforms_clear); + WM_operatortype_append(POSE_OT_user_transforms_clear); WM_operatortype_append(POSE_OT_copy); WM_operatortype_append(POSE_OT_paste); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 961c556b246..d2f32837d6d 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -47,6 +47,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "BKE_animsys.h" #include "BKE_anim.h" #include "BKE_idprop.h" #include "BKE_action.h" @@ -1006,6 +1007,130 @@ static void set_pose_keys (Object *ob) } } +/* perform paste pose, for a single bone + * < ob: object where bone to paste to lives + * < chan: bone that pose to paste comes from + * < selOnly: only paste on selected bones + * < flip: flip on x-axis + * + * > returns: whether the bone that we pasted to if we succeeded + */ +static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short selOnly, short flip) +{ + bPoseChannel *pchan; + char name[32]; + short paste_ok; + + /* get the name - if flipping, we must flip this first */ + if (flip) + flip_side_name(name, chan->name, 0); /* 0 = don't strip off number extensions */ + else + BLI_strncpy(name, chan->name, sizeof(name)); + + /* only copy when: + * 1) channel exists - poses are not meant to add random channels to anymore + * 2) if selection-masking is on, channel is selected - only selected bones get pasted on, allowing making both sides symmetrical + */ + pchan= get_pose_channel(ob->pose, name); + + if (selOnly) + paste_ok= ((pchan) && (pchan->bone->flag & BONE_SELECTED)); + else + paste_ok= ((pchan != NULL)); + + /* continue? */ + if (paste_ok) { + /* only loc rot size + * - only copies transform info for the pose + */ + VECCOPY(pchan->loc, chan->loc); + VECCOPY(pchan->size, chan->size); + pchan->flag= chan->flag; + + /* check if rotation modes are compatible (i.e. do they need any conversions) */ + if (pchan->rotmode == chan->rotmode) { + /* copy the type of rotation in use */ + if (pchan->rotmode > 0) { + VECCOPY(pchan->eul, chan->eul); + } + else if (pchan->rotmode == ROT_MODE_AXISANGLE) { + VECCOPY(pchan->rotAxis, chan->rotAxis); + pchan->rotAngle = chan->rotAngle; + } + else { + QUATCOPY(pchan->quat, chan->quat); + } + } + else if (pchan->rotmode > 0) { + /* quat/axis-angle to euler */ + if (chan->rotmode == ROT_MODE_AXISANGLE) + axis_angle_to_eulO( pchan->eul, pchan->rotmode,chan->rotAxis, chan->rotAngle); + else + quat_to_eulO( pchan->eul, pchan->rotmode,chan->quat); + } + else if (pchan->rotmode == ROT_MODE_AXISANGLE) { + /* quat/euler to axis angle */ + if (chan->rotmode > 0) + eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, chan->eul, chan->rotmode); + else + quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, chan->quat); + } + else { + /* euler/axis-angle to quat */ + if (chan->rotmode > 0) + eulO_to_quat(pchan->quat, chan->eul, chan->rotmode); + else + axis_angle_to_quat(pchan->quat, chan->rotAxis, pchan->rotAngle); + } + + /* paste flipped pose? */ + if (flip) { + pchan->loc[0]*= -1; + + /* has to be done as eulers... */ + if (pchan->rotmode > 0) { + pchan->eul[1] *= -1; + pchan->eul[2] *= -1; + } + else if (pchan->rotmode == ROT_MODE_AXISANGLE) { + float eul[3]; + + axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, pchan->rotAxis, pchan->rotAngle); + eul[1]*= -1; + eul[2]*= -1; + eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, eul, EULER_ORDER_DEFAULT); + } + else { + float eul[3]; + + normalize_qt(pchan->quat); + quat_to_eul(eul, pchan->quat); + eul[1]*= -1; + eul[2]*= -1; + eul_to_quat(pchan->quat, eul); + } + } + + /* ID properties */ + if (chan->prop) { + if (pchan->prop) { + /* if we have existing properties on a bone, just copy over the values of + * matching properties (i.e. ones which will have some impact) on to the + * target instead of just blinding replacing all [ + */ + IDP_SyncGroupValues(pchan->prop, chan->prop); + } + else { + /* no existing properties, so assume that we want copies too? */ + pchan->prop= IDP_CopyProperty(chan->prop); + } + } + } + + /* return whether paste went ahead */ + return pchan; +} + /* ---- */ static int pose_copy_exec (bContext *C, wmOperator *op) @@ -1048,9 +1173,9 @@ void POSE_OT_copy (wmOperatorType *ot) static int pose_paste_exec (bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); - bPoseChannel *chan, *pchan; + Scene *scene= CTX_data_scene(C); + bPoseChannel *chan; int flip= RNA_boolean_get(op->ptr, "flipped"); int selOnly= RNA_boolean_get(op->ptr, "selected_mask"); @@ -1074,115 +1199,11 @@ static int pose_paste_exec (bContext *C, wmOperator *op) /* Safely merge all of the channels in the buffer pose into any existing pose */ for (chan= g_posebuf->chanbase.first; chan; chan=chan->next) { if (chan->flag & POSE_KEY) { - char name[32]; - short paste_ok; + /* try to perform paste on this bone */ + bPoseChannel *pchan = pose_bone_do_paste(ob, chan, selOnly, flip); - /* get the name - if flipping, we must flip this first */ - if (flip) - flip_side_name(name, chan->name, 0); /* 0 = don't strip off number extensions */ - else - BLI_strncpy(name, chan->name, sizeof(name)); - - /* only copy when: - * 1) channel exists - poses are not meant to add random channels to anymore - * 2) if selection-masking is on, channel is selected - only selected bones get pasted on, allowing making both sides symmetrical - */ - pchan= get_pose_channel(ob->pose, name); - - if (selOnly) - paste_ok= ((pchan) && (pchan->bone->flag & BONE_SELECTED)); - else - paste_ok= ((pchan != NULL)); - - /* continue? */ - if (paste_ok) { - /* only loc rot size - * - only copies transform info for the pose - */ - VECCOPY(pchan->loc, chan->loc); - VECCOPY(pchan->size, chan->size); - pchan->flag= chan->flag; - - /* check if rotation modes are compatible (i.e. do they need any conversions) */ - if (pchan->rotmode == chan->rotmode) { - /* copy the type of rotation in use */ - if (pchan->rotmode > 0) { - VECCOPY(pchan->eul, chan->eul); - } - else if (pchan->rotmode == ROT_MODE_AXISANGLE) { - VECCOPY(pchan->rotAxis, chan->rotAxis); - pchan->rotAngle = chan->rotAngle; - } - else { - QUATCOPY(pchan->quat, chan->quat); - } - } - else if (pchan->rotmode > 0) { - /* quat/axis-angle to euler */ - if (chan->rotmode == ROT_MODE_AXISANGLE) - axis_angle_to_eulO( pchan->eul, pchan->rotmode,chan->rotAxis, chan->rotAngle); - else - quat_to_eulO( pchan->eul, pchan->rotmode,chan->quat); - } - else if (pchan->rotmode == ROT_MODE_AXISANGLE) { - /* quat/euler to axis angle */ - if (chan->rotmode > 0) - eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, chan->eul, chan->rotmode); - else - quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, chan->quat); - } - else { - /* euler/axis-angle to quat */ - if (chan->rotmode > 0) - eulO_to_quat(pchan->quat, chan->eul, chan->rotmode); - else - axis_angle_to_quat(pchan->quat, chan->rotAxis, pchan->rotAngle); - } - - /* paste flipped pose? */ - if (flip) { - pchan->loc[0]*= -1; - - /* has to be done as eulers... */ - if (pchan->rotmode > 0) { - pchan->eul[1] *= -1; - pchan->eul[2] *= -1; - } - else if (pchan->rotmode == ROT_MODE_AXISANGLE) { - float eul[3]; - - axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, pchan->rotAxis, pchan->rotAngle); - eul[1]*= -1; - eul[2]*= -1; - eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, eul, EULER_ORDER_DEFAULT); - } - else { - float eul[3]; - - normalize_qt(pchan->quat); - quat_to_eul(eul, pchan->quat); - eul[1]*= -1; - eul[2]*= -1; - eul_to_quat(pchan->quat, eul); - } - } - - /* ID properties */ - if (chan->prop) { - if (pchan->prop) { - /* if we have existing properties on a bone, just copy over the values of - * matching properties (i.e. ones which will have some impact) on to the - * target instead of just blinding replacing all [ - */ - IDP_SyncGroupValues(pchan->prop, chan->prop); - } - else { - /* no existing properties, so assume that we want copies too? */ - pchan->prop= IDP_CopyProperty(chan->prop); - } - } - - /* keyframing tagging */ + if (pchan) { + /* keyframing tagging for successful paste */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { ListBase dsources = {NULL, NULL}; @@ -2187,6 +2208,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot) } /* ********************************************** */ +/* Flip Quats */ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op)) { @@ -2251,41 +2273,78 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot) } /* ********************************************** */ +/* Clear User Transforms */ -/* context: active channel */ -#if 0 - -/* Restore selected pose-bones to 'action'-defined pose */ -static void pose_clear_user_transforms(Object *ob) +static int pose_clear_user_transforms_exec (bContext *C, wmOperator *op) { - bArmature *arm= ob->data; - bPoseChannel *pchan; - - if (ob->pose == NULL) - return; + Scene *scene = CTX_data_scene(C); + Object *ob = CTX_data_active_object(C); + float cframe = (float)CFRA; - /* if the object has an action, restore pose to the pose defined by the action by clearing pose on selected bones */ - if (ob->action) { - /* find selected bones */ - for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { - if (pchan->bone && (pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) { - /* just clear the BONE_UNKEYED flag, allowing this bone to get overwritten by actions again */ - pchan->bone->flag &= ~BONE_UNKEYED; - } + if ((ob->adt) && (ob->adt->action)) { + /* XXX: this is just like this to avoid contaminating anything else; + * just pose values should change, so this should be fine + */ + bPose *dummyPose = NULL; + Object workob = {{0}}; + bPoseChannel *pchan; + + /* execute animation step for current frame using a dummy copy of the pose */ + copy_pose(&dummyPose, ob->pose, 0); + + BLI_strncpy(workob.id.name, "OB", sizeof(workob.id.name)); + workob.type = OB_ARMATURE; + workob.data = ob->data; + workob.adt = ob->adt; + workob.pose = dummyPose; + + BKE_animsys_evaluate_animdata(scene, &workob.id, workob.adt, cframe, ADT_RECALC_ANIM); + + /* copy back values, but on selected bones only */ + for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) { + pose_bone_do_paste(ob, pchan, 1, 0); } - /* clear pose locking flag - * - this will only clear the user-defined pose in the selected bones, where BONE_UNKEYED has been cleared - */ - ob->pose->flag |= POSE_DO_UNLOCK; + /* free temp data - free manually as was copied without constraints */ + if (dummyPose) { + for (pchan= dummyPose->chanbase.first; pchan; pchan= pchan->next) { + if (pchan->prop) { + IDP_FreeProperty(pchan->prop); + MEM_freeN(pchan->prop); + } + } + + /* was copied without constraints */ + BLI_freelistN(&dummyPose->chanbase); + MEM_freeN(dummyPose); + } } else { - /* no action, so restore entire pose to rest pose (cannot restore only selected bones) */ + /* no animation, so just reset whole pose to rest pose + * (cannot just restore for selected though) + */ rest_pose(ob->pose); } + /* notifiers and updates */ DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - BIF_undo_push("Clear User Transform"); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); + + return OPERATOR_FINISHED; +} + +void POSE_OT_user_transforms_clear (wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Clear User Transforms"; + ot->idname= "POSE_OT_user_transforms_clear"; + ot->description= "Reset pose on selected bones to keyframed state"; + + /* callbacks */ + ot->exec= pose_clear_user_transforms_exec; + ot->poll= ED_operator_posemode; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -#endif -- cgit v1.2.3 From a458de88b65c5fcb0f11c005c040163d3cf76cec Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Mon, 15 Aug 2011 21:50:09 +0000 Subject: 3D Audio GSoC: High quality resampling on mixdown, linear for playback. * Lots of improvements and fixes for the JOS resampler, now it works fine! * High quality filter coefficients for the JOS resampler (sorry for the 5 MB source file). * Fix for GE orientation bug. Note: moto uses x,y,z,w quaternion storage, while rest of blender uses w,x,y,z. * Minor changes/fixes. --- source/blender/blenkernel/intern/sound.c | 9 +-------- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 6 +++--- source/gameengine/Ketsji/KX_SoundActuator.cpp | 6 +++--- 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 9c62b92a924..d7385a86105 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -372,14 +372,7 @@ void sound_load(struct Main *bmain, struct bSound* sound) AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume) { - AUD_Device* mixdown = AUD_openReadDevice(specs); - - AUD_setDeviceVolume(mixdown, volume); - - AUD_setSequencerSpecs(scene->sound_scene, specs.specs); - AUD_freeHandle(AUD_playDevice(mixdown, scene->sound_scene, start / FPS)); - - return mixdown; + return AUD_openMixdownDevice(specs, scene->sound_scene, volume, start / FPS); } void sound_create_scene(struct Scene *scene) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 0b83e3247ff..a51105e0c16 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1016,15 +1016,15 @@ void KX_KetsjiEngine::DoSound(KX_Scene* scene) if(dev) { AUD_Vector3 v; - AUD_Quaternion q; + float q[4]; cam->NodeGetWorldPosition().getValue(v.get()); dev->setListenerLocation(v); cam->GetLinearVelocity().getValue(v.get()); dev->setListenerVelocity(v); - cam->NodeGetWorldOrientation().getRotation().getValue(q.get()); - dev->setListenerOrientation(q); + cam->NodeGetWorldOrientation().getRotation().getValue(q); + dev->setListenerOrientation(AUD_Quaternion(q[3], q[0], q[1], q[2])); } } diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index eb1a13f672d..eb75e4944a7 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -224,14 +224,14 @@ bool KX_SoundActuator::Update(double curtime, bool frame) { KX_GameObject* obj = (KX_GameObject*)this->GetParent(); AUD_Vector3 v; - AUD_Quaternion q; + float q[4]; obj->NodeGetWorldPosition().getValue(v.get()); handle3d->setSourceLocation(v); obj->GetLinearVelocity().getValue(v.get()); handle3d->setSourceVelocity(v); - obj->NodeGetWorldOrientation().getRotation().getValue(q.get()); - handle3d->setSourceOrientation(q); + obj->NodeGetWorldOrientation().getRotation().getValue(q); + handle3d->setSourceOrientation(AUD_Quaternion(q[3], q[0], q[1], q[2])); } result = true; } -- cgit v1.2.3 From a67562e73cbc2f4a9641fbc4d1147b4b2cc935c4 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 16 Aug 2011 01:02:26 +0000 Subject: Bugfix [#28267] keyframed values for shapekeys of copied objects are linked Shapekey actions weren't getting copied when their owner data was. This was due to the IMO totally convoluted way in which the duplicate action flags have been set up: - the function to copy animdata takes a param to specify whether actions are copied or not, but this is never touched (i.e. this always just gets FALSE passed in) - instead, we jump around in hoops later figuring out whether the userpref wants copying to occur, then fixing up the links IIRC, part of this may be due to a desire/need to not duplicate actions when dealing with NodeTree copies for multi-threaded rendering, but at the expense of complicating everything else. --- source/blender/blenkernel/intern/anim_sys.c | 2 +- source/blender/blenkernel/intern/fmodifier.c | 2 +- source/blender/editors/object/object_add.c | 27 +++++---------------------- 3 files changed, 7 insertions(+), 24 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 1c4746b1828..3c6daf8b39d 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -287,7 +287,7 @@ int BKE_copy_animdata_id (ID *id_to, ID *id_from, const short do_action) return 1; } -void BKE_copy_animdata_id_action(struct ID *id) +void BKE_copy_animdata_id_action(ID *id) { AnimData *adt= BKE_animdata_from_id(id); if (adt) { diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 64e51023816..42554679795 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -604,7 +604,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue), /* calculate the 'number' of the cycle */ cycle= ((float)side * (evaltime - ofs) / cycdx); - + /* calculate the time inside the cycle */ cyct= fmod(evaltime - ofs, cycdx); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 09ce2562e3b..6bc4c30a898 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -39,6 +39,7 @@ #include "DNA_curve_types.h" #include "DNA_group_types.h" #include "DNA_lamp_types.h" +#include "DNA_key_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_meta_types.h" @@ -65,6 +66,7 @@ #include "BKE_group.h" #include "BKE_lattice.h" #include "BKE_library.h" +#include "BKE_key.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_mball.h" @@ -1496,28 +1498,6 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base } /* duplicates using userflags */ -#if 0 // XXX old animation system - if(dupflag & USER_DUP_IPO) { - bConstraintChannel *chan; - id= (ID *)obn->ipo; - - if(id) { - ID_NEW_US( obn->ipo) - else obn->ipo= copy_ipo(obn->ipo); - id->us--; - } - /* Handle constraint ipos */ - for (chan=obn->constraintChannels.first; chan; chan=chan->next){ - id= (ID *)chan->ipo; - if(id) { - ID_NEW_US( chan->ipo) - else chan->ipo= copy_ipo(chan->ipo); - id->us--; - } - } - } -#endif // XXX old animation system - if(dupflag & USER_DUP_ACT) { BKE_copy_animdata_id_action(&obn->id); } @@ -1674,8 +1654,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base /* check if obdata is copied */ if(didit) { + Key *key = ob_get_key(obn); + if(dupflag & USER_DUP_ACT) { BKE_copy_animdata_id_action((ID *)obn->data); + if(key) BKE_copy_animdata_id_action((ID*)key); } if(dupflag & USER_DUP_MAT) { -- cgit v1.2.3 From 02d2472baacd8ac091a29392a2bc9ac8693fb5e7 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 16 Aug 2011 13:00:55 +0000 Subject: 3D Audio GSoC: Code documentation. Also: * Fix: rlint for MSVC. * Minor other small fixes/changes. --- source/blender/makesrna/intern/rna_scene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7f8aeb65209..2a558da1cb0 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -46,7 +46,7 @@ #ifdef WITH_QUICKTIME #include "quicktime_export.h" # ifdef WITH_AUDASPACE -# include "AUD_C-API.h" +# include "AUD_Space.h" # endif #endif -- cgit v1.2.3 From f04fb5b6eaed0877ddeb66e1099ed930fc439812 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Tue, 16 Aug 2011 16:03:37 +0000 Subject: Finalizing. --- source/blender/collada/AnimationExporter.cpp | 130 +++++++++++++++++++-------- source/blender/collada/AnimationExporter.h | 2 +- source/blender/collada/AnimationImporter.cpp | 2 +- source/blender/collada/AnimationImporter.h | 2 +- source/blender/collada/ArmatureExporter.cpp | 2 +- source/blender/collada/ArmatureImporter.cpp | 28 +++--- source/blender/collada/DocumentImporter.cpp | 9 +- 7 files changed, 115 insertions(+), 60 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index a777f4ae984..d2ff369c613 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -61,13 +61,14 @@ void AnimationExporter::exportAnimations(Scene *sce) bool isMatAnim = false; if(ob->adt && ob->adt->action) { - if ( ob->type == OB_ARMATURE ) + //transform matrix export for bones are temporarily disabled here. + /*if ( ob->type == OB_ARMATURE ) { bArmature *arm = (bArmature*)ob->data; for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) bake_bone_animation(ob, bone); - } + }*/ fcu = (FCurve*)ob->adt->action->curves.first; while (fcu) { transformName = extract_transform_name( fcu->rna_path ); @@ -988,8 +989,7 @@ void AnimationExporter::exportAnimations(Scene *sce) std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) { std::string tm_name; - bool is_rotation =false; - // when given rna_path, determine tm_type from it + // when given rna_path, determine tm_type from it if (rna_path) { char *name = extract_transform_name(rna_path); @@ -1033,6 +1033,57 @@ void AnimationExporter::exportAnimations(Scene *sce) return std::string(""); } + + std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) + { + std::string tm_name; + // when given rna_path, determine tm_type from it + if (rna_path) { + char *name = extract_transform_name(rna_path); + + if (!strcmp(name, "lens")) + tm_type = 0; + else if (!strcmp(name, "ortho_scale")) + tm_type = 1; + else if (!strcmp(name, "clip_end")) + tm_type = 2; + else if (!strcmp(name, "clip_start")) + tm_type = 3; + + else + tm_type = -1; + } + + switch (tm_type) { + case 0: + tm_name = "xfov"; + break; + case 1: + tm_name = "xmag"; + break; + case 2: + tm_name = "zfar"; + break; + case 3: + tm_name = "znear"; + break; + + default: + tm_name = ""; + break; + } + + if (tm_name.size()) { + if (axis_name != "") + return tm_name + "." + std::string(axis_name); + else + return tm_name; + } + + return std::string(""); + } + + // Assign sid of the animated parameter or transform // for rotation, axis name is always appended and the value of append_axis is ignored std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) { @@ -1137,6 +1188,7 @@ void AnimationExporter::exportAnimations(Scene *sce) return dot ? (dot + 1) : rna_path; } + //find keyframes of all the objects animations void AnimationExporter::find_frames(Object *ob, std::vector &fra) { FCurve *fcu= (FCurve*)ob->adt->action->curves.first; @@ -1154,38 +1206,7 @@ void AnimationExporter::exportAnimations(Scene *sce) std::sort(fra.begin(), fra.end()); } - - void AnimationExporter::find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name) - { - FCurve *fcu= (FCurve*)ob->adt->action->curves.first; - - for (; fcu; fcu = fcu->next) { - if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix))) - continue; - - char *name = extract_transform_name(fcu->rna_path); - if (!strcmp(name, tm_name)) { - for (unsigned int i = 0; i < fcu->totvert; i++) { - float f = fcu->bezt[i].vec[1][0]; // - if (std::find(fra.begin(), fra.end(), f) == fra.end()) - fra.push_back(f); - } - } - } - - // keep the keys in ascending order - std::sort(fra.begin(), fra.end()); - } - - void AnimationExporter::find_rotation_frames(Object *ob, std::vector &fra, const char *prefix, int rotmode) - { - if (rotmode > 0) - find_frames(ob, fra, prefix, "rotation_euler"); - else if (rotmode == ROT_MODE_QUAT) - find_frames(ob, fra, prefix, "rotation_quaternion"); - /*else if (rotmode == ROT_MODE_AXISANGLE) - ;*/ - } + // enable fcurves driving a specific bone, disable all the rest // if bone_name = NULL enable all fcurves @@ -1218,13 +1239,17 @@ void AnimationExporter::exportAnimations(Scene *sce) Object *ob = base->object; FCurve *fcu = 0; + //Check for object transform animations if(ob->adt && ob->adt->action) fcu = (FCurve*)ob->adt->action->curves.first; + //Check for Lamp parameter animations else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); + //Check for Camera parameter animations else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); + //Check Material Effect parameter animations. for(int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); @@ -1240,3 +1265,36 @@ void AnimationExporter::exportAnimations(Scene *sce) } return false; } + + //------------------------------- Not used in the new system.-------------------------------------------------------- + void AnimationExporter::find_rotation_frames(Object *ob, std::vector &fra, const char *prefix, int rotmode) + { + if (rotmode > 0) + find_frames(ob, fra, prefix, "rotation_euler"); + else if (rotmode == ROT_MODE_QUAT) + find_frames(ob, fra, prefix, "rotation_quaternion"); + /*else if (rotmode == ROT_MODE_AXISANGLE) + ;*/ + } + + void AnimationExporter::find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name) + { + FCurve *fcu= (FCurve*)ob->adt->action->curves.first; + + for (; fcu; fcu = fcu->next) { + if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix))) + continue; + + char *name = extract_transform_name(fcu->rna_path); + if (!strcmp(name, tm_name)) { + for (unsigned int i = 0; i < fcu->totvert; i++) { + float f = fcu->bezt[i].vec[1][0]; // + if (std::find(fra.begin(), fra.end(), f) == fra.end()) + fra.push_back(f); + } + } + } + + // keep the keys in ascending order + std::sort(fra.begin(), fra.end()); + } diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 6cf3207b8a0..e1b03b969dc 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -143,7 +143,7 @@ protected: // for rotation, axis name is always appended and the value of append_axis is ignored std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); std::string get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); - + std::string get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); void find_frames(Object *ob, std::vector &fra, const char *prefix, const char *tm_name); void find_frames(Object *ob, std::vector &fra); diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 0549f133031..29bd0bd93b7 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -17,7 +17,7 @@ * 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory, Sukhitha Jayathilake. * * ***** END GPL LICENSE BLOCK ***** */ diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 9aec7df1099..fbb53ceedb6 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -17,7 +17,7 @@ * 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory , Sukhitha Jayathilake. * * ***** END GPL LICENSE BLOCK ***** */ diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 6849e4de7dd..b033c780530 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -224,7 +224,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: mul_m4_m4m4(mat, pchan->pose_mat, ob_arm->obmat); } - TransformWriter::add_node_transform(node, mat, NULL); + TransformWriter::add_node_transform(node, mat,NULL ); } std::string ArmatureExporter::get_controller_id(Object *ob_arm, Object *ob) diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 7a3c6a0644f..7acae995396 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -17,7 +17,7 @@ * 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): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory. + * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory, Sukhitha jayathilake. * * ***** END GPL LICENSE BLOCK ***** */ @@ -37,6 +37,7 @@ #include "BKE_action.h" #include "BKE_depsgraph.h" #include "BKE_object.h" +#include "BKE_armature.h" #include "BLI_string.h" #include "ED_armature.h" @@ -97,28 +98,21 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p if (parent) bone->parent = parent; float ax[3]; - float angle = NULL; + float angle = 0; // get world-space if (parent){ mul_m4_m4m4(mat, obmat, parent_mat); - bPoseChannel *parchan = get_pose_channel(ob_arm->pose, parent->name); - if ( parchan && pchan) - mul_m4_m4m4(pchan->pose_mat, mat , parchan->pose_mat); - mat4_to_axis_angle(ax,&angle,mat); - bone->roll = angle; + } else { copy_m4_m4(mat, obmat); - float invObmat[4][4]; - invert_m4_m4(invObmat, ob_arm->obmat); - if(pchan) - mul_m4_m4m4(pchan->pose_mat, mat, invObmat); - mat4_to_axis_angle(ax,&angle,mat); - bone->roll = angle; - } - + } + float loc[3], size[3], rot[3][3]; + mat4_to_loc_rot_size( loc, rot, size, obmat); + mat3_to_vec_roll(rot, NULL, &angle ); + bone->roll=angle; // set head copy_v3_v3(bone->head, mat[3]); @@ -130,10 +124,10 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p // set parent tail if (parent && totchild == 1) { copy_v3_v3(parent->tail, bone->head); - + // not setting BONE_CONNECTED because this would lock child bone location with respect to parent // bone->flag |= BONE_CONNECTED; - + // XXX increase this to prevent "very" small bones? const float epsilon = 0.000001f; diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a4d1c1b451f..f6c985626db 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -410,15 +410,18 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren while (geom_done < geom.getCount()) { ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map, material_texture_mapping_map); - ++geom_done; + if ( ob != NULL ) + ++geom_done; } while (camera_done < camera.getCount()) { ob = create_camera_object(camera[camera_done], sce); - ++camera_done; + if ( ob != NULL ) + ++camera_done; } while (lamp_done < lamp.getCount()) { ob = create_lamp_object(lamp[lamp_done], sce); - ++lamp_done; + if ( ob != NULL ) + ++lamp_done; } while (controller_done < controller.getCount()) { COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry*)controller[controller_done]; -- cgit v1.2.3 From d79967e164c1a093df955787329da490f4878c01 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Tue, 16 Aug 2011 17:17:13 +0000 Subject: Animation Exporter clean up. --- source/blender/collada/AnimationExporter.cpp | 383 +++++++++++++-------------- source/blender/collada/AnimationExporter.h | 4 +- 2 files changed, 193 insertions(+), 194 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index d2ff369c613..e76d7c0cfa6 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -59,6 +59,8 @@ void AnimationExporter::exportAnimations(Scene *sce) FCurve *fcu; char * transformName ; bool isMatAnim = false; + + //Export transform animations if(ob->adt && ob->adt->action) { //transform matrix export for bones are temporarily disabled here. @@ -66,7 +68,7 @@ void AnimationExporter::exportAnimations(Scene *sce) { bArmature *arm = (bArmature*)ob->data; for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) - bake_bone_animation(ob, bone); + write_bone_animation_matrix(ob, bone); }*/ fcu = (FCurve*)ob->adt->action->curves.first; @@ -80,6 +82,8 @@ void AnimationExporter::exportAnimations(Scene *sce) fcu = fcu->next; } } + + //Export Lamp parameter animations if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) { fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); @@ -93,6 +97,7 @@ void AnimationExporter::exportAnimations(Scene *sce) } } + //Export Camera parameter animations if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) { fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); @@ -107,6 +112,7 @@ void AnimationExporter::exportAnimations(Scene *sce) } } + //Export Material parameter animations. for(int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); @@ -127,28 +133,30 @@ void AnimationExporter::exportAnimations(Scene *sce) } } - //if (!ob->adt || !ob->adt->action) - // fcu = (FCurve*)((Lamp*)ob->data)->adt->action->curves.first; //this is already checked in hasAnimations() - //else - // fcu = (FCurve*)ob->adt->action->curves.first; + /* Old System + if (!ob->adt || !ob->adt->action) + fcu = (FCurve*)((Lamp*)ob->data)->adt->action->curves.first; //this is already checked in hasAnimations() + else + fcu = (FCurve*)ob->adt->action->curves.first; - //if (ob->type == OB_ARMATURE) { - // if (!ob->data) return; - // bArmature *arm = (bArmature*)ob->data; - // while(fcu) - // { - // transformName = extract_transform_name( fcu->rna_path ); - // // std::string ob_name = getObjectBoneName( ob , fcu); - // // for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) - // // write_bone_animation(ob, bone); - // dae_animation(ob, fcu, ob_name, transformName); - // fcu = fcu->next; - // } - //} - //else { + if (ob->type == OB_ARMATURE) { + if (!ob->data) return; + bArmature *arm = (bArmature*)ob->data; + while(fcu) + { + transformName = extract_transform_name( fcu->rna_path ); + // std::string ob_name = getObjectBoneName( ob , fcu); + // for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) + // write_bone_animation(ob, bone); + dae_animation(ob, fcu, ob_name, transformName); + fcu = fcu->next; + } + } + else {*/ } + //euler sources from quternion sources float * AnimationExporter::get_eul_source_for_quat(Object *ob ) { FCurve *fcu = (FCurve*)ob->adt->action->curves.first; @@ -183,6 +191,8 @@ void AnimationExporter::exportAnimations(Scene *sce) return eul; } + + //Get proper name for bones std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) { //hard-way to derive the bone name from rna_path. Must find more compact method @@ -197,9 +207,9 @@ void AnimationExporter::exportAnimations(Scene *sce) return id_name(ob); } + //convert f-curves to animation curves and write void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma ) { - const char *axis_name = NULL; char anim_id[200]; @@ -210,12 +220,10 @@ void AnimationExporter::exportAnimations(Scene *sce) { fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n"); quatRotation = true; - /*const char *axis_names[] = {"", "X", "Y", "Z"}; - if (fcu->array_index < 4) - axis_name = axis_names[fcu->array_index];*/ return; } - //maybe a list or a vector of float animations + + //axis names for colors else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")|| (!strcmp(transformName, "alpha"))) { @@ -223,18 +231,24 @@ void AnimationExporter::exportAnimations(Scene *sce) if (fcu->array_index < 3) axis_name = axis_names[fcu->array_index]; } + + //axis names for transforms else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || - (!strcmp(transformName, "rotation_euler"))) + (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion"))) { const char *axis_names[] = {"X", "Y", "Z"}; if (fcu->array_index < 3) axis_name = axis_names[fcu->array_index]; } + + //no axis name. single parameter. else{ axis_name = ""; } std::string ob_name = std::string("null"); + + //Create anim Id if (ob->type == OB_ARMATURE) { ob_name = getObjectBoneName( ob , fcu); @@ -251,8 +265,6 @@ void AnimationExporter::exportAnimations(Scene *sce) fcu->rna_path, axis_name); } - // check rna_path is one of: rotation, scale, location - openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); // create input source @@ -261,6 +273,7 @@ void AnimationExporter::exportAnimations(Scene *sce) // create output source std::string output_id ; + //quat rotations are skipped for now, because of complications with determining axis. if(quatRotation) { float * eul = get_eul_source_for_quat(ob); @@ -269,7 +282,7 @@ void AnimationExporter::exportAnimations(Scene *sce) eul_axis[i] = eul[i*3 + fcu->array_index]; output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name); } - else + else { output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name); } @@ -288,7 +301,6 @@ void AnimationExporter::exportAnimations(Scene *sce) outtangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::OUT_TANGENT, fcu, anim_id, axis_name); } - std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX; COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id); std::string empty; @@ -318,7 +330,7 @@ void AnimationExporter::exportAnimations(Scene *sce) if ( ob->type == OB_CAMERA ) target = get_camera_id(ob) - + "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true); + + "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true); if( ma ) target = translate_id(id_name(ma)) + "-effect" @@ -329,34 +341,22 @@ void AnimationExporter::exportAnimations(Scene *sce) closeAnimation(); } - void AnimationExporter::bake_bone_animation(Object *ob_arm, Bone *bone) + + + //write bone animations in transform matrix sources + void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone) { if (!ob_arm->adt) return; - sample_and_bake_bone_animation(ob_arm, bone); + sample_and_write_bone_animation_matrix(ob_arm, bone); for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) - bake_bone_animation(ob_arm, child); + write_bone_animation_matrix(ob_arm, child); } - void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone) - { - if (!ob_arm->adt) - return; - - //write bone animations for 3 transform types - //i=0 --> rotations - //i=1 --> scale - //i=2 --> location - for (int i = 0; i < 3; i++) - sample_and_write_bone_animation(ob_arm, bone, i); - - for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) - write_bone_animation(ob_arm, child); - } - - void AnimationExporter::sample_and_bake_bone_animation(Object *ob_arm, Bone *bone) + + void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone) { bArmature *arm = (bArmature*)ob_arm->data; int flag = arm->flag; @@ -377,7 +377,6 @@ void AnimationExporter::exportAnimations(Scene *sce) } if (fra.size()) { - //int total = fra.back() - fra.front(); float *values = (float*)MEM_callocN(sizeof(float) * 16 * fra.size(), "temp. anim frames"); sample_animation(values, fra, bone, ob_arm, pchan); @@ -390,68 +389,6 @@ void AnimationExporter::exportAnimations(Scene *sce) where_is_pose(scene, ob_arm); } - void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) - { - bArmature *arm = (bArmature*)ob_arm->data; - int flag = arm->flag; - std::vector fra; - char prefix[256]; - - BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name); - - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); - if (!pchan) - return; - //Fill frame array with key frame values framed at @param:transform_type - switch (transform_type) { - case 0: - find_rotation_frames(ob_arm, fra, prefix, pchan->rotmode); - break; - case 1: - find_frames(ob_arm, fra, prefix, "scale"); - break; - case 2: - find_frames(ob_arm, fra, prefix, "location"); - break; - default: - return; - } - - // exit rest position - if (flag & ARM_RESTPOS) { - arm->flag &= ~ARM_RESTPOS; - where_is_pose(scene, ob_arm); - } - //v array will hold all values which will be exported. - if (fra.size()) { - float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames"); - sample_animation(values, fra, transform_type, bone, ob_arm, pchan); - - if (transform_type == 0) { - // write x, y, z curves separately if it is rotation - float *axisValues = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames"); - - for (int i = 0; i < 3; i++) { - for (unsigned int j = 0; j < fra.size(); j++) - axisValues[j] = values[j * 3 + i]; - - dae_bone_animation(fra, axisValues, transform_type, i, id_name(ob_arm), bone->name); - } - MEM_freeN(axisValues); - } - else { - // write xyz at once if it is location or scale - dae_bone_animation(fra, values, transform_type, -1, id_name(ob_arm), bone->name); - } - - MEM_freeN(values); - } - - // restore restpos - if (flag & ARM_RESTPOS) - arm->flag = flag; - where_is_pose(scene, ob_arm); - } void AnimationExporter::sample_animation(float *v, std::vector &frames, Bone *bone, Object *ob_arm, bPoseChannel *pchan) { @@ -503,56 +440,7 @@ void AnimationExporter::exportAnimations(Scene *sce) } - void AnimationExporter::sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) - { - bPoseChannel *parchan = NULL; - bPose *pose = ob_arm->pose; - - pchan = get_pose_channel(pose, bone->name); - - if (!pchan) - return; - - parchan = pchan->parent; - - enable_fcurves(ob_arm->adt->action, bone->name); - - std::vector::iterator it; - for (it = frames.begin(); it != frames.end(); it++) { - float mat[4][4], ipar[4][4]; - - float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); - - //BKE_animsys_evaluate_animdata(&ob_arm->id, ob_arm->adt, *it, ADT_RECALC_ANIM); - //BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); - where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); - - // compute bone local mat - if (bone->parent) { - invert_m4_m4(ipar, parchan->pose_mat); - mul_m4_m4m4(mat, pchan->pose_mat, ipar); - } - else - copy_m4_m4(mat, pchan->pose_mat); - - switch (type) { - case 0: - mat4_to_eul(v, mat); - break; - case 1: - mat4_to_size(v, mat); - break; - case 2: - copy_v3_v3(v, mat[3]); - break; - } - - v += 3; - } - - enable_fcurves(ob_arm->adt->action, NULL); - } - + void AnimationExporter::dae_baked_animation(std::vector &fra, float *values, std::string ob_name, std::string bone_name) { char anim_id[200]; @@ -1101,24 +989,16 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_type = 2; else if (!strcmp(name, "location")) tm_type = 3; - else if (!strcmp(name, "lens")) - tm_type = 4; - else if (!strcmp(name, "ortho_scale")) - tm_type = 5; - else if (!strcmp(name, "clip_end")) - tm_type = 6; - else if (!strcmp(name, "clip_start")) - tm_type = 7; else if (!strcmp(name, "specular_hardness")) - tm_type = 8; + tm_type = 4; else if (!strcmp(name, "specular_color")) - tm_type = 9; + tm_type = 5; else if (!strcmp(name, "diffuse_color")) - tm_type = 10; + tm_type = 6; else if (!strcmp(name, "alpha")) - tm_type = 11; + tm_type = 7; else if (!strcmp(name, "ior")) - tm_type = 12; + tm_type = 8; else tm_type = -1; @@ -1137,30 +1017,18 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = "location"; break; case 4: - tm_name = "xfov"; - break; - case 5: - tm_name = "xmag"; - break; - case 6: - tm_name = "zfar"; - break; - case 7: - tm_name = "znear"; - break; - case 8: tm_name = "shininess"; break; - case 9: + case 5: tm_name = "specular"; break; - case 10: + case 6: tm_name = "diffuse"; break; - case 11: + case 7: tm_name = "transparency"; break; - case 12: + case 8: tm_name = "index_of_refraction"; break; @@ -1298,3 +1166,134 @@ void AnimationExporter::exportAnimations(Scene *sce) // keep the keys in ascending order std::sort(fra.begin(), fra.end()); } + + void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone) + { + if (!ob_arm->adt) + return; + + //write bone animations for 3 transform types + //i=0 --> rotations + //i=1 --> scale + //i=2 --> location + for (int i = 0; i < 3; i++) + sample_and_write_bone_animation(ob_arm, bone, i); + + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) + write_bone_animation(ob_arm, child); + } + + void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type) + { + bArmature *arm = (bArmature*)ob_arm->data; + int flag = arm->flag; + std::vector fra; + char prefix[256]; + + BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name); + + bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + if (!pchan) + return; + //Fill frame array with key frame values framed at @param:transform_type + switch (transform_type) { + case 0: + find_rotation_frames(ob_arm, fra, prefix, pchan->rotmode); + break; + case 1: + find_frames(ob_arm, fra, prefix, "scale"); + break; + case 2: + find_frames(ob_arm, fra, prefix, "location"); + break; + default: + return; + } + + // exit rest position + if (flag & ARM_RESTPOS) { + arm->flag &= ~ARM_RESTPOS; + where_is_pose(scene, ob_arm); + } + //v array will hold all values which will be exported. + if (fra.size()) { + float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames"); + sample_animation(values, fra, transform_type, bone, ob_arm, pchan); + + if (transform_type == 0) { + // write x, y, z curves separately if it is rotation + float *axisValues = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames"); + + for (int i = 0; i < 3; i++) { + for (unsigned int j = 0; j < fra.size(); j++) + axisValues[j] = values[j * 3 + i]; + + dae_bone_animation(fra, axisValues, transform_type, i, id_name(ob_arm), bone->name); + } + MEM_freeN(axisValues); + } + else { + // write xyz at once if it is location or scale + dae_bone_animation(fra, values, transform_type, -1, id_name(ob_arm), bone->name); + } + + MEM_freeN(values); + } + + // restore restpos + if (flag & ARM_RESTPOS) + arm->flag = flag; + where_is_pose(scene, ob_arm); + } + + void AnimationExporter::sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) + { + bPoseChannel *parchan = NULL; + bPose *pose = ob_arm->pose; + + pchan = get_pose_channel(pose, bone->name); + + if (!pchan) + return; + + parchan = pchan->parent; + + enable_fcurves(ob_arm->adt->action, bone->name); + + std::vector::iterator it; + for (it = frames.begin(); it != frames.end(); it++) { + float mat[4][4], ipar[4][4]; + + float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); + + //BKE_animsys_evaluate_animdata(&ob_arm->id, ob_arm->adt, *it, ADT_RECALC_ANIM); + //BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); + where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); + + // compute bone local mat + if (bone->parent) { + invert_m4_m4(ipar, parchan->pose_mat); + mul_m4_m4m4(mat, pchan->pose_mat, ipar); + } + else + copy_m4_m4(mat, pchan->pose_mat); + + switch (type) { + case 0: + mat4_to_eul(v, mat); + break; + case 1: + mat4_to_size(v, mat); + break; + case 2: + copy_v3_v3(v, mat[3]); + break; + } + + v += 3; + } + + enable_fcurves(ob_arm->adt->action, NULL); + } + + diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index e1b03b969dc..6786206ee6f 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -96,13 +96,13 @@ protected: void dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material *ma = NULL); - void bake_bone_animation(Object *ob_arm, Bone *bone); + void write_bone_animation_matrix(Object *ob_arm, Bone *bone); void write_bone_animation(Object *ob_arm, Bone *bone); void sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type); - void sample_and_bake_bone_animation(Object *ob_arm, Bone *bone); + void sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone); void sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan); -- cgit v1.2.3 From 9b5c0f65aa6ef942709ea7156ee5a20e9b5f94e9 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Tue, 16 Aug 2011 19:59:08 +0000 Subject: BGE Animations: Increasing the max layer count to 8 as per a user request. Also, layer checks were checking for values between 0 and MAX_ACTION_LAYERS when they should have been checking for values between 0 and MAX_ACTION_LAYERS - 1. --- source/blender/makesrna/intern/rna_actuator.c | 2 +- source/gameengine/Ketsji/BL_ActionManager.h | 2 +- source/gameengine/Ketsji/KX_GameObject.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 3c44720d469..5eccba16c3d 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -627,7 +627,7 @@ static void rna_def_action_actuator(BlenderRNA *brna) RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "layer", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, 4); /* This should match BL_ActionManager::MAX_ACTION_LAYERS */ + RNA_def_property_range(prop, 0, 7); /* This should match BL_ActionManager::MAX_ACTION_LAYERS - 1 */ RNA_def_property_ui_text(prop, "Layer", "The animation layer to play the action on"); RNA_def_property_update(prop, NC_LOGIC, NULL); diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h index c310e231ed7..a3c8379981e 100644 --- a/source/gameengine/Ketsji/BL_ActionManager.h +++ b/source/gameengine/Ketsji/BL_ActionManager.h @@ -31,7 +31,7 @@ #include "BL_Action.h" -#define MAX_ACTION_LAYERS 4 +#define MAX_ACTION_LAYERS 8 /** * BL_ActionManager is responsible for handling a KX_GameObject's actions. diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 4f8860f4767..0864fc84a28 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -3055,7 +3055,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage, static void layer_check(short &layer, const char *method_name) { - if (layer < 0 || layer > MAX_ACTION_LAYERS) + if (layer < 0 || layer >= MAX_ACTION_LAYERS) { printf("KX_GameObject.%s(): given layer (%d) is out of range (0 - %d), setting to 0.\n", method_name, layer, MAX_ACTION_LAYERS-1); layer = 0; -- cgit v1.2.3 From 750e754604eac5048dbb0ec6ee436d6a12156808 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Tue, 16 Aug 2011 22:14:55 +0000 Subject: Adding ANIM_validate_keyingset to stubs.c so the Blenderplayer builds again. --- source/blenderplayer/bad_level_call_stubs/stubs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source') diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 45e0f526708..fdf45293e9a 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -229,6 +229,7 @@ int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){re struct ListBase builtin_keyingsets; void ANIM_keyingset_info_register (struct KeyingSetInfo *ksi){} void ANIM_keyingset_info_unregister (const struct bContext *C, struct KeyingSetInfo *ksi){} +short ANIM_validate_keyingset (struct bContext *C, struct ListBase *dsources, struct KeyingSet *ks){return 0;} short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type){return 0;} short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag){return 0;} void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock){} -- cgit v1.2.3 From db4071d2b6b727857521bd05529fe8141e8bb0a2 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 17 Aug 2011 09:38:50 +0000 Subject: BGE Animations: Lamp and Camera IPOs are now handled like object IPOs, which means lamps and cameras are no longer stuck to just their active action. However, the Blender UI seems a little restrictive in this area. --- .../Converter/BL_BlenderDataConversion.cpp | 10 +- source/gameengine/Converter/KX_IpoConvert.cpp | 137 ++++++++++++--------- source/gameengine/Converter/KX_IpoConvert.h | 8 ++ source/gameengine/Ketsji/BL_Action.cpp | 62 +++++++--- source/gameengine/Ketsji/BL_Action.h | 3 +- 5 files changed, 135 insertions(+), 85 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 9bea3f492c9..aa11e78077a 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1682,8 +1682,6 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l gamelight = new KX_LightObject(kxscene, KX_Scene::m_callbacks, rendertools, lightobj, glslmat); - - BL_ConvertLampIpos(la, gamelight, converter); return gamelight; } @@ -1696,8 +1694,6 @@ static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene, KX_Blen gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata); gamecamera->SetName(ca->id.name + 2); - BL_ConvertCameraIpos(ca, gamecamera, converter); - return gamecamera; } @@ -2092,8 +2088,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); gameobj->NodeSetLocalScale(scale); gameobj->NodeUpdateGS(0); - - BL_ConvertIpos(blenderobject,gameobj,converter); + BL_ConvertMaterialIpos(blenderobject, gameobj, converter); sumolist->Add(gameobj->AddRef()); @@ -2282,8 +2277,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); gameobj->NodeSetLocalScale(scale); gameobj->NodeUpdateGS(0); - - BL_ConvertIpos(blenderobject,gameobj,converter); + BL_ConvertMaterialIpos(blenderobject,gameobj, converter); sumolist->Add(gameobj->AddRef()); diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index 0e526bc818d..2793b8e9fdf 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -207,93 +207,108 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend } } -void BL_ConvertLampIpos(struct Lamp* blenderlamp, KX_GameObject *lightobj,KX_BlenderSceneConverter *converter) +SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject* lightobj, KX_BlenderSceneConverter *converter) { + KX_LightIpoSGController* ipocontr = new KX_LightIpoSGController(); - if (blenderlamp->adt) { + Lamp *blenderlamp = (Lamp*)lightobj->GetBlenderObject()->data; - KX_LightIpoSGController* ipocontr = new KX_LightIpoSGController(); - lightobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(lightobj->GetSGNode()); - - ipocontr->m_energy = blenderlamp->energy; - ipocontr->m_col_rgb[0] = blenderlamp->r; - ipocontr->m_col_rgb[1] = blenderlamp->g; - ipocontr->m_col_rgb[2] = blenderlamp->b; - ipocontr->m_dist = blenderlamp->dist; + ipocontr->m_energy = blenderlamp->energy; + ipocontr->m_col_rgb[0] = blenderlamp->r; + ipocontr->m_col_rgb[1] = blenderlamp->g; + ipocontr->m_col_rgb[2] = blenderlamp->b; + ipocontr->m_dist = blenderlamp->dist; - BL_InterpolatorList *adtList= GetAdtList(blenderlamp->adt->action, converter); + BL_InterpolatorList *adtList= GetAdtList(action, converter); - // For each active channel in the adtList add an - // interpolator to the game object. + // For each active channel in the adtList add an + // interpolator to the game object. - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; - if ((interp= adtList->GetScalarInterpolator("energy", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyEnergy(true); - } + if ((interp= adtList->GetScalarInterpolator("energy", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyEnergy(true); + } - if ((interp = adtList->GetScalarInterpolator("distance", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_dist, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyDist(true); - } + if ((interp = adtList->GetScalarInterpolator("distance", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_dist, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyDist(true); + } - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("color", i))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyColor(true); - } + for(int i=0; i<3; i++) { + if ((interp = adtList->GetScalarInterpolator("color", i))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyColor(true); } } + + return ipocontr; } +void BL_ConvertLampIpos(struct Lamp* blenderlamp, KX_GameObject *lightobj,KX_BlenderSceneConverter *converter) +{ + if (blenderlamp->adt) { + SG_Controller* ipocontr = BL_CreateLampIPO(blenderlamp->adt->action, lightobj, converter); + lightobj->GetSGNode()->AddSGController(ipocontr); + ipocontr->SetObject(lightobj->GetSGNode()); + + + } +} -void BL_ConvertCameraIpos(struct Camera* blendercamera, KX_GameObject *cameraobj,KX_BlenderSceneConverter *converter) +SG_Controller *BL_CreateCameraIPO(struct bAction *action, KX_GameObject* cameraobj, KX_BlenderSceneConverter *converter) { + KX_CameraIpoSGController* ipocontr = new KX_CameraIpoSGController(); - if (blendercamera->adt) { + Camera *blendercamera = (Camera*)cameraobj->GetBlenderObject()->data; - KX_CameraIpoSGController* ipocontr = new KX_CameraIpoSGController(); - cameraobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(cameraobj->GetSGNode()); - - ipocontr->m_lens = blendercamera->lens; - ipocontr->m_clipstart = blendercamera->clipsta; - ipocontr->m_clipend = blendercamera->clipend; + ipocontr->m_lens = blendercamera->lens; + ipocontr->m_clipstart = blendercamera->clipsta; + ipocontr->m_clipend = blendercamera->clipend; - BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt->action, converter); + BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt->action, converter); - // For each active channel in the adtList add an - // interpolator to the game object. + // For each active channel in the adtList add an + // interpolator to the game object. - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; + KX_IInterpolator *interpolator; + KX_IScalarInterpolator *interp; - if ((interp = adtList->GetScalarInterpolator("lens", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_lens, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyLens(true); - } + if ((interp = adtList->GetScalarInterpolator("lens", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_lens, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyLens(true); + } - if ((interp = adtList->GetScalarInterpolator("clip_start", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipstart, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyClipStart(true); - } + if ((interp = adtList->GetScalarInterpolator("clip_start", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipstart, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyClipStart(true); + } - if ((interp = adtList->GetScalarInterpolator("clip_end", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipend, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyClipEnd(true); - } + if ((interp = adtList->GetScalarInterpolator("clip_end", 0))) { + interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipend, interp); + ipocontr->AddInterpolator(interpolator); + ipocontr->SetModifyClipEnd(true); + } + return ipocontr; +} + +void BL_ConvertCameraIpos(struct Camera* blendercamera, KX_GameObject *cameraobj,KX_BlenderSceneConverter *converter) +{ + + if (blendercamera->adt) { + SG_Controller* ipocontr = BL_CreateCameraIPO(blendercamera->adt->action, cameraobj, converter); + cameraobj->GetSGNode()->AddSGController(ipocontr); + ipocontr->SetObject(cameraobj->GetSGNode()); } } diff --git a/source/gameengine/Converter/KX_IpoConvert.h b/source/gameengine/Converter/KX_IpoConvert.h index 914422ba83f..60e695c68a7 100644 --- a/source/gameengine/Converter/KX_IpoConvert.h +++ b/source/gameengine/Converter/KX_IpoConvert.h @@ -44,6 +44,10 @@ void BL_ConvertIpos(struct Object* blenderobject, class KX_GameObject* gameobj, class KX_BlenderSceneConverter *converter); +class SG_Controller *BL_CreateLampIPO(struct bAction *action, + class KX_GameObject* lightobj, + class KX_BlenderSceneConverter *converter); + void BL_ConvertLampIpos(struct Lamp* blenderlight, class KX_GameObject* lightobj, class KX_BlenderSceneConverter *converter); @@ -51,6 +55,10 @@ void BL_ConvertLampIpos(struct Lamp* blenderlight, void BL_ConvertWorldIpos(struct World* blenderworld, class KX_BlenderSceneConverter *converter); +class SG_Controller *BL_CreateCameraIPO(struct bAction *action, + class KX_GameObject* cameraobj, + class KX_BlenderSceneConverter *converter); + void BL_ConvertCameraIpos(struct Camera* blendercamera, class KX_GameObject* cameraobj, class KX_BlenderSceneConverter *converter); diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 6682b0cea41..08794042e37 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -54,7 +54,6 @@ BL_Action::BL_Action(class KX_GameObject* gameobj) m_blendpose(NULL), m_blendinpose(NULL), m_ptrrna(NULL), - m_sg_contr(NULL), m_obj(gameobj), m_startframe(0.f), m_endframe(0.f), @@ -98,13 +97,22 @@ BL_Action::~BL_Action() game_free_pose(m_blendpose); if (m_blendinpose) game_free_pose(m_blendinpose); - if (m_sg_contr) - { - m_obj->GetSGNode()->RemoveSGController(m_sg_contr); - delete m_sg_contr; - } if (m_ptrrna) delete m_ptrrna; + ClearControllerList(); +} + +void BL_Action::ClearControllerList() +{ + // Clear out the controller list + std::vector::iterator it; + for (it = m_sg_contr_list.begin(); it != m_sg_contr_list.end(); it++) + { + m_obj->GetSGNode()->RemoveSGController((*it)); + delete *it; + } + + m_sg_contr_list.clear(); } bool BL_Action::Play(const char* name, @@ -136,10 +144,30 @@ bool BL_Action::Play(const char* name, if (prev_action != m_action) { + // First get rid of any old controllers + ClearControllerList(); + // Create an SG_Controller - m_sg_contr = BL_CreateIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); - m_obj->GetSGNode()->AddSGController(m_sg_contr); - m_sg_contr->SetObject(m_obj->GetSGNode()); + SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + + // Extra controllers + if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) + { + sg_contr = BL_CreateLampIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + } + else if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_CAMERA) + { + sg_contr = BL_CreateCameraIPO(m_action, m_obj, KX_GetActiveScene()->GetSceneConverter()); + m_sg_contr_list.push_back(sg_contr); + m_obj->GetSGNode()->AddSGController(sg_contr); + sg_contr->SetObject(m_obj->GetSGNode()); + } } m_ipo_flags = ipo_flags; @@ -197,11 +225,15 @@ bool BL_Action::IsDone() void BL_Action::InitIPO() { - // Initialize the IPO - m_sg_contr->SetOption(SG_Controller::SG_CONTR_IPO_RESET, true); - m_sg_contr->SetOption(SG_Controller::SG_CONTR_IPO_IPO_AS_FORCE, m_ipo_flags & ACT_IPOFLAG_FORCE); - m_sg_contr->SetOption(SG_Controller::SG_CONTR_IPO_IPO_ADD, m_ipo_flags & ACT_IPOFLAG_ADD); - m_sg_contr->SetOption(SG_Controller::SG_CONTR_IPO_LOCAL, m_ipo_flags & ACT_IPOFLAG_LOCAL); + // Initialize the IPOs + std::vector::iterator it; + for (it = m_sg_contr_list.begin(); it != m_sg_contr_list.end(); it++) + { + (*it)->SetOption(SG_Controller::SG_CONTR_IPO_RESET, true); + (*it)->SetOption(SG_Controller::SG_CONTR_IPO_IPO_AS_FORCE, m_ipo_flags & ACT_IPOFLAG_FORCE); + (*it)->SetOption(SG_Controller::SG_CONTR_IPO_IPO_ADD, m_ipo_flags & ACT_IPOFLAG_ADD); + (*it)->SetOption(SG_Controller::SG_CONTR_IPO_LOCAL, m_ipo_flags & ACT_IPOFLAG_LOCAL); + } } bAction *BL_Action::GetAction() @@ -330,7 +362,7 @@ void BL_Action::Update(float curtime) break; } - if (!m_done && m_sg_contr) + if (!m_done) InitIPO(); } diff --git a/source/gameengine/Ketsji/BL_Action.h b/source/gameengine/Ketsji/BL_Action.h index 75bda56419a..92fbe95fd54 100644 --- a/source/gameengine/Ketsji/BL_Action.h +++ b/source/gameengine/Ketsji/BL_Action.h @@ -45,7 +45,7 @@ private: struct bPose* m_blendpose; struct bPose* m_blendinpose; struct PointerRNA *m_ptrrna; - class SG_Controller *m_sg_contr; + std::vector m_sg_contr_list; class KX_GameObject* m_obj; std::vector m_blendshape; std::vector m_blendinshape; @@ -73,6 +73,7 @@ private: bool m_done; bool m_calc_localtime; + void ClearControllerList(); void InitIPO(); void SetLocalTime(float curtime); void ResetStartTime(float curtime); -- cgit v1.2.3 From f3c05e8eb267b3c005cf7255b222ed7bf8972744 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Wed, 17 Aug 2011 18:28:01 +0000 Subject: armature animation export fix. --- source/blender/collada/AnimationExporter.cpp | 192 +++++++++++++-------------- source/blender/collada/AnimationExporter.h | 14 +- source/blender/collada/TransformWriter.cpp | 11 +- 3 files changed, 102 insertions(+), 115 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index e76d7c0cfa6..b39e9bb39d5 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -61,18 +61,19 @@ void AnimationExporter::exportAnimations(Scene *sce) bool isMatAnim = false; //Export transform animations - if(ob->adt && ob->adt->action) + if(ob->adt && ob->adt->action) { //transform matrix export for bones are temporarily disabled here. - /*if ( ob->type == OB_ARMATURE ) + if ( ob->type == OB_ARMATURE ) { bArmature *arm = (bArmature*)ob->data; for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) write_bone_animation_matrix(ob, bone); - - }*/ + + } + else { fcu = (FCurve*)ob->adt->action->curves.first; - while (fcu) { + while (fcu) { transformName = extract_transform_name( fcu->rna_path ); if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || @@ -81,6 +82,7 @@ void AnimationExporter::exportAnimations(Scene *sce) dae_animation(ob ,fcu, transformName, false); fcu = fcu->next; } + } } //Export Lamp parameter animations @@ -117,7 +119,7 @@ void AnimationExporter::exportAnimations(Scene *sce) { Material *ma = give_current_material(ob, a+1); if (!ma) continue; - if(ma->adt && ma->adt->action) + if(ma->adt && ma->adt->action) { isMatAnim = true; fcu = (FCurve*)ma->adt->action->curves.first; @@ -137,8 +139,8 @@ void AnimationExporter::exportAnimations(Scene *sce) if (!ob->adt || !ob->adt->action) fcu = (FCurve*)((Lamp*)ob->data)->adt->action->curves.first; //this is already checked in hasAnimations() else - fcu = (FCurve*)ob->adt->action->curves.first; - + fcu = (FCurve*)ob->adt->action->curves.first; + if (ob->type == OB_ARMATURE) { if (!ob->data) return; bArmature *arm = (bArmature*)ob->data; @@ -225,7 +227,7 @@ void AnimationExporter::exportAnimations(Scene *sce) //axis names for colors else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")|| - (!strcmp(transformName, "alpha"))) + (!strcmp(transformName, "alpha"))) { const char *axis_names[] = {"R", "G", "B"}; if (fcu->array_index < 3) @@ -248,10 +250,10 @@ void AnimationExporter::exportAnimations(Scene *sce) std::string ob_name = std::string("null"); - //Create anim Id + //Create anim Id if (ob->type == OB_ARMATURE) { - ob_name = getObjectBoneName( ob , fcu); + ob_name = getObjectBoneName( ob , fcu); BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(), transformName, axis_name); } @@ -272,11 +274,11 @@ void AnimationExporter::exportAnimations(Scene *sce) // create output source std::string output_id ; - + //quat rotations are skipped for now, because of complications with determining axis. if(quatRotation) { - float * eul = get_eul_source_for_quat(ob); + float * eul = get_eul_source_for_quat(ob); float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values"); for ( int i = 0 ; i< fcu->totvert ; i++) eul_axis[i] = eul[i*3 + fcu->array_index]; @@ -348,10 +350,10 @@ void AnimationExporter::exportAnimations(Scene *sce) { if (!ob_arm->adt) return; - + sample_and_write_bone_animation_matrix(ob_arm, bone); - for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) write_bone_animation_matrix(ob_arm, child); } @@ -368,7 +370,7 @@ void AnimationExporter::exportAnimations(Scene *sce) bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); if (!pchan) return; - + find_frames(ob_arm, fra); if (flag & ARM_RESTPOS) { @@ -377,11 +379,7 @@ void AnimationExporter::exportAnimations(Scene *sce) } if (fra.size()) { - float *values = (float*)MEM_callocN(sizeof(float) * 16 * fra.size(), "temp. anim frames"); - sample_animation(values, fra, bone, ob_arm, pchan); - - dae_baked_animation(fra ,values, id_name(ob_arm), bone->name ); - + dae_baked_animation(fra ,ob_arm, bone ); } if (flag & ARM_RESTPOS) @@ -389,60 +387,10 @@ void AnimationExporter::exportAnimations(Scene *sce) where_is_pose(scene, ob_arm); } - - void AnimationExporter::sample_animation(float *v, std::vector &frames, Bone *bone, Object *ob_arm, bPoseChannel *pchan) - { - bPoseChannel *parchan = NULL; - bPose *pose = ob_arm->pose; - - pchan = get_pose_channel(pose, bone->name); - - if (!pchan) - return; - - parchan = pchan->parent; - - enable_fcurves(ob_arm->adt->action, bone->name); - - std::vector::iterator it; - int j = 0; - for (it = frames.begin(); it != frames.end(); it++) { - float mat[4][4], ipar[4][4]; - - float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); - - //BKE_animsys_evaluate_animdata(&ob_arm->id, ob_arm->adt, *it, ADT_RECALC_ANIM); - BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); - where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); - - // compute bone local mat - if (bone->parent) { - invert_m4_m4(ipar, parchan->pose_mat); - mul_m4_m4m4(mat, pchan->pose_mat, ipar); - } - else - copy_m4_m4(mat, pchan->pose_mat); - - for ( int i = 0; i < 4 ; i++) - { - for ( int k = 0; k<4 ; k++ ) - { - v[j*16 + 4*i + k] = mat[i][k]; - } - - } - // copy_m4_m4(v[j*16 + i], mat ) ; - - j++; - } - - enable_fcurves(ob_arm->adt->action, NULL); - - - } - - void AnimationExporter::dae_baked_animation(std::vector &fra, float *values, std::string ob_name, std::string bone_name) + void AnimationExporter::dae_baked_animation(std::vector &fra, Object *ob_arm , Bone *bone) { + std::string ob_name = id_name(ob_arm); + std::string bone_name = bone->name; char anim_id[200]; if (!fra.size()) @@ -458,7 +406,7 @@ void AnimationExporter::exportAnimations(Scene *sce) // create output source std::string output_id; - output_id = create_4x4_source( values, fra.size(), anim_id); + output_id = create_4x4_source( fra, ob_arm , bone , anim_id); // create interpolations source std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, ""); @@ -629,8 +577,8 @@ void AnimationExporter::exportAnimations(Scene *sce) // We're in a mixed interpolation scenario, set zero as it's irrelevant but value might contain unused data values[0] = 0; values[1] = 0; - } - else if (rotation) { + } + else if (rotation) { values[1] = (bezt->vec[0][1]) * 180.0f/M_PI; } else { values[1] = bezt->vec[0][1]; @@ -702,7 +650,7 @@ void AnimationExporter::exportAnimations(Scene *sce) return source_id; } - //Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified ) + //Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified ) std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic::Semantics semantic, float *v, int tot, bool is_rot, const std::string& anim_id, const char *axis_name) { std::string source_id = anim_id + get_semantic_suffix(semantic); @@ -763,7 +711,7 @@ void AnimationExporter::exportAnimations(Scene *sce) return source_id; } - std::string AnimationExporter::create_4x4_source(float *v, int tot, const std::string& anim_id) + std::string AnimationExporter::create_4x4_source(std::vector &frames , Object * ob_arm, Bone *bone , const std::string& anim_id) { COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT; std::string source_id = anim_id + get_semantic_suffix(semantic); @@ -771,20 +719,58 @@ void AnimationExporter::exportAnimations(Scene *sce) COLLADASW::Float4x4Source source(mSW); source.setId(source_id); source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(tot); + source.setAccessorCount(frames.size()); source.setAccessorStride(16); COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); add_source_parameters(param, semantic, false, NULL, false); source.prepareToAppendValues(); + + bPoseChannel *parchan = NULL; + bPoseChannel *pchan = NULL; + bPose *pose = ob_arm->pose; - for (int i = 0; i < tot; i++) { - for ( int j = 0 ; j < 4 ; j++ ) - source.appendValues(*(v+j*4), *(v + 4*j +1), *(v + 2 + 4*j), *(v+3 + 4*j)); - v += 16; + pchan = get_pose_channel(pose, bone->name); + + if (!pchan) + return ""; + + parchan = pchan->parent; + + enable_fcurves(ob_arm->adt->action, bone->name); + + std::vector::iterator it; + int j = 0; + for (it = frames.begin(); it != frames.end(); it++) { + float mat[4][4], ipar[4][4]; + + float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); + + BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); + where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); + + // compute bone local mat + if (bone->parent) { + invert_m4_m4(ipar, parchan->pose_mat); + mul_m4_m4m4(mat, pchan->pose_mat, ipar); + } + else + copy_m4_m4(mat, pchan->pose_mat); + UnitConverter converter; + + float outmat[4][4]; + converter.mat4_to_dae(outmat,mat); + + + source.appendValues(outmat); + + + j++; } + enable_fcurves(ob_arm->adt->action, NULL); + source.finish(); return source_id; @@ -877,7 +863,7 @@ void AnimationExporter::exportAnimations(Scene *sce) std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) { std::string tm_name; - // when given rna_path, determine tm_type from it + // when given rna_path, determine tm_type from it if (rna_path) { char *name = extract_transform_name(rna_path); @@ -911,7 +897,7 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = ""; break; } - + if (tm_name.size()) { if (axis_name != "") return tm_name + "." + std::string(axis_name); @@ -925,13 +911,13 @@ void AnimationExporter::exportAnimations(Scene *sce) std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) { std::string tm_name; - // when given rna_path, determine tm_type from it + // when given rna_path, determine tm_type from it if (rna_path) { char *name = extract_transform_name(rna_path); - if (!strcmp(name, "lens")) + if (!strcmp(name, "lens")) tm_type = 0; - else if (!strcmp(name, "ortho_scale")) + else if (!strcmp(name, "ortho_scale")) tm_type = 1; else if (!strcmp(name, "clip_end")) tm_type = 2; @@ -960,7 +946,7 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = ""; break; } - + if (tm_name.size()) { if (axis_name != "") return tm_name + "." + std::string(axis_name); @@ -971,12 +957,12 @@ void AnimationExporter::exportAnimations(Scene *sce) return std::string(""); } - // Assign sid of the animated parameter or transform + // Assign sid of the animated parameter or transform // for rotation, axis name is always appended and the value of append_axis is ignored std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis) { std::string tm_name; - bool is_rotation =false; + bool is_rotation =false; // when given rna_path, determine tm_type from it if (rna_path) { char *name = extract_transform_name(rna_path); @@ -1010,7 +996,7 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = "rotation"; is_rotation = true; break; - case 2: + case 2: tm_name = "scale"; break; case 3: @@ -1036,7 +1022,7 @@ void AnimationExporter::exportAnimations(Scene *sce) tm_name = ""; break; } - + if (tm_name.size()) { if (is_rotation) return tm_name + std::string(axis_name) + ".ANGLE"; @@ -1074,7 +1060,7 @@ void AnimationExporter::exportAnimations(Scene *sce) std::sort(fra.begin(), fra.end()); } - + // enable fcurves driving a specific bone, disable all the rest // if bone_name = NULL enable all fcurves @@ -1118,11 +1104,11 @@ void AnimationExporter::exportAnimations(Scene *sce) fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); //Check Material Effect parameter animations. - for(int a = 0; a < ob->totcol; a++) + for(int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); if (!ma) continue; - if(ma->adt && ma->adt->action) + if(ma->adt && ma->adt->action) { fcu = (FCurve*)ma->adt->action->curves.first; } @@ -1171,14 +1157,14 @@ void AnimationExporter::exportAnimations(Scene *sce) { if (!ob_arm->adt) return; - + //write bone animations for 3 transform types //i=0 --> rotations //i=1 --> scale //i=2 --> location for (int i = 0; i < 3; i++) sample_and_write_bone_animation(ob_arm, bone, i); - + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) write_bone_animation(ob_arm, child); } @@ -1195,7 +1181,7 @@ void AnimationExporter::exportAnimations(Scene *sce) bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); if (!pchan) return; - //Fill frame array with key frame values framed at @param:transform_type + //Fill frame array with key frame values framed at @param:transform_type switch (transform_type) { case 0: find_rotation_frames(ob_arm, fra, prefix, pchan->rotmode); @@ -1215,7 +1201,7 @@ void AnimationExporter::exportAnimations(Scene *sce) arm->flag &= ~ARM_RESTPOS; where_is_pose(scene, ob_arm); } - //v array will hold all values which will be exported. + //v array will hold all values which will be exported. if (fra.size()) { float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames"); sample_animation(values, fra, transform_type, bone, ob_arm, pchan); @@ -1266,8 +1252,8 @@ void AnimationExporter::exportAnimations(Scene *sce) float ctime = bsystem_time(scene, ob_arm, *it, 0.0f); - //BKE_animsys_evaluate_animdata(&ob_arm->id, ob_arm->adt, *it, ADT_RECALC_ANIM); - //BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); + + BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); // compute bone local mat diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 6786206ee6f..c628e5633b7 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -85,7 +85,7 @@ private: public: AnimationExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryAnimations(sw) { this->sw = sw; } - + void exportAnimations(Scene *sce); @@ -106,13 +106,13 @@ protected: void sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan); - void sample_animation(float *v, std::vector &frames, Bone *bone, Object *ob_arm, bPoseChannel *pChan); + void sample_animation(std::vector &mats, std::vector &frames, Bone *bone, Object *ob_arm, bPoseChannel *pChan); // dae_bone_animation -> add_bone_animation // (blend this into dae_bone_animation) void dae_bone_animation(std::vector &fra, float *v, int tm_type, int axis, std::string ob_name, std::string bone_name); - - void dae_baked_animation(std::vector &fra, float *values, std::string ob_name, std::string bone_name); + + void dae_baked_animation(std::vector &fra, Object *ob_arm , Bone *bone); float convert_time(float frame); @@ -123,9 +123,9 @@ protected: void add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param, COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis , bool transform); - void get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length); + void get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length); - float * get_eul_source_for_quat(Object *ob ); + float * get_eul_source_for_quat(Object *ob ); std::string create_source_from_fcurve(COLLADASW::InputSemantic::Semantics semantic, FCurve *fcu, const std::string& anim_id, const char *axis_name); @@ -135,7 +135,7 @@ protected: std::string create_xyz_source(float *v, int tot, const std::string& anim_id); - std::string create_4x4_source(float *v, int tot, const std::string& anim_id); + std::string create_4x4_source(std::vector &frames , Object * ob_arm, Bone *bone , const std::string& anim_id); std::string create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents); diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 3ac0654c866..7bad9bdeba7 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -49,13 +49,14 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4], } double dmat[4][4]; - for ( int i = 0 ; i< 4 ; i ++ ) - for ( int j =0 ; j < 4 ; j++) - dmat[i][j] = (double)local[i][j]; + UnitConverter* converter = new UnitConverter(); + converter->mat4_to_dae_double(dmat,local); TransformBase::decompose(local, loc, rot, NULL, scale); - node.addMatrix("transform",dmat); - add_transform(node, loc, rot, scale); + if ( node.getType() == COLLADASW::Node::JOINT) + node.addMatrix("transform",dmat); + else + add_transform(node, loc, rot, scale); } void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) -- cgit v1.2.3 From e86e922f5b6d7c3784bb6ffb840e08336ff42027 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Wed, 17 Aug 2011 18:29:01 +0000 Subject: Armature importer code cleanup. --- source/blender/collada/AnimationImporter.cpp | 161 ++++----------------------- source/blender/collada/AnimationImporter.h | 4 +- source/blender/collada/DocumentImporter.cpp | 2 +- 3 files changed, 23 insertions(+), 144 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 29bd0bd93b7..a0202fdcb1b 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -183,6 +183,7 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) } } + void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector& curves, char *rna_path, int array_index, Animation *animated) { bAction *act; @@ -318,120 +319,7 @@ bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* ani // for bones rna_path is like: pose.bones["bone-name"].rotation - // what does this AnimationList animate? - Animation& animated = uid_animated_map[animlist_id]; - Object *ob = animated.ob; - - char rna_path[100]; - char joint_path[100]; - bool is_joint = false; - - // if ob is NULL, it should be a JOINT - if (!ob) { - - ob = armature_importer->get_armature_for_joint(animated.node); - - if (!ob) { -// fprintf(stderr, "Cannot find armature for node %s\n", get_joint_name(animated.node)); - return true; - } - - armature_importer->get_rna_path_for_joint(animated.node, joint_path, sizeof(joint_path)); - - is_joint = true; - } - printf("object for animlist: %s found\n", animlist->getUniqueId().toAscii().c_str()); - const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); - - switch (animated.tm->getTransformationType()) { - case COLLADAFW::Transformation::TRANSLATE: - case COLLADAFW::Transformation::SCALE: - { - bool loc = animated.tm->getTransformationType() == COLLADAFW::Transformation::TRANSLATE; - if (is_joint) - BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, loc ? "location" : "scale"); - else - BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path)); - - for (int i = 0; i < bindings.getCount(); i++) { - const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i]; - COLLADAFW::UniqueId anim_uid = binding.animation; - - if (curve_map.find(anim_uid) == curve_map.end()) { - fprintf(stderr, "Cannot find FCurve by animation UID.\n"); - continue; - } - std::vector& fcurves = curve_map[anim_uid]; - - switch (binding.animationClass) { - case COLLADAFW::AnimationList::POSITION_X: - add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated); - break; - case COLLADAFW::AnimationList::POSITION_Y: - add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated); - break; - case COLLADAFW::AnimationList::POSITION_Z: - add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated); - break; - case COLLADAFW::AnimationList::POSITION_XYZ: - add_fcurves_to_object(ob, fcurves, rna_path, -1, &animated); - break; - default: - fprintf(stderr, "AnimationClass %d is not supported for %s.\n", - binding.animationClass, loc ? "TRANSLATE" : "SCALE"); - } - } - } - break; - case COLLADAFW::Transformation::ROTATE: - { - if (is_joint) - BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path); - else - BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path)); - - COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)animated.tm; - COLLADABU::Math::Vector3& axis = rot->getRotationAxis(); - - for (int i = 0; i < bindings.getCount(); i++) { - const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[i]; - COLLADAFW::UniqueId anim_uid = binding.animation; - - if (curve_map.find(anim_uid) == curve_map.end()) { - fprintf(stderr, "Cannot find FCurve by animation UID.\n"); - continue; - } - - std::vector& fcurves = curve_map[anim_uid]; - - switch (binding.animationClass) { - case COLLADAFW::AnimationList::ANGLE: - if (COLLADABU::Math::Vector3::UNIT_X == axis) { - add_fcurves_to_object(ob, fcurves, rna_path, 0, &animated); - } - else if (COLLADABU::Math::Vector3::UNIT_Y == axis) { - add_fcurves_to_object(ob, fcurves, rna_path, 1, &animated); - } - else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { - add_fcurves_to_object(ob, fcurves, rna_path, 2, &animated); - } - break; - case COLLADAFW::AnimationList::AXISANGLE: - // TODO convert axis-angle to quat? or XYZ? - default: - fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n", - binding.animationClass); - } - } - } - break; - case COLLADAFW::Transformation::MATRIX: - case COLLADAFW::Transformation::SKEW: - case COLLADAFW::Transformation::LOOKAT: - fprintf(stderr, "Animation of MATRIX, SKEW and LOOKAT transformations is not supported yet.\n"); - break; - } #endif return true; @@ -675,14 +563,16 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * } }*/ + break; case COLLADAFW::Transformation::SKEW: case COLLADAFW::Transformation::LOOKAT: - fprintf(stderr, "Animation of MATRIX, SKEW and LOOKAT transformations is not supported yet.\n"); + fprintf(stderr, "Animation of SKEW and LOOKAT transformations is not supported yet.\n"); break; } } +//creates the rna_paths and array indices of fcurves from animations using color and bound animation class of each animation. void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves ,char * anim_type) { char rna_path[100]; @@ -694,8 +584,6 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list std::vector animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { animcurves = curve_map[bindings[j].animation]; - //calculate rnapaths and array index of fcurves according to transformation and animation class - //Assign_color_animations( &bindings[j], &animcurves); switch (bindings[j].animationClass) { case COLLADAFW::AnimationList::COLOR_R: @@ -708,7 +596,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list modify_fcurve(&animcurves, rna_path, 2 ); break; case COLLADAFW::AnimationList::COLOR_RGB: - case COLLADAFW::AnimationList::COLOR_RGBA: + case COLLADAFW::AnimationList::COLOR_RGBA: // to do-> set intensity modify_fcurve(&animcurves, rna_path, -1 ); break; @@ -734,14 +622,14 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list if (animlist_map.find(listid) == animlist_map.end()) return ; else { - //transformation has animations + //anim_type has animations const COLLADAFW::AnimationList *animlist = animlist_map[listid]; const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings(); //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]; - //calculate rnapaths and array index of fcurves according to transformation and animation class + BLI_strncpy(rna_path, anim_type , sizeof(rna_path)); modify_fcurve(&animcurves, rna_path, 0 ); std::vector::iterator iter; @@ -815,16 +703,11 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector& newcu[i]->totvert = frames.size(); } -// Object *job = NULL; - - if (frames.size() == 0) + if (frames.size() == 0) return; std::sort(frames.begin(), frames.end()); - //if (is_joint) - // armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); - - + std::vector::iterator it; // sample values at each frame @@ -863,10 +746,10 @@ std::sort(frames.begin(), frames.end()); float rot[4], loc[3], scale[3]; mat4_to_quat(rot, mat); - for ( int i = 0 ; i < 4 ; i ++ ) + /*for ( int i = 0 ; i < 4 ; i ++ ) { rot[i] = rot[i] * (180 / M_PI); - } + }*/ copy_v3_v3(loc, mat[3]); mat4_to_size(scale, mat); @@ -904,7 +787,7 @@ std::sort(frames.begin(), frames.end()); } -void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , +void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , std::map& root_map, std::map& object_map, std::map FW_object_map) @@ -923,7 +806,6 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , bAction * act; bActionGroup *grp = NULL; - //if ( (animType & NODE_TRANSFORM) != 0 ) if ( (animType->transform) != 0 ) { const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; @@ -934,10 +816,10 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1); - else act = ob->adt->action; - //Get the list of animation curves of the object - - ListBase *AnimCurves = &(act->curves); + else act = ob->adt->action; + + //Get the list of animation curves of the object + ListBase *AnimCurves = &(act->curves); const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations(); @@ -1197,7 +1079,7 @@ int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop , int ty else return types; } -//XXX Is not used anymore. +// Is not used anymore. void AnimationImporter::find_frames_old(std::vector * frames, COLLADAFW::Node * node , COLLADAFW::Transformation::TransformationType tm_type) { bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX; @@ -1257,10 +1139,11 @@ void AnimationImporter::find_frames_old(std::vector * frames, COLLADAFW:: } + // prerequisites: // animlist_map - map animlist id -> animlist // curve_map - map anim id -> curve(s) -Object *AnimationImporter::translate_animation(COLLADAFW::Node *node, +Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node, std::map& object_map, std::map& root_map, COLLADAFW::Transformation::TransformationType tm_type, @@ -1513,7 +1396,7 @@ Object *AnimationImporter::translate_animation(COLLADAFW::Node *node, } // internal, better make it private -// warning: evaluates only rotation +// warning: evaluates only rotation and only assigns matrix transforms now // prerequisites: animlist_map, curve_map void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra) { @@ -1867,7 +1750,3 @@ void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value) calchandles_fcurve(fcu); } -void AnimationImporter::extra_data_importer(std::string elementName ) -{ - -} diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index fbb53ceedb6..18303eb2f0b 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -145,7 +145,7 @@ public: virtual void change_eul_to_quat(Object *ob, bAction *act); #endif - void translate_Animations_NEW ( COLLADAFW::Node * Node , + void translate_Animations( COLLADAFW::Node * Node , std::map& root_map, std::map& object_map , std::map FW_object_map); @@ -168,7 +168,7 @@ public: // prerequisites: // animlist_map - map animlist id -> animlist // curve_map - map anim id -> curve(s) - Object * translate_animation(COLLADAFW::Node *node, + Object * translate_animation_OLD(COLLADAFW::Node *node, std::map& object_map, std::map& root_map, COLLADAFW::Transformation::TransformationType tm_type, diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index f6c985626db..3a92c95e7ee 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -252,7 +252,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW //for (i = 0; i < 4; i++) //ob = - anim_importer.translate_Animations_NEW(node, root_map, object_map, FW_object_map); + anim_importer.translate_Animations(node, root_map, object_map, FW_object_map); COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (i = 0; i < children.getCount(); i++) { -- cgit v1.2.3 From a46f36c9b6c22d0082f820847c1b60acdf17c08b Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Wed, 17 Aug 2011 20:15:40 +0000 Subject: Animation export id bone animation + armature importer cleanup. --- source/blender/collada/AnimationExporter.cpp | 13 ++++++- source/blender/collada/ArmatureImporter.cpp | 55 +++++++++++++++------------- 2 files changed, 41 insertions(+), 27 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index b39e9bb39d5..7bcb225e3c2 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -66,6 +66,7 @@ void AnimationExporter::exportAnimations(Scene *sce) //transform matrix export for bones are temporarily disabled here. if ( ob->type == OB_ARMATURE ) { + if (!ob->data) return; bArmature *arm = (bArmature*)ob->data; for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) write_bone_animation_matrix(ob, bone); @@ -363,10 +364,18 @@ void AnimationExporter::exportAnimations(Scene *sce) bArmature *arm = (bArmature*)ob_arm->data; int flag = arm->flag; std::vector fra; - char prefix[256]; + //char prefix[256]; - BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name); + FCurve* fcu = (FCurve*)ob_arm->adt->action->curves.first; + while(fcu) + { + std::string bone_name = getObjectBoneName(ob_arm,fcu); + int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name); + if(val==0) break; + fcu = fcu->next; + } + if(!(fcu)) return; bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); if (!pchan) return; diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 7acae995396..81d785371df 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -93,16 +93,16 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p EditBone *bone = ED_armature_edit_bone_add((bArmature*)ob_arm->data, (char*)bc_get_joint_name(node)); totbone++; - + bPoseChannel *pchan = get_pose_channel(ob_arm->pose, (char*)bc_get_joint_name(node)); if (parent) bone->parent = parent; - float ax[3]; + float angle = 0; // get world-space if (parent){ - mul_m4_m4m4(mat, obmat, parent_mat); + mul_m4_m4m4(mat, obmat, parent_mat); } else { @@ -116,7 +116,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p // set head copy_v3_v3(bone->head, mat[3]); - + // set tail, don't set it to head because 0-length bones are not allowed float vec[3] = {0.0f, 0.5f, 0.0f}; add_v3_v3v3(bone->tail, bone->head, vec); @@ -127,7 +127,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p // not setting BONE_CONNECTED because this would lock child bone location with respect to parent // bone->flag |= BONE_CONNECTED; - + // XXX increase this to prevent "very" small bones? const float epsilon = 0.000001f; @@ -166,6 +166,10 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo float mat[4][4]; + // TODO rename from Node "name" attrs later + EditBone *bone = ED_armature_edit_bone_add(arm, (char*)bc_get_joint_name(node)); + totbone++; + if (skin.get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) { // get original world-space matrix invert_m4_m4(mat, joint_inv_bind_mat); @@ -182,12 +186,14 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo mul_m4_m4m4(mat, obmat, parent_mat); else copy_m4_m4(mat, obmat); - } - // TODO rename from Node "name" attrs later - EditBone *bone = ED_armature_edit_bone_add(arm, (char*)bc_get_joint_name(node)); - totbone++; + float loc[3], size[3], rot[3][3] , angle; + mat4_to_loc_rot_size( loc, rot, size, obmat); + mat3_to_vec_roll(rot, NULL, &angle ); + bone->roll=angle; + } + if (parent) bone->parent = parent; // set head @@ -264,8 +270,8 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW: leaf.bone = bone; copy_m4_m4(leaf.mat, mat); BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name)); - - TagsMap::iterator etit; + + TagsMap::iterator etit; ExtraTags *et = 0; etit = uid_tags_map.find(node->getUniqueId().toAscii()); if(etit != uid_tags_map.end()) @@ -277,7 +283,7 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW: et->setData("tip_y",&y); et->setData("tip_z",&z); float vec[3] = {x,y,z}; - copy_v3_v3(leaf.bone->tail, leaf.bone->head); + copy_v3_v3(leaf.bone->tail, leaf.bone->head); add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); leaf_bones.push_back(leaf); } @@ -292,7 +298,7 @@ void ArmatureImporter::fix_leaf_bones( ) // pointing up float vec[3] = {0.0f, 0.0f, 1.0f}; - + mul_v3_fl(vec, leaf_bone_length); copy_v3_v3(leaf.bone->tail, leaf.bone->head); @@ -396,10 +402,10 @@ void ArmatureImporter::create_armature_bones( ) { std::vector::iterator ri; //if there is an armature created for root_joint next root_joint - for (ri = root_joints.begin(); ri != root_joints.end(); ri++) { + for (ri = root_joints.begin(); ri != root_joints.end(); ri++) { if ( get_armature_for_joint(*ri) != NULL ) continue; - - //add armature object for current joint + + //add armature object for current joint //Object *ob_arm = add_object(scene, OB_ARMATURE); Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()]; @@ -413,7 +419,7 @@ void ArmatureImporter::create_armature_bones( ) TODO: check if bones have already been created for a given joint */ - leaf_bone_length = FLT_MAX; + leaf_bone_length = FLT_MAX; create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm); //fix_leaf_bones(); @@ -545,7 +551,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA); // set_leaf_bone_shapes(ob_arm); - // set_euler_rotmode(); + // set_euler_rotmode(); } @@ -572,7 +578,7 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node // get world-space if (parentname){ - mul_m4_m4m4(mat, obmat, parent_mat); + mul_m4_m4m4(mat, obmat, parent_mat); bPoseChannel *parchan = get_pose_channel(ob_arm->pose, parentname); mul_m4_m4m4(pchan->pose_mat, mat , parchan->pose_mat); @@ -581,12 +587,12 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node else { copy_m4_m4(mat, obmat); float invObmat[4][4]; - invert_m4_m4(invObmat, ob_arm->obmat); - mul_m4_m4m4(pchan->pose_mat, mat, invObmat); + invert_m4_m4(invObmat, ob_arm->obmat); + mul_m4_m4m4(pchan->pose_mat, mat, invObmat); } - mat4_to_axis_angle(ax,&angle,mat); + mat4_to_axis_angle(ax,&angle,mat); pchan->bone->roll = angle; @@ -651,10 +657,9 @@ void ArmatureImporter::make_armatures(bContext *C) // free memory stolen from SkinControllerData skin.free(); } - + //for bones without skins create_armature_bones(); - } #if 0 @@ -761,7 +766,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) void ArmatureImporter::set_tags_map(TagsMap & tagsMap) { - this->uid_tags_map = tagsMap; + this->uid_tags_map = tagsMap; } void ArmatureImporter::get_rna_path_for_joint(COLLADAFW::Node *node, char *joint_path, size_t count) -- cgit v1.2.3 From 475e0b8c0288e6f55d89d19489534884335744c4 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 18 Aug 2011 09:14:27 +0000 Subject: Apply [#28287] COLLADA fix for inverse bind matrix of skin controller Patch by Pelle Johnsen --- source/blender/collada/ArmatureExporter.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index b033c780530..1c81c0b6e76 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -368,17 +368,12 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase bPoseChannel *pchan = get_pose_channel(pose, def->name); - float pose_mat[4][4]; float mat[4][4]; float world[4][4]; float inv_bind_mat[4][4]; - // pose_mat is the same as pchan->pose_mat, but without the rotation - unit_m4(pose_mat); - translate_m4(pose_mat, pchan->pose_head[0], pchan->pose_head[1], pchan->pose_head[2]); - - // make world-space matrix, pose_mat is armature-space - mul_m4_m4m4(world, pose_mat, ob_arm->obmat); + // make world-space matrix, arm_mat is armature-space + mul_m4_m4m4(world, pchan->bone->arm_mat, ob_arm->obmat); invert_m4_m4(mat, world); converter.mat4_to_dae(inv_bind_mat, mat); -- cgit v1.2.3 From 2ee74be88cb045d403bc5145647da4262f131077 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Thu, 18 Aug 2011 19:16:36 +0000 Subject: Blender tip profile for bones with 2 or more children. --- source/blender/collada/ArmatureExporter.cpp | 5 ++++- source/blender/collada/ArmatureImporter.cpp | 8 ++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 1c81c0b6e76..753d57b5af8 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -177,7 +177,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) node.setNodeName(node_name); node.setNodeSid(node_sid); - if ( bone->childbase.first == NULL ) + if ( bone->childbase.first == NULL || BLI_countlist(&(bone->childbase))>=2) add_blender_leaf_bone( bone, ob_arm , node ); else{ node.start(); @@ -202,6 +202,9 @@ void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADA node.addExtraTechniqueParameter("blender", "tip_y", bone->tail[1] ); node.addExtraTechniqueParameter("blender", "tip_z", bone->tail[2] ); + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) { + add_bone_node(child, ob_arm); + } node.end(); } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 81d785371df..381a6cc06a9 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -83,14 +83,11 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p float parent_mat[][4], Object * ob_arm) { float mat[4][4]; - float obmat[4][4]; + float obmat[4][4]; // object-space get_node_mat(obmat, node, NULL, NULL); - // get world-space - - EditBone *bone = ED_armature_edit_bone_add((bArmature*)ob_arm->data, (char*)bc_get_joint_name(node)); totbone++; @@ -151,7 +148,6 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p // in second case it's not a leaf bone, but we handle it the same way if (!children.getCount() || children.getCount() > 1) { - add_leaf_bone(mat, bone, node); } @@ -659,7 +655,7 @@ void ArmatureImporter::make_armatures(bContext *C) } //for bones without skins - create_armature_bones(); + //create_armature_bones(); } #if 0 -- cgit v1.2.3 From c6465197763d9110361a795fcc6a2292790a7fc7 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 18 Aug 2011 22:56:41 +0000 Subject: Export only objects on visible layers. This ensures we can hide for instance bone shapes. --- source/blender/collada/DocumentExporter.cpp | 2 ++ source/blender/collada/GeometryExporter.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 0a30365658e..32956921f5b 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -195,6 +195,7 @@ public: Object *ob = base->object; if (!ob->parent) { + if(sce->lay & ob->lay) { switch(ob->type) { case OB_MESH: case OB_CAMERA: @@ -208,6 +209,7 @@ public: writeNodes(ob, sce); break; } + } } base= base->next; diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h index 7f3426a1915..d9d265a66fc 100644 --- a/source/blender/collada/GeometryExporter.h +++ b/source/blender/collada/GeometryExporter.h @@ -110,7 +110,8 @@ struct GeometryFunctor { Object *ob = base->object; if (ob->type == OB_MESH && ob->data - && !(export_selected && !(ob->flag && SELECT))) { + && !(export_selected && !(ob->flag && SELECT)) + && ((sce->lay & ob->lay)!=0)) { f(ob); } base= base->next; -- cgit v1.2.3 From ac3d785caaf272304738ecc0799c1dc9c11c3c82 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Fri, 19 Aug 2011 14:29:33 +0000 Subject: Animation exporter matrix source param fix. --- source/blender/collada/AnimationExporter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 7bcb225e3c2..8a7d285abcb 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -732,7 +732,7 @@ void AnimationExporter::exportAnimations(Scene *sce) source.setAccessorStride(16); COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList(); - add_source_parameters(param, semantic, false, NULL, false); + add_source_parameters(param, semantic, false, NULL, true); source.prepareToAppendValues(); @@ -1123,7 +1123,8 @@ void AnimationExporter::exportAnimations(Scene *sce) } } - if ( fcu) return true; + if ( fcu) + return true; base= base->next; } return false; -- cgit v1.2.3 From 5d88ba6165b3695bd99668bb5a8d1dc1364e805b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Aug 2011 20:25:25 +0000 Subject: remove over zealous undo's on operators that don't need it. --- source/blender/editors/render/render_shading.c | 10 +++------- source/blender/editors/space_image/image_ops.c | 4 ++-- source/blender/editors/space_info/info_ops.c | 2 +- source/blender/editors/space_sequencer/sequencer_edit.c | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index cfed2750e18..fbdcf7ba9b3 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -787,7 +787,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) ot->poll= envmap_save_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */ /* properties */ //RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); @@ -875,8 +875,6 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op)) copy_matcopybuf(ma); - WM_event_add_notifier(C, NC_MATERIAL, ma); - return OPERATOR_FINISHED; } @@ -891,7 +889,7 @@ void MATERIAL_OT_copy(wmOperatorType *ot) ot->exec= copy_material_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the material */ } static int paste_material_exec(bContext *C, wmOperator *UNUSED(op)) @@ -1015,8 +1013,6 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op)) copy_mtex_copybuf(id); - WM_event_add_notifier(C, NC_TEXTURE, NULL); - return OPERATOR_FINISHED; } @@ -1039,7 +1035,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot) ot->poll= copy_mtex_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the mtex */ } static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index ea8c7fc0cfa..6e0d1909963 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1331,7 +1331,7 @@ void IMAGE_OT_reload(wmOperatorType *ot) ot->exec= reload_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */ } /********************** new image operator *********************/ @@ -1989,7 +1989,7 @@ void IMAGE_OT_sample_line(wmOperatorType *ot) ot->cancel= WM_gesture_straightline_cancel; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= 0; /* no undo/register since this operates on the space */ WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT); } diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index d58fb7b11f0..e09565d38e9 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -273,7 +273,7 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) ot->exec= report_missing_files_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= 0; /* only reports so no need to undo/register */ } /********************* find missing files operator *********************/ diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 531ecebba5e..e876da41bd9 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1202,7 +1202,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) ot->poll= sequencer_edit_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */ } /* reload operator */ @@ -2522,7 +2522,7 @@ void SEQUENCER_OT_copy(wmOperatorType *ot) ot->poll= sequencer_edit_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* properties */ } -- cgit v1.2.3 From a0a96a84fed4669ac80d09a2fb667c601c048d23 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Aug 2011 13:29:42 +0000 Subject: fix for crash when loading a file from a script, and executing user modules in the newly loaded file. --- source/blender/python/intern/bpy_interface.c | 25 +++++++++++++++---------- source/blender/python/intern/bpy_util.h | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 8bd6e6c611c..e5e90380d61 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -87,6 +87,14 @@ static double bpy_timer_run; /* time for each python script run */ static double bpy_timer_run_tot; /* accumulate python runs */ #endif +/* use for updating while a python script runs - in case of file load */ +void bpy_context_update(bContext *C) +{ + BPy_SetContext(C); + bpy_import_main_set(CTX_data_main(C)); + BPY_modules_update(C); /* can give really bad results if this isnt here */ +} + void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) { py_call_level++; @@ -95,16 +103,7 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) *gilstate= PyGILState_Ensure(); if(py_call_level==1) { - - if(C) { // XXX - should always be true. - BPy_SetContext(C); - bpy_import_main_set(CTX_data_main(C)); - } - else { - fprintf(stderr, "ERROR: Python context called with a NULL Context. this should not happen!\n"); - } - - BPY_modules_update(C); /* can give really bad results if this isnt here */ + bpy_context_update(C); #ifdef TIME_PY_RUN if(bpy_timer_count==0) { @@ -570,6 +569,12 @@ void BPY_modules_load_user(bContext *C) if(bmain==NULL) return; + /* update pointers since this can run from a nested script + * on file load */ + if(py_call_level) { + bpy_context_update(C); + } + bpy_context_set(C, &gilstate); for(text=CTX_data_main(C)->text.first; text; text= text->id.next) { diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h index b16c8fe2e8c..09fbdf96ed2 100644 --- a/source/blender/python/intern/bpy_util.h +++ b/source/blender/python/intern/bpy_util.h @@ -51,6 +51,7 @@ short BPy_errors_to_report(struct ReportList *reports); struct bContext *BPy_GetContext(void); void BPy_SetContext(struct bContext *C); +extern void bpy_context_update(struct bContext *C); extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate); extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate); #endif -- cgit v1.2.3 From d4dec1c3bcc8fa85e8f4cf3372efe077648a67bf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Aug 2011 14:23:43 +0000 Subject: use ghash for DNA_struct_find_nr(), gives ~18% speedup on loading sintel lite, will also speedup undo. note: only works with CMake, wasn't able to get this working with scons, complains about same file being built in different environments. --- source/blender/makesdna/DNA_sdna_types.h | 5 +++- source/blender/makesdna/intern/CMakeLists.txt | 26 +++++++++++++++++ source/blender/makesdna/intern/SConscript | 1 + source/blender/makesdna/intern/dna_genfile.c | 42 +++++++++++++++++++++------ source/blender/makesrna/intern/CMakeLists.txt | 1 + 5 files changed, 65 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index e5f924b5fa6..829d1eee03b 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -54,7 +54,10 @@ typedef struct SDNA { (sp[2], sp[3]), (sp[4], sp[5]), .. are the member type and name numbers respectively */ - + + struct GHash *structs_map; /* ghash for faster lookups, + requires WITH_DNA_GHASH to be used for now */ + /* wrong place for this really, its a simple * cache for findstruct_nr. */ diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 429db63b526..5edebfe3903 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -27,12 +27,17 @@ # message(STATUS "Configuring makesdna") +# add_definitions(-DWITH_DNA_GHASH) + blender_include_dirs( ../../../../intern/guardedalloc ../../blenloader + ../../blenlib .. ) + +# ----------------------------------------------------------------------------- # Build makesdna executable set(SRC makesdna.c @@ -56,6 +61,8 @@ add_custom_command( DEPENDS makesdna ) + +# ----------------------------------------------------------------------------- # Build bf_dna library set(INC @@ -72,3 +79,22 @@ set(SRC ) blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}") + + +# ----------------------------------------------------------------------------- +# Build bf_dna_blenlib library +set(INC + +) + +set(INC_SYS + +) + +set(SRC + ../../blenlib/intern/BLI_mempool.c + ../../blenlib/intern/listbase.c + ../../blenlib/intern/BLI_ghash.c +) + +blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript index e51ee53e078..8185676cbfc 100644 --- a/source/blender/makesdna/intern/SConscript +++ b/source/blender/makesdna/intern/SConscript @@ -67,5 +67,6 @@ else: else: dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET") +# TODO, get WITH_DNA_GHASH working, see CMake's 'WITH_DNA_GHASH' obj = ['intern/dna.c', 'intern/dna_genfile.c'] Return ('obj') diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 4e9b023b326..ebcfce84e37 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -42,6 +42,10 @@ #include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN +#ifdef WITH_DNA_GHASH +# include "BLI_ghash.h" +#endif + #include "DNA_genfile.h" #include "DNA_sdna_types.h" // for SDNA ;-) @@ -197,7 +201,11 @@ void DNA_sdna_free(SDNA *sdna) MEM_freeN((void *)sdna->names); MEM_freeN(sdna->types); MEM_freeN(sdna->structs); - + +#ifdef WITH_DNA_GHASH + BLI_ghash_free(sdna->structs_map, NULL, NULL); +#endif + MEM_freeN(sdna); } @@ -275,24 +283,30 @@ static short *findstruct_name(SDNA *sdna, const char *str) int DNA_struct_find_nr(SDNA *sdna, const char *str) { short *sp= NULL; - int a; if(sdna->lastfindnr_structs) { sp= sdna->structs[sdna->lastfind]; if(strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind; } - for(a=0; anr_structs; a++) { +#ifdef WITH_DNA_GHASH + return (intptr_t)BLI_ghash_lookup(sdna->structs_map, str) - 1; +#else + { + int a; - sp= sdna->structs[a]; - - if(strcmp( sdna->types[ sp[0] ], str )==0) { - sdna->lastfind= a; - return a; + for(a=0; anr_structs; a++) { + + sp= sdna->structs[a]; + + if(strcmp( sdna->types[ sp[0] ], str )==0) { + sdna->lastfind= a; + return a; + } } } - return -1; +#endif } /* ************************* END DIV ********************** */ @@ -481,6 +495,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) sp[10]= 9; } } + +#ifdef WITH_DNA_GHASH + /* create a ghash lookup to speed up */ + sdna->structs_map= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "init_structDNA gh"); + + for(nr = 0; nr < sdna->nr_structs; nr++) { + sp= sdna->structs[nr]; + BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], (void *)(nr + 1)); + } +#endif } } diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index cb593e7deab..cc7bcf04716 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -243,6 +243,7 @@ blender_include_dirs_sys( add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC}) target_link_libraries(makesrna bf_dna) +target_link_libraries(makesrna bf_dna_blenlib) # Output rna_*_gen.c # note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes -- cgit v1.2.3 From bcadb6b93986b230fb6e70489e7221b3f9972aec Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sat, 20 Aug 2011 16:48:53 +0000 Subject: small fixes and refactoring. --- source/blender/collada/AnimationImporter.cpp | 19 +++++++++------- source/blender/collada/ArmatureExporter.cpp | 11 +++++---- source/blender/collada/ArmatureImporter.cpp | 34 ++++++++++++++++------------ 3 files changed, 36 insertions(+), 28 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index a0202fdcb1b..ee04c270843 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -454,14 +454,14 @@ void AnimationImporter::find_frames( std::vector* frames , std::vectorbegin(); iter != curves->end(); iter++) { FCurve *fcu = *iter; - for (unsigned int k = 0; k < fcu->totvert; k++) { - //get frame value from bezTriple - float fra = fcu->bezt[k].vec[1][0]; - //if frame already not added add frame to frames - if (std::find(frames->begin(), frames->end(), fra) == frames->end()) - frames->push_back(fra); - - } + for (unsigned int k = 0; k < fcu->totvert; k++) { + //get frame value from bezTriple + float fra = fcu->bezt[k].vec[1][0]; + //if frame already not added add frame to frames + if (std::find(frames->begin(), frames->end(), fra) == frames->end()) + frames->push_back(fra); + + } } } @@ -1568,10 +1568,13 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float i++; j = 0; } + unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), *it), unused_curves.end()); } COLLADAFW::Matrix tm(matrix); dae_matrix_to_mat4(&tm, mat); + + std::vector::iterator it; return true; } diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 753d57b5af8..082105baaba 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -39,6 +39,7 @@ #include "BKE_action.h" #include "BKE_armature.h" +#include "ED_armature.h" #include "BLI_listbase.h" @@ -177,9 +178,9 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) node.setNodeName(node_name); node.setNodeSid(node_sid); - if ( bone->childbase.first == NULL || BLI_countlist(&(bone->childbase))>=2) + /*if ( bone->childbase.first == NULL || BLI_countlist(&(bone->childbase))>=2) add_blender_leaf_bone( bone, ob_arm , node ); - else{ + else{*/ node.start(); add_bone_transform(ob_arm, bone, node); @@ -189,15 +190,15 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) } node.end(); - } + //} } void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADASW::Node& node) { node.start(); - + add_bone_transform(ob_arm, bone, node); - + node.addExtraTechniqueParameter("blender", "tip_x", bone->tail[0] ); node.addExtraTechniqueParameter("blender", "tip_y", bone->tail[1] ); node.addExtraTechniqueParameter("blender", "tip_z", bone->tail[2] ); diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 381a6cc06a9..67828fb967d 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -183,10 +183,10 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo else copy_m4_m4(mat, obmat); - float loc[3], size[3], rot[3][3] , angle; + /*float loc[3], size[3], rot[3][3] , angle; mat4_to_loc_rot_size( loc, rot, size, obmat); mat3_to_vec_roll(rot, NULL, &angle ); - bone->roll=angle; + bone->roll=angle;*/ } @@ -267,21 +267,25 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW: copy_m4_m4(leaf.mat, mat); BLI_strncpy(leaf.name, bone->name, sizeof(leaf.name)); + float vec[3]; + TagsMap::iterator etit; ExtraTags *et = 0; etit = uid_tags_map.find(node->getUniqueId().toAscii()); if(etit != uid_tags_map.end()) - et = etit->second; - else return; - - float x,y,z; - et->setData("tip_x",&x); - et->setData("tip_y",&y); - et->setData("tip_z",&z); - float vec[3] = {x,y,z}; - copy_v3_v3(leaf.bone->tail, leaf.bone->head); - add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); - leaf_bones.push_back(leaf); + { + et = etit->second; + //else return; + + float x,y,z; + et->setData("tip_x",&x); + et->setData("tip_y",&y); + et->setData("tip_z",&z); + float vec[3] = {x,y,z}; + copy_v3_v3(leaf.bone->tail, leaf.bone->head); + add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); + }else + leaf_bones.push_back(leaf); } void ArmatureImporter::fix_leaf_bones( ) @@ -295,7 +299,7 @@ void ArmatureImporter::fix_leaf_bones( ) // pointing up float vec[3] = {0.0f, 0.0f, 1.0f}; - mul_v3_fl(vec, leaf_bone_length); + //mul_v3_fl(vec, leaf_bone_length); copy_v3_v3(leaf.bone->tail, leaf.bone->head); add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); @@ -418,7 +422,7 @@ void ArmatureImporter::create_armature_bones( ) leaf_bone_length = FLT_MAX; create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm); - //fix_leaf_bones(); + fix_leaf_bones(); // exit armature edit mode -- cgit v1.2.3 From f8ec017900cba5702742bf31d99e8c6df6a1fcad Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 20 Aug 2011 17:39:13 +0000 Subject: floats were being promoted to doubles in quite a few cases (using gcc's -Wdouble-promotion), went over render module and use float constants, gives small but consistent speedup - approx 3%. --- source/blender/blenloader/intern/readfile.c | 4 +- source/blender/python/generic/noise_py_api.c | 20 +- .../blender/render/intern/source/convertblender.c | 50 +-- source/blender/render/intern/source/envmap.c | 24 +- .../render/intern/source/gammaCorrectionTables.c | 2 +- source/blender/render/intern/source/initrender.c | 52 +-- source/blender/render/intern/source/occlusion.c | 2 +- .../blender/render/intern/source/pixelblending.c | 24 +- source/blender/render/intern/source/pixelshading.c | 72 ++--- source/blender/render/intern/source/rayshade.c | 118 +++---- .../blender/render/intern/source/render_texture.c | 352 ++++++++++----------- source/blender/render/intern/source/rendercore.c | 36 +-- .../blender/render/intern/source/renderdatabase.c | 70 ++-- source/blender/render/intern/source/shadbuf.c | 49 ++- source/blender/render/intern/source/sss.c | 52 +-- source/blender/render/intern/source/strand.c | 8 +- source/blender/render/intern/source/sunsky.c | 116 +++---- source/blender/render/intern/source/zbuf.c | 78 +++-- 18 files changed, 561 insertions(+), 568 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index bd12677485c..0e99b357054 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11670,8 +11670,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Tex *tex; for(tex= main->tex.first; tex; tex= tex->id.next) { if(tex->pd) { - if (tex->pd->falloff_speed_scale == 0.0) - tex->pd->falloff_speed_scale = 100.0; + if (tex->pd->falloff_speed_scale == 0.0f) + tex->pd->falloff_speed_scale = 100.0f; if (!tex->pd->falloff_curve) { tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1); diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c index f5761f713a6..7be0998c0a1 100644 --- a/source/blender/python/generic/noise_py_api.c +++ b/source/blender/python/generic/noise_py_api.c @@ -210,8 +210,8 @@ static void randuvec(float v[3]) if((r = 1.f - v[2] * v[2]) > 0.f) { float a = (float)(6.283185307f * frand()); r = (float)sqrt(r); - v[0] = (float)(r * cos(a)); - v[1] = (float)(r * sin(a)); + v[0] = (float)(r * cosf(a)); + v[1] = (float)(r * sinf(a)); } else { v[2] = 1.f; @@ -254,7 +254,7 @@ static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args) if(!PyArg_ParseTuple(args, "(fff)|i:noise", &x, &y, &z, &nb)) return NULL; - return PyFloat_FromDouble((2.0 * BLI_gNoise(1.0, x, y, z, 0, nb) - 1.0)); + return PyFloat_FromDouble((2.0f * BLI_gNoise(1.0f, x, y, z, 0, nb) - 1.0f)); } /*-------------------------------------------------------------------------*/ @@ -264,11 +264,11 @@ static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args) static void noise_vector(float x, float y, float z, int nb, float v[3]) { /* Simply evaluate noise at 3 different positions */ - v[0] = (float)(2.0 * BLI_gNoise(1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0, - nb) - 1.0); - v[1] = (float)(2.0 * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0); - v[2] = (float)(2.0 * BLI_gNoise(1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0, - nb) - 1.0); + v[0]= (float)(2.0f * BLI_gNoise(1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0, + nb) - 1.0f); + v[1]= (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f); + v[2]= (float)(2.0f * BLI_gNoise(1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0, + nb) - 1.0f); } static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args) @@ -291,7 +291,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, float amp, out, t; int i; amp = 1.f; - out = (float)(2.0 * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0); + out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f); if(hard) out = (float)fabs(out); for(i = 1; i < oct; i++) { @@ -299,7 +299,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, x *= freqscale; y *= freqscale; z *= freqscale; - t = (float)(amp * (2.0 * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0)); + t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f)); if(hard) t = (float)fabs(t); out += t; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index f749d1ba004..7033ec27fc0 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1046,9 +1046,9 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par float fac; if(ma->strand_ease!=0.0f) { if(ma->strand_ease<0.0f) - fac= pow(sd->time, 1.0+ma->strand_ease); + fac= pow(sd->time, 1.0f+ma->strand_ease); else - fac= pow(sd->time, 1.0/(1.0f-ma->strand_ease)); + fac= pow(sd->time, 1.0f/(1.0f-ma->strand_ease)); } else fac= sd->time; @@ -1063,7 +1063,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par width= w; /*cross is the radius of the strand so we want it to be half of full width */ - mul_v3_fl(cross,0.5/crosslen); + mul_v3_fl(cross,0.5f/crosslen); } else width/=w; @@ -1984,8 +1984,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem else { /* render normal particles */ if(part->trail_count > 1) { - float length = part->path_end * (1.0 - part->randlength * r_length); - int trail_count = part->trail_count * (1.0 - part->randlength * r_length); + float length = part->path_end * (1.0f - part->randlength * r_length); + int trail_count = part->trail_count * (1.0f - part->randlength * r_length); float ct = (part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time; float dt = length / (trail_count ? (float)trail_count : 1.0f); @@ -2159,7 +2159,7 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int normalize_v3(view); zn= nor[0]*view[0]+nor[1]*view[1]+nor[2]*view[2]; - if(zn>=0.0) hasize= 0.0; + if(zn>=0.0f) hasize= 0.0f; else hasize*= zn*zn*zn*zn; } @@ -3599,7 +3599,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4]) /* bias is percentage, made 2x larger because of correction for angle of incidence */ /* when a ray is closer to parallel of a face, bias value is increased during render */ - shb->bias= (0.02*lar->bias)*0x7FFFFFFF; + shb->bias= (0.02f*lar->bias)*0x7FFFFFFF; /* halfway method (average of first and 2nd z) reduces bias issues */ if(ELEM(lar->buftype, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP)) @@ -3610,7 +3610,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4]) static void area_lamp_vectors(LampRen *lar) { - float xsize= 0.5*lar->area_size, ysize= 0.5*lar->area_sizey, multifac; + float xsize= 0.5f*lar->area_size, ysize= 0.5f*lar->area_sizey, multifac; /* make it smaller, so area light can be multisampled */ multifac= 1.0f/sqrt((float)lar->ray_totsamp); @@ -3637,7 +3637,7 @@ static void area_lamp_vectors(LampRen *lar) lar->area[3][1]= lar->co[1] + xsize*lar->mat[0][1] - ysize*lar->mat[1][1]; lar->area[3][2]= lar->co[2] + xsize*lar->mat[0][2] - ysize*lar->mat[1][2]; /* only for correction button size, matrix size works on energy */ - lar->areasize= lar->dist*lar->dist/(4.0*xsize*ysize); + lar->areasize= lar->dist*lar->dist/(4.0f*xsize*ysize); } /* If lar takes more lamp data, the decoupling will be better. */ @@ -3791,10 +3791,10 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) lar->spotsi= la->spotsize; if(lar->mode & LA_HALO) { - if(lar->spotsi>170.0) lar->spotsi= 170.0; + if(lar->spotsi>170.0f) lar->spotsi= 170.0f; } - lar->spotsi= cos( M_PI*lar->spotsi/360.0 ); - lar->spotbl= (1.0-lar->spotsi)*la->spotblend; + lar->spotsi= cos( M_PI*lar->spotsi/360.0f ); + lar->spotbl= (1.0f-lar->spotsi)*la->spotblend; memcpy(lar->mtex, la->mtex, MAX_MTEX*sizeof(void *)); @@ -3813,7 +3813,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) xn= saacos(lar->spotsi); xn= sin(xn)/cos(xn); - lar->spottexfac= 1.0/(xn); + lar->spottexfac= 1.0f/(xn); if(lar->mode & LA_ONLYSHADOW) { if((lar->mode & (LA_SHAD_BUF|LA_SHAD_RAY))==0) lar->mode -= LA_ONLYSHADOW; @@ -3823,7 +3823,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) /* set flag for spothalo en initvars */ if(la->type==LA_SPOT && (la->mode & LA_HALO) && (la->buftype != LA_SHADBUF_DEEP)) { - if(la->haint>0.0) { + if(la->haint>0.0f) { re->flag |= R_LAMPHALO; /* camera position (0,0,0) rotate around lamp */ @@ -3990,9 +3990,9 @@ void init_render_world(Render *re) cp= (char *)&re->wrld.fastcol; - cp[0]= 255.0*re->wrld.horr; - cp[1]= 255.0*re->wrld.horg; - cp[2]= 255.0*re->wrld.horb; + cp[0]= 255.0f*re->wrld.horr; + cp[1]= 255.0f*re->wrld.horg; + cp[2]= 255.0f*re->wrld.horb; cp[3]= 1; VECCOPY(re->grvec, re->viewmat[2]); @@ -4047,25 +4047,25 @@ static void set_phong_threshold(ObjectRen *obr) if(vlr->flag & R_SMOOTH) { dot= INPR(vlr->n, vlr->v1->n); dot= ABS(dot); - if(dot>0.9) { + if(dot>0.9f) { thresh+= dot; tot++; } dot= INPR(vlr->n, vlr->v2->n); dot= ABS(dot); - if(dot>0.9) { + if(dot>0.9f) { thresh+= dot; tot++; } dot= INPR(vlr->n, vlr->v3->n); dot= ABS(dot); - if(dot>0.9) { + if(dot>0.9f) { thresh+= dot; tot++; } if(vlr->v4) { dot= INPR(vlr->n, vlr->v4->n); dot= ABS(dot); - if(dot>0.9) { + if(dot>0.9f) { thresh+= dot; tot++; } } @@ -4105,7 +4105,7 @@ static void set_fullsample_trace_flag(Render *re, ObjectRen *obr) else if((mode & MA_RAYMIRROR) || ((mode & MA_TRANSP) && (mode & MA_RAYTRANSP))) { /* for blurry reflect/refract, better to take more samples * inside the raytrace than as OSA samples */ - if ((vlr->mat->gloss_mir == 1.0) && (vlr->mat->gloss_tra == 1.0)) + if ((vlr->mat->gloss_mir == 1.0f) && (vlr->mat->gloss_tra == 1.0f)) vlr->flag |= R_FULL_OSA; } } @@ -4221,11 +4221,11 @@ static void check_non_flat_quads(ObjectRen *obr) /* render normals are inverted in render! we calculate normal of single tria here */ flen= normal_tri_v3( nor,vlr->v4->co, vlr->v3->co, vlr->v1->co); - if(flen==0.0) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co); + if(flen==0.0f) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co); xn= nor[0]*vlr->n[0] + nor[1]*vlr->n[1] + nor[2]*vlr->n[2]; - if(ABS(xn) < 0.999995 ) { // checked on noisy fractal grid + if(ABS(xn) < 0.999995f ) { // checked on noisy fractal grid float d1, d2; @@ -5461,7 +5461,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * for(j=0;j<3;j++) fsvec[j] = velarray[a].vel[j]; /* (bad) HACK insert average velocity if none is there (see previous comment) */ - if((fsvec[0] == 0.0) && (fsvec[1] == 0.0) && (fsvec[2] == 0.0)) + if((fsvec[0] == 0.0f) && (fsvec[1] == 0.0f) && (fsvec[2] == 0.0f)) { fsvec[0] = avgvel[0]; fsvec[1] = avgvel[1]; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index e2ab21ef877..66a73b47790 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -595,7 +595,7 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ) if(env->type==ENV_PLANE) { face= 1; - labda= 1.0/vec[2]; + labda= 1.0f/vec[2]; answ[0]= env->viewscale*labda*vec[0]; answ[1]= -env->viewscale*labda*vec[1]; } @@ -603,44 +603,44 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ) /* which face */ if( vec[2]<=-fabs(vec[0]) && vec[2]<=-fabs(vec[1]) ) { face= 0; - labda= -1.0/vec[2]; + labda= -1.0f/vec[2]; answ[0]= labda*vec[0]; answ[1]= labda*vec[1]; } else if( vec[2]>=fabs(vec[0]) && vec[2]>=fabs(vec[1]) ) { face= 1; - labda= 1.0/vec[2]; + labda= 1.0f/vec[2]; answ[0]= labda*vec[0]; answ[1]= -labda*vec[1]; } else if( vec[1]>=fabs(vec[0]) ) { face= 2; - labda= 1.0/vec[1]; + labda= 1.0f/vec[1]; answ[0]= labda*vec[0]; answ[1]= labda*vec[2]; } else if( vec[0]<=-fabs(vec[1]) ) { face= 3; - labda= -1.0/vec[0]; + labda= -1.0f/vec[0]; answ[0]= labda*vec[1]; answ[1]= labda*vec[2]; } else if( vec[1]<=-fabs(vec[0]) ) { face= 4; - labda= -1.0/vec[1]; + labda= -1.0f/vec[1]; answ[0]= -labda*vec[0]; answ[1]= labda*vec[2]; } else { face= 5; - labda= 1.0/vec[0]; + labda= 1.0f/vec[0]; answ[0]= -labda*vec[1]; answ[1]= labda*vec[2]; } } - answ[0]= 0.5+0.5*answ[0]; - answ[1]= 0.5+0.5*answ[1]; + answ[0]= 0.5f+0.5f*answ[0]; + answ[1]= 0.5f+0.5f*answ[1]; return face; } @@ -725,7 +725,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe /* edges? */ - if(texres->ta<1.0) { + if(texres->ta<1.0f) { TexResult texr1, texr2; texr1.nor= texr2.nor= NULL; @@ -756,8 +756,8 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe else texr2.tr= texr2.tg= texr2.tb= texr2.ta= 0.0; fac= (texres->ta+texr1.ta+texr2.ta); - if(fac!=0.0) { - fac= 1.0/fac; + if(fac!=0.0f) { + fac= 1.0f/fac; texres->tr= fac*(texres->ta*texres->tr + texr1.ta*texr1.tr + texr2.ta*texr2.tr ); texres->tg= fac*(texres->ta*texres->tg + texr1.ta*texr1.tg + texr2.ta*texr2.tg ); diff --git a/source/blender/render/intern/source/gammaCorrectionTables.c b/source/blender/render/intern/source/gammaCorrectionTables.c index 4a16341093c..f88a5d240c3 100644 --- a/source/blender/render/intern/source/gammaCorrectionTables.c +++ b/source/blender/render/intern/source/gammaCorrectionTables.c @@ -107,7 +107,7 @@ void makeGammaTables(float gamma) int i; valid_gamma = gamma; - valid_inv_gamma = 1.0 / gamma; + valid_inv_gamma = 1.0f / gamma; color_step = 1.0 / RE_GAMMA_TABLE_SIZE; inv_color_step = (float) RE_GAMMA_TABLE_SIZE; diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 2f09742f130..bea86264af1 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -126,8 +126,8 @@ static float filt_cubic(float x) if (x < 0.0f) x = -x; - if (x < 1.0f) return 0.5*x*x2 - x2 + 2.0f/3.0f; - if (x < 2.0f) return (2.0-x)*(2.0-x)*(2.0-x)/6.0f; + if (x < 1.0f) return 0.5f*x*x2 - x2 + 2.0f/3.0f; + if (x < 2.0f) return (2.0f-x)*(2.0f-x)*(2.0f-x)/6.0f; return 0.0f; } @@ -138,27 +138,27 @@ static float filt_catrom(float x) if (x < 0.0f) x = -x; if (x < 1.0f) return 1.5f*x2*x - 2.5f*x2 + 1.0f; - if (x < 2.0f) return -0.5f*x2*x + 2.5*x2 - 4.0f*x + 2.0f; + if (x < 2.0f) return -0.5f*x2*x + 2.5f*x2 - 4.0f*x + 2.0f; return 0.0f; } static float filt_mitchell(float x) /* Mitchell & Netravali's two-param cubic */ { float b = 1.0f/3.0f, c = 1.0f/3.0f; - float p0 = ( 6.0 - 2.0*b ) / 6.0; - float p2 = (-18.0 + 12.0*b + 6.0*c) / 6.0; - float p3 = ( 12.0 - 9.0*b - 6.0*c) / 6.0; - float q0 = ( 8.0*b + 24.0*c) / 6.0; - float q1 = ( - 12.0*b - 48.0*c) / 6.0; - float q2 = ( 6.0*b + 30.0*c) / 6.0; - float q3 = ( - b - 6.0*c) / 6.0; - - if (x<-2.0) return 0.0; - if (x<-1.0) return (q0-x*(q1-x*(q2-x*q3))); - if (x< 0.0) return (p0+x*x*(p2-x*p3)); - if (x< 1.0) return (p0+x*x*(p2+x*p3)); - if (x< 2.0) return (q0+x*(q1+x*(q2+x*q3))); - return 0.0; + float p0 = ( 6.0f - 2.0f*b ) / 6.0f; + float p2 = (-18.0f + 12.0f*b + 6.0f*c) / 6.0f; + float p3 = ( 12.0f - 9.0f*b - 6.0f*c) / 6.0f; + float q0 = ( 8.0f*b + 24.0f*c) / 6.0f; + float q1 = ( - 12.0f *b - 48.0f*c) / 6.0f; + float q2 = ( 6.0f *b + 30.0f*c) / 6.0f; + float q3 = ( - b - 6.0f*c) / 6.0f; + + if (x<-2.0f) return 0.0f; + if (x<-1.0f) return (q0-x*(q1-x*(q2-x*q3))); + if (x< 0.0f) return (p0+x*x*(p2-x*p3)); + if (x< 1.0f) return (p0+x*x*(p2+x*p3)); + if (x< 2.0f) return (q0+x*(q1+x*(q2+x*q3))); + return 0.0f; } /* x ranges from -1 to 1 */ @@ -170,16 +170,16 @@ float RE_filter_value(int type, float x) switch(type) { case R_FILTER_BOX: - if(x>1.0) return 0.0f; - return 1.0; + if(x>1.0f) return 0.0f; + return 1.0f; case R_FILTER_TENT: - if(x>1.0) return 0.0f; + if(x>1.0f) return 0.0f; return 1.0f-x; case R_FILTER_GAUSS: x*= gaussfac; - return (1.0/exp(x*x) - 1.0/exp(gaussfac*gaussfac*2.25)); + return (1.0f/expf(x*x) - 1.0f/expf(gaussfac*gaussfac*2.25f)); case R_FILTER_MITCH: return filt_mitchell(x*gaussfac); @@ -221,7 +221,7 @@ static float calc_weight(Render *re, float *weight, int i, int j) case R_FILTER_GAUSS: x = dist*re->r.gauss; - weight[a]= (1.0/exp(x*x) - 1.0/exp(re->r.gauss*re->r.gauss*2.25)); + weight[a]= (1.0f/expf(x*x) - 1.0f/expf(re->r.gauss*re->r.gauss*2.25f)); break; case R_FILTER_MITCH: @@ -309,7 +309,7 @@ void make_sample_tables(Render *re) st->centmask= MEM_mallocN((1<osa), "Initfilt3"); for(a=0; a<16; a++) { - st->centLut[a]= -0.45+((float)a)/16.0; + st->centLut[a]= -0.45f+((float)a)/16.0f; } /* calculate totw */ @@ -327,7 +327,7 @@ void make_sample_tables(Render *re) memset(weight, 0, sizeof(weight)); calc_weight(re, weight, i, j); - for(a=0; a<16; a++) flweight[a]= weight[a]*(1.0/totw); + for(a=0; a<16; a++) flweight[a]= weight[a]*(1.0f/totw); m3= st->fmask1[ 3*(j+1)+i+1 ]; m4= st->fmask2[ 3*(j+1)+i+1 ]; @@ -430,9 +430,9 @@ void make_sample_tables(Render *re) for(a= (1<osa)-1; a>0; a--) { val= st->cmask[a & 255] + st->cmask[a>>8]; - i= 8+(15.9*(fpy1[a & 255]+fpy2[a>>8])/val); + i= 8+(15.9f*(fpy1[a & 255]+fpy2[a>>8])/val); CLAMP(i, 0, 15); - j= 8+(15.9*(fpx1[a & 255]+fpx2[a>>8])/val); + j= 8+(15.9f*(fpx1[a & 255]+fpx2[a>>8])/val); CLAMP(j, 0, 15); i= j + (i<<4); st->centmask[a]= i; diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index 0aa65479a4f..54137c62d22 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1414,7 +1414,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f if(env) { /* sky shading using bent normal */ if(ELEM(envcolor, WO_AOSKYCOL, WO_AOSKYTEX)) { - fac= 0.5*(1.0f+bn[0]*re->grvec[0]+ bn[1]*re->grvec[1]+ bn[2]*re->grvec[2]); + fac= 0.5f*(1.0f+bn[0]*re->grvec[0]+ bn[1]*re->grvec[1]+ bn[2]*re->grvec[2]); env[0]= (1.0f-fac)*re->wrld.horr + fac*re->wrld.zenr; env[1]= (1.0f-fac)*re->wrld.horg + fac*re->wrld.zeng; env[2]= (1.0f-fac)*re->wrld.horb + fac*re->wrld.zenb; diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c index c2e34e2a70d..d945436be6b 100644 --- a/source/blender/render/intern/source/pixelblending.c +++ b/source/blender/render/intern/source/pixelblending.c @@ -68,11 +68,11 @@ extern struct Render R; /* Threshold for a 'full' pixel: pixels with alpha above this level are */ /* considered opaque This is the decimal value for 0xFFF0 / 0xFFFF */ -#define RE_FULL_COLOR_FLOAT 0.9998 +#define RE_FULL_COLOR_FLOAT 0.9998f /* Threshold for an 'empty' pixel: pixels with alpha above this level are */ /* considered completely transparent. This is the decimal value */ /* for 0x000F / 0xFFFF */ -#define RE_EMPTY_COLOR_FLOAT 0.0002 +#define RE_EMPTY_COLOR_FLOAT 0.0002f /* ------------------------------------------------------------------------- */ @@ -82,7 +82,7 @@ void addAlphaOverFloat(float *dest, float *source) /* d = s + (1-alpha_s)d*/ float mul; - mul= 1.0 - source[3]; + mul= 1.0f - source[3]; dest[0]= (mul*dest[0]) + source[0]; dest[1]= (mul*dest[1]) + source[1]; @@ -98,7 +98,7 @@ void addAlphaUnderFloat(float *dest, float *source) { float mul; - mul= 1.0 - dest[3]; + mul= 1.0f - dest[3]; dest[0]+= (mul*source[0]); dest[1]+= (mul*source[1]); @@ -115,7 +115,7 @@ void addalphaAddfacFloat(float *dest, float *source, char addfac) /* Addfac is a number between 0 and 1: rescale */ /* final target is to diminish the influence of dest when addfac rises */ - m = 1.0 - ( source[3] * ((255.0 - addfac) / 255.0)); + m = 1.0f - ( source[3] * ((255 - addfac) / 255.0f)); /* blend colors*/ c= (m * dest[0]) + source[0]; @@ -178,7 +178,7 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w) a= j; val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift); - if(val!=0.0) { + if(val!=0.0f) { rb1[0]+= val*r; rb1[1]+= val*g; rb1[2]+= val*b; @@ -187,7 +187,7 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w) a+=3; val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift); - if(val!=0.0) { + if(val!=0.0f) { rb2[0]+= val*r; rb2[1]+= val*g; rb2[2]+= val*b; @@ -196,7 +196,7 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w) a+=3; val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift); - if(val!=0.0) { + if(val!=0.0f) { rb3[0]+= val*r; rb3[1]+= val*g; rb3[2]+= val*b; @@ -345,21 +345,21 @@ void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row a= j; val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift); - if(val!=0.0) { + if(val!=0.0f) { for(i= 0; ico); - dco[0]=dco[1]=dco[2]= 1.0/har->rad; + dco[0]=dco[1]=dco[2]= 1.0f/har->rad; vn= har->no; @@ -114,9 +114,9 @@ static void render_lighting_halo(HaloRen *har, float *colf) if(lar->mode & LA_QUAD) { t= 1.0; - if(lar->ld1>0.0) + if(lar->ld1>0.0f) t= lar->dist/(lar->dist+lar->ld1*ld); - if(lar->ld2>0.0) + if(lar->ld2>0.0f) t*= lar->distkw/(lar->distkw+lar->ld2*ld*ld); lampdist= t; @@ -127,7 +127,7 @@ static void render_lighting_halo(HaloRen *har, float *colf) if(lar->mode & LA_SPHERE) { t= lar->dist - ld; - if(t<0.0) continue; + if(t<0.0f) continue; t/= lar->dist; lampdist*= (t); @@ -155,7 +155,7 @@ static void render_lighting_halo(HaloRen *har, float *colf) if(lar->type==LA_SPOT) { if(lar->mode & LA_SQUARE) { - if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0) { + if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0f) { float x, lvrot[3]; /* rotate view to lampspace */ @@ -165,7 +165,7 @@ static void render_lighting_halo(HaloRen *har, float *colf) x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2])); /* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */ - inpr= 1.0/(sqrt(1.0+x*x)); + inpr= 1.0/(sqrt(1.0f+x*x)); } else inpr= 0.0; } @@ -179,21 +179,21 @@ static void render_lighting_halo(HaloRen *har, float *colf) t= inpr-t; i= 1.0; soft= 1.0; - if(tspotbl && lar->spotbl!=0.0) { + if(tspotbl && lar->spotbl!=0.0f) { /* soft area */ i= t/lar->spotbl; t= i*i; - soft= (3.0*t-2.0*t*i); + soft= (3.0f*t-2.0f*t*i); inpr*= soft; } if(lar->mode & LA_ONLYSHADOW) { /* if(ma->mode & MA_SHADOW) { */ /* dot product positive: front side face! */ inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2]; - if(inp>0.0) { + if(inp>0.0f) { /* testshadowbuf==0.0 : 100% shadow */ shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f); - if( shadfac>0.0 ) { + if( shadfac>0.0f ) { shadfac*= inp*soft*lar->energy; ir -= shadfac; ig -= shadfac; @@ -219,32 +219,32 @@ static void render_lighting_halo(HaloRen *har, float *colf) i= inp; if(lar->type==LA_HEMI) { - i= 0.5*i+0.5; + i= 0.5f*i+0.5f; } - if(i>0.0) { + if(i>0.0f) { i*= lampdist; } /* shadow */ - if(i> -0.41) { /* heuristic valua! */ + if(i> -0.41f) { /* heuristic valua! */ shadfac= 1.0; if(lar->shb) { shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f); - if(shadfac==0.0) continue; + if(shadfac==0.0f) continue; i*= shadfac; } } - if(i>0.0) { + if(i>0.0f) { ir+= i*lacol[0]; ig+= i*lacol[1]; ib+= i*lacol[2]; } } - if(ir<0.0) ir= 0.0; - if(ig<0.0) ig= 0.0; - if(ib<0.0) ib= 0.0; + if(ir<0.0f) ir= 0.0f; + if(ig<0.0f) ig= 0.0f; + if(ib<0.0f) ib= 0.0f; colf[0]*= ir; colf[1]*= ig; @@ -301,7 +301,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, } else alpha= har->alfa; - if(alpha==0.0) + if(alpha==0.0f) return 0; /* soften the halo if it intersects geometry */ @@ -355,15 +355,15 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, fac= fabs( rc[1]*(har->rad*fabs(rc[0]) - radist) ); - if(fac< 1.0) { - ringf+= (1.0-fac); + if(fac< 1.0f) { + ringf+= (1.0f-fac); } } } if(har->type & HA_VECT) { dist= fabs( har->cos*(yn) - har->sin*(xn) )/har->rad; - if(dist>1.0) dist= 1.0; + if(dist>1.0f) dist= 1.0f; if(har->tex) { zn= har->sin*xn - har->cos*yn; yn= har->cos*xn + har->sin*yn; @@ -374,7 +374,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, if(har->type & HA_FLARECIRC) { - dist= 0.5+fabs(dist-0.5); + dist= 0.5+fabs(dist-0.5f); } @@ -418,7 +418,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, float ster, angle; /* rotation */ angle= atan2(yn, xn); - angle*= (1.0+0.25*har->starpoints); + angle*= (1.0f+0.25f*har->starpoints); co= cos(angle); si= sin(angle); @@ -426,15 +426,15 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, angle= (co*xn+si*yn)*(co*yn-si*xn); ster= fabs(angle); - if(ster>1.0) { + if(ster>1.0f) { ster= (har->rad)/(ster); - if(ster<1.0) dist*= sqrt(ster); + if(ster<1.0f) dist*= sqrt(ster); } } /* disputable optimize... (ton) */ - if(dist<=0.00001) + if(dist<=0.00001f) return 0; dist*= alpha; @@ -471,7 +471,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, } /* Next, we do the line and ring factor modifications. */ - if(linef!=0.0) { + if(linef!=0.0f) { Material *ma= har->mat; col[0]+= linef * ma->specr; @@ -481,7 +481,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz, if(har->type & HA_XALPHA) col[3]+= linef*linef; else col[3]+= linef; } - if(ringf!=0.0) { + if(ringf!=0.0f) { Material *ma= har->mat; col[0]+= ringf * ma->mirr; @@ -516,16 +516,16 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short th blend= view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]; - if(blend<0.0) skyflag= 0; + if(blend<0.0f) skyflag= 0; blend= fabs(blend); } else if(R.wrld.skytype & WO_SKYPAPER) { - blend= 0.5+ 0.5*view[1]; + blend= 0.5f + 0.5f * view[1]; } else { /* the fraction of how far we are above the bottom of the screen */ - blend= fabs(0.5+ view[1]); + blend= fabs(0.5f + view[1]); } VECCOPY(hor, &R.wrld.horr); @@ -545,8 +545,8 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short th do_sky_tex(rco, lo, dxyview, hor, zen, &blend, skyflag, thread); } - if(blend>1.0) blend= 1.0; - blendm= 1.0-blend; + if(blend>1.0f) blend= 1.0f; + blendm= 1.0f-blend; /* No clipping, no conversion! */ if(R.wrld.skytype & WO_SKYBLEND) { @@ -580,8 +580,8 @@ void shadeSunView(float *colf, float *view) VECCOPY(sview, view); normalize_v3(sview); mul_m3_v3(R.imat, sview); - if (sview[2] < 0.0) - sview[2] = 0.0; + if (sview[2] < 0.0f) + sview[2] = 0.0f; normalize_v3(sview); do_init= 0; } diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index d62f411a7c5..e82e969d502 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -611,12 +611,12 @@ static int refraction(float *refract, float *n, float *view, float index) index = 1.0f/index; fac= 1.0f - (1.0f - dot*dot)*index*index; if(fac<= 0.0f) return 0; - fac= -dot*index + sqrt(fac); + fac= -dot*index + sqrtf(fac); } else { fac= 1.0f - (1.0f - dot*dot)*index*index; if(fac<= 0.0f) return 0; - fac= -dot*index - sqrt(fac); + fac= -dot*index - sqrtf(fac); } refract[0]= index*view[0] + fac*n[0]; @@ -693,7 +693,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) if(p < 0.0f) p= 0.0f; else if (p > 10.0f) p= 10.0f; - shr->alpha *= pow(d, p); + shr->alpha *= powf(d, p); if (shr->alpha > 1.0f) shr->alpha= 1.0f; } @@ -720,11 +720,11 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, /* if fading out, linear blend against fade color */ float blendfac; - blendfac = 1.0 - len_v3v3(shi->co, is->start)/dist_mir; + blendfac = 1.0f - len_v3v3(shi->co, is->start)/dist_mir; - col[0] = col[0]*blendfac + (1.0 - blendfac)*blendcol[0]; - col[1] = col[1]*blendfac + (1.0 - blendfac)*blendcol[1]; - col[2] = col[2]*blendfac + (1.0 - blendfac)*blendcol[2]; + col[0] = col[0]*blendfac + (1.0f - blendfac)*blendcol[0]; + col[1] = col[1]*blendfac + (1.0f - blendfac)*blendcol[1]; + col[2] = col[2]*blendfac + (1.0f - blendfac)*blendcol[2]; } /* the main recursive tracer itself @@ -870,7 +870,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo col[2]= shr.diff[2] + shr.spec[2]; } - if (dist_mir > 0.0) { + if (dist_mir > 0.0f) { float blendcol[3]; /* max ray distance set, but found an intersection, so fade this color @@ -922,11 +922,11 @@ static void DP_energy(float *table, float *vec, int tot, float xsize, float ysiz } } } - vec[0] += 0.1*min*result[0]/(float)tot; - vec[1] += 0.1*min*result[1]/(float)tot; + vec[0] += 0.1f*min*result[0]/(float)tot; + vec[1] += 0.1f*min*result[1]/(float)tot; // cyclic clamping - vec[0]= vec[0] - xsize*floor(vec[0]/xsize + 0.5); - vec[1]= vec[1] - ysize*floor(vec[1]/ysize + 0.5); + vec[0]= vec[0] - xsize*floorf(vec[0]/xsize + 0.5f); + vec[1]= vec[1] - ysize*floorf(vec[1]/ysize + 0.5f); } // random offset of 1 in 2 @@ -934,7 +934,7 @@ static void jitter_plane_offset(float *jitter1, float *jitter2, int tot, float s { float dsizex= sizex*ofsx; float dsizey= sizey*ofsy; - float hsizex= 0.5*sizex, hsizey= 0.5*sizey; + float hsizex= 0.5f*sizex, hsizey= 0.5f*sizey; int x; for(x=tot; x>0; x--, jitter1+=2, jitter2+=2) { @@ -968,8 +968,8 @@ void init_jitter_plane(LampRen *lar) /* fill table with random locations, area_size large */ for(x=0; xarea_size; - fp[1]= (BLI_frand()-0.5)*lar->area_sizey; + fp[0]= (BLI_frand()-0.5f)*lar->area_size; + fp[1]= (BLI_frand()-0.5f)*lar->area_sizey; } while(iter--) { @@ -1081,8 +1081,8 @@ static void QMC_initPixel(QMCSampler *qsa, int thread) { /* hammersley sequence is fixed, already created in QMCSampler init. * per pixel, gets a random offset. We create separate offsets per thread, for write-safety */ - qsa->offs[thread][0] = 0.5 * BLI_thread_frand(thread); - qsa->offs[thread][1] = 0.5 * BLI_thread_frand(thread); + qsa->offs[thread][0] = 0.5f * BLI_thread_frand(thread); + qsa->offs[thread][1] = 0.5f * BLI_thread_frand(thread); } else { /* SAMP_TYPE_HALTON */ @@ -1136,8 +1136,8 @@ static void QMC_samplePhong(float *vec, QMCSampler *qsa, int thread, int num, fl pz = pow(s[1], blur); sqr = sqrt(1.0f-pz*pz); - vec[0] = cos(phi)*sqr; - vec[1] = sin(phi)*sqr; + vec[0] = (float)(cosf(phi)*sqr); + vec[1] = (float)(sinf(phi)*sqr); vec[2] = 0.0f; } @@ -1148,8 +1148,8 @@ static void QMC_sampleRect(float *vec, QMCSampler *qsa, int thread, int num, flo QMC_getSample(s, qsa, thread, num); - vec[0] = (s[0] - 0.5) * sizex; - vec[1] = (s[1] - 0.5) * sizey; + vec[0] = (float)(s[0] - 0.5) * sizex; + vec[1] = (float)(s[1] - 0.5) * sizey; vec[2] = 0.0f; } @@ -1164,8 +1164,8 @@ static void QMC_sampleDisc(float *vec, QMCSampler *qsa, int thread, int num, flo phi = s[0]*2*M_PI; sqr = sqrt(s[1]); - vec[0] = cos(phi)*sqr* radius/2.0; - vec[1] = sin(phi)*sqr* radius/2.0; + vec[0] = cosf(phi)*sqr* radius/2.0f; + vec[1] = sinf(phi)*sqr* radius/2.0f; vec[2] = 0.0f; } @@ -1177,12 +1177,12 @@ static void QMC_sampleHemi(float *vec, QMCSampler *qsa, int thread, int num) QMC_getSample(s, qsa, thread, num); - phi = s[0]*2.f*M_PI; + phi = s[0]*2.0*M_PI; sqr = sqrt(s[1]); - vec[0] = cos(phi)*sqr; - vec[1] = sin(phi)*sqr; - vec[2] = 1.f - s[1]*s[1]; + vec[0] = cosf(phi)*sqr; + vec[1] = sinf(phi)*sqr; + vec[2] = (float)(1.0 - s[1]*s[1]); } #if 0 /* currently not used */ @@ -1272,7 +1272,7 @@ static int adaptive_sample_variance(int samples, float *col, float *colsq, float var[1] = (colsq[1] / (float)samples) - (mean[1]*mean[1]); var[2] = (colsq[2] / (float)samples) - (mean[2]*mean[2]); - if ((var[0] * 0.4 < thresh) && (var[1] * 0.3 < thresh) && (var[2] * 0.6 < thresh)) + if ((var[0] * 0.4f < thresh) && (var[1] * 0.3f < thresh) && (var[2] * 0.6f < thresh)) return 1; else return 0; @@ -1283,7 +1283,7 @@ static int adaptive_sample_contrast_val(int samples, float prev, float val, floa /* if the last sample's contribution to the total value was below a small threshold * (i.e. the samples taken are very similar), then taking more samples that are probably * going to be the same is wasting effort */ - if (fabs( prev/(float)(samples-1) - val/(float)samples ) < thresh) { + if (fabsf( prev/(float)(samples-1) - val/(float)samples ) < thresh) { return 1; } else return 0; @@ -1293,10 +1293,10 @@ static float get_avg_speed(ShadeInput *shi) { float pre_x, pre_y, post_x, post_y, speedavg; - pre_x = (shi->winspeed[0] == PASS_VECTOR_MAX)?0.0:shi->winspeed[0]; - pre_y = (shi->winspeed[1] == PASS_VECTOR_MAX)?0.0:shi->winspeed[1]; - post_x = (shi->winspeed[2] == PASS_VECTOR_MAX)?0.0:shi->winspeed[2]; - post_y = (shi->winspeed[3] == PASS_VECTOR_MAX)?0.0:shi->winspeed[3]; + pre_x = (shi->winspeed[0] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[0]; + pre_y = (shi->winspeed[1] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[1]; + post_x = (shi->winspeed[2] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[2]; + post_y = (shi->winspeed[3] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[3]; speedavg = (sqrt(pre_x*pre_x + pre_y*pre_y) + sqrt(post_x*post_x + post_y*post_y)) / 2.0; @@ -1316,7 +1316,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) float v_refract[3], v_refract_new[3]; float sampcol[4], colsq[4]; - float blur = pow(1.0 - shi->mat->gloss_tra, 3); + float blur = powf(1.0f - shi->mat->gloss_tra, 3); short max_samples = shi->mat->samp_gloss_tra; float adapt_thresh = shi->mat->adapt_thresh_tra; @@ -1325,9 +1325,9 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) colsq[0] = colsq[1] = colsq[2] = 0.0; col[0] = col[1] = col[2] = 0.0; col[3]= shr->alpha; - - if (blur > 0.0) { - if (adapt_thresh != 0.0) samp_type = SAMP_TYPE_HALTON; + + if (blur > 0.0f) { + if (adapt_thresh != 0.0f) samp_type = SAMP_TYPE_HALTON; else samp_type = SAMP_TYPE_HAMMERSLEY; /* all samples are generated per pixel */ @@ -1386,13 +1386,13 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) samples++; /* adaptive sampling */ - if (adapt_thresh < 1.0 && samples > max_samples/2) + if (adapt_thresh < 1.0f && samples > max_samples/2) { if (adaptive_sample_variance(samples, col, colsq, adapt_thresh)) break; /* if the pixel so far is very dark, we can get away with less samples */ - if ( (col[0] + col[1] + col[2])/3.0/(float)samples < 0.01 ) + if ( (col[0] + col[1] + col[2])/3.0f/(float)samples < 0.01f ) max_samples--; } } @@ -1415,18 +1415,18 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f float v_nor_new[3], v_reflect[3]; float sampcol[4], colsq[4]; - float blur = pow(1.0 - shi->mat->gloss_mir, 3); + float blur = powf(1.0f - shi->mat->gloss_mir, 3); short max_samples = shi->mat->samp_gloss_mir; float adapt_thresh = shi->mat->adapt_thresh_mir; - float aniso = 1.0 - shi->mat->aniso_gloss_mir; + float aniso = 1.0f - shi->mat->aniso_gloss_mir; int samples=0; col[0] = col[1] = col[2] = 0.0; colsq[0] = colsq[1] = colsq[2] = 0.0; - if (blur > 0.0) { - if (adapt_thresh != 0.0) samp_type = SAMP_TYPE_HALTON; + if (blur > 0.0f) { + if (adapt_thresh != 0.0f) samp_type = SAMP_TYPE_HALTON; else samp_type = SAMP_TYPE_HAMMERSLEY; /* all samples are generated per pixel */ @@ -1485,22 +1485,22 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f samples++; /* adaptive sampling */ - if (adapt_thresh > 0.0 && samples > max_samples/3) + if (adapt_thresh > 0.0f && samples > max_samples/3) { if (adaptive_sample_variance(samples, col, colsq, adapt_thresh)) break; /* if the pixel so far is very dark, we can get away with less samples */ - if ( (col[0] + col[1] + col[2])/3.0/(float)samples < 0.01 ) + if ( (col[0] + col[1] + col[2])/3.0f/(float)samples < 0.01f ) max_samples--; /* reduce samples when reflection is dim due to low ray mirror blend value or fresnel factor * and when reflection is blurry */ - if (fresnelfac < 0.1 * (blur+1)) { + if (fresnelfac < 0.1f * (blur+1)) { max_samples--; /* even more for very dim */ - if (fresnelfac < 0.05 * (blur+1)) + if (fresnelfac < 0.05f * (blur+1)) max_samples--; } } @@ -1659,7 +1659,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int col[1] = a*col[1] + shr.alpha*shr.combined[1]; col[2] = a*col[2] + shr.alpha*shr.combined[2]; - col[3] = (1.0 - shr.alpha)*a; + col[3] = (1.0f - shr.alpha)*a; } if(depth>0 && col[3]>0.0f) { @@ -1758,8 +1758,8 @@ static void RandomSpherical(float *v) if ((r = 1.f - v[2]*v[2])>0.f) { float a = 6.283185307f*BLI_frand(); r = sqrt(r); - v[0] = r * cos(a); - v[1] = r * sin(a); + v[0] = r * cosf(a); + v[1] = r * sinf(a); } else v[2] = 1.f; } @@ -1956,7 +1956,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) float speedfac; speedfac = get_avg_speed(shi) * adapt_speed_fac; - CLAMP(speedfac, 1.0, 1000.0); + CLAMP(speedfac, 1.0f, 1000.0f); max_samples /= speedfac; if (max_samples < 5) max_samples = 5; @@ -1985,7 +1985,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) prev = fac; if(RE_rayobject_raycast(R.raytree, &isec)) { - if (R.wrld.aomode & WO_AODIST) fac+= exp(-isec.dist*R.wrld.aodistfac); + if (R.wrld.aomode & WO_AODIST) fac+= expf(-isec.dist*R.wrld.aodistfac); else fac+= 1.0f; } else if(envcolor!=WO_AOPLAIN) { @@ -1998,7 +1998,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - skyfac= 0.5*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + 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; @@ -2017,7 +2017,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) if (qsa->type == SAMP_TYPE_HALTON) { /* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */ - if (adapt_thresh > 0.0 && (samples > max_samples/2) ) { + if (adapt_thresh > 0.0f && (samples > max_samples/2) ) { if (adaptive_sample_contrast_val(samples, prev, fac, adapt_thresh)) { break; @@ -2123,7 +2123,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) /* do the trace */ if(RE_rayobject_raycast(R.raytree, &isec)) { - if (R.wrld.aomode & WO_AODIST) sh+= exp(-isec.dist*R.wrld.aodistfac); + if (R.wrld.aomode & WO_AODIST) sh+= expf(-isec.dist*R.wrld.aodistfac); else sh+= 1.0f; } else if(envcolor!=WO_AOPLAIN) { @@ -2136,7 +2136,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - fac= 0.5*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + 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; @@ -2367,14 +2367,14 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * if (lar->ray_samp_method == LA_SAMP_HALTON) { /* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */ - if ((max_samples > min_adapt_samples) && (adapt_thresh > 0.0) && (samples > max_samples / 3)) { + if ((max_samples > min_adapt_samples) && (adapt_thresh > 0.0f) && (samples > max_samples / 3)) { if (isec->mode==RE_RAY_SHADOW_TRA) { - if ((shadfac[3] / samples > (1.0-adapt_thresh)) || (shadfac[3] / samples < adapt_thresh)) + if ((shadfac[3] / samples > (1.0f-adapt_thresh)) || (shadfac[3] / samples < adapt_thresh)) break; else if (adaptive_sample_variance(samples, shadfac, colsq, adapt_thresh)) break; } else { - if ((fac / samples > (1.0-adapt_thresh)) || (fac / samples < adapt_thresh)) + if ((fac / samples > (1.0f-adapt_thresh)) || (fac / samples < adapt_thresh)) break; } } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 579afc21c1d..ef1b1cd159c 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -175,9 +175,9 @@ static void tex_normal_derivate(Tex *tex, TexResult *texres) do_colorband(tex->coba, texres->nor[2], col); fac3= (col[0]+col[1]+col[2]); - texres->nor[0]= 0.3333*(fac0 - fac1); - texres->nor[1]= 0.3333*(fac0 - fac2); - texres->nor[2]= 0.3333*(fac0 - fac3); + texres->nor[0]= 0.3333f*(fac0 - fac1); + texres->nor[1]= 0.3333f*(fac0 - fac2); + texres->nor[2]= 0.3333f*(fac0 - fac3); return; } @@ -203,31 +203,31 @@ static int blend(Tex *tex, float *texvec, TexResult *texres) } if(tex->stype==TEX_LIN) { /* lin */ - texres->tin= (1.0+x)/2.0; + texres->tin= (1.0f+x)/2.0f; } else if(tex->stype==TEX_QUAD) { /* quad */ - texres->tin= (1.0+x)/2.0; - if(texres->tin<0.0) texres->tin= 0.0; + texres->tin= (1.0f+x)/2.0f; + if(texres->tin<0.0f) texres->tin= 0.0f; else texres->tin*= texres->tin; } else if(tex->stype==TEX_EASE) { /* ease */ - texres->tin= (1.0+x)/2.0; - if(texres->tin<=.0) texres->tin= 0.0; - else if(texres->tin>=1.0) texres->tin= 1.0; + texres->tin= (1.0f+x)/2.0f; + if(texres->tin<=0.0f) texres->tin= 0.0f; + else if(texres->tin>=1.0f) texres->tin= 1.0f; else { t= texres->tin*texres->tin; - texres->tin= (3.0*t-2.0*t*texres->tin); + texres->tin= (3.0f*t-2.0f*t*texres->tin); } } else if(tex->stype==TEX_DIAG) { /* diag */ - texres->tin= (2.0+x+y)/4.0; + texres->tin= (2.0f+x+y)/4.0f; } else if(tex->stype==TEX_RAD) { /* radial */ texres->tin= (atan2(y,x) / (2*M_PI) + 0.5); } else { /* sphere TEX_SPHERE */ texres->tin= 1.0-sqrt(x*x+ y*y+texvec[2]*texvec[2]); - if(texres->tin<0.0) texres->tin= 0.0; + if(texres->tin<0.0f) texres->tin= 0.0f; if(tex->stype==TEX_HALO) texres->tin*= texres->tin; /* halo */ } @@ -299,7 +299,7 @@ static float tex_tri(float a) const float b = 2*M_PI; const float rmax = 1.0; - a = rmax - 2.0*fabs(floor((a*(1.0/b))+0.5) - (a*(1.0/b))); + a = rmax - 2.0f*fabsf(floorf((a*(1.0f/b))+0.5f) - (a*(1.0f/b))); return a; } @@ -319,18 +319,18 @@ static float wood_int(Tex *tex, float x, float y, float z) if ((wf>TEX_TRI) || (wfturbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); - wi = waveform[wf]((x + y + z)*10.0 + wi); + wi = waveform[wf]((x + y + z)*10.0f + wi); } else if (wt==TEX_RINGNOISE) { wi = tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); - wi = waveform[wf](sqrt(x*x + y*y + z*z)*20.0 + wi); + wi = waveform[wf](sqrt(x*x + y*y + z*z)*20.0f + wi); } return wi; @@ -370,7 +370,7 @@ static float marble_int(Tex *tex, float x, float y, float z) if ((wf>TEX_TRI) || (wfturbul * BLI_gTurbulence(tex->noisesize, x, y, z, tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); @@ -417,11 +417,11 @@ static int magic(Tex *tex, float *texvec, TexResult *texres) int n; n= tex->noisedepth; - turb= tex->turbul/5.0; + turb= tex->turbul/5.0f; - x= sin( ( texvec[0]+texvec[1]+texvec[2])*5.0 ); - y= cos( (-texvec[0]+texvec[1]-texvec[2])*5.0 ); - z= -cos( (-texvec[0]-texvec[1]+texvec[2])*5.0 ); + x= sin( ( texvec[0]+texvec[1]+texvec[2])*5.0f ); + y= cos( (-texvec[0]+texvec[1]-texvec[2])*5.0f ); + z= -cos( (-texvec[0]-texvec[1]+texvec[2])*5.0f ); if(n>0) { x*= turb; y*= turb; @@ -466,17 +466,17 @@ static int magic(Tex *tex, float *texvec, TexResult *texres) } } - if(turb!=0.0) { - turb*= 2.0; + if(turb!=0.0f) { + turb*= 2.0f; x/= turb; y/= turb; z/= turb; } - texres->tr= 0.5-x; - texres->tg= 0.5-y; - texres->tb= 0.5-z; + texres->tr= 0.5f-x; + texres->tg= 0.5f-y; + texres->tb= 0.5f-z; - texres->tin= 0.3333*(texres->tr+texres->tg+texres->tb); + texres->tin= 0.3333f*(texres->tr+texres->tg+texres->tb); BRICONTRGB; texres->ta= 1.0; @@ -494,7 +494,7 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres) b2= BLI_gNoise(tex->noisesize, texvec[0], texvec[1], texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); - ofs= tex->turbul/200.0; + ofs= tex->turbul/200.0f; if(tex->stype) ofs*=(b2*b2); nor[0] = BLI_gNoise(tex->noisesize, texvec[0]+ofs, texvec[1], texvec[2], (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); @@ -732,7 +732,7 @@ static int texnoise(Tex *tex, TexResult *texres) while(loop--) { ran= (ran>>2); val*= (ran & 3); - div*= 3.0; + div*= 3.0f; } texres->tin= ((float)val)/div; @@ -829,18 +829,18 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float z1= fabs(nor[2]); if(z1>=x1 && z1>=y1) { - *adr1 = (x + 1.0) / 2.0; - *adr2 = (y + 1.0) / 2.0; + *adr1 = (x + 1.0f) / 2.0f; + *adr2 = (y + 1.0f) / 2.0f; ret= 0; } else if(y1>=x1 && y1>=z1) { - *adr1 = (x + 1.0) / 2.0; - *adr2 = (z + 1.0) / 2.0; + *adr1 = (x + 1.0f) / 2.0f; + *adr2 = (z + 1.0f) / 2.0f; ret= 1; } else { - *adr1 = (y + 1.0) / 2.0; - *adr2 = (z + 1.0) / 2.0; + *adr1 = (y + 1.0f) / 2.0f; + *adr2 = (z + 1.0f) / 2.0f; ret= 2; } return ret; @@ -884,17 +884,17 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z } if(vlr->puno & proj[1]) { - *adr1 = (x + 1.0) / 2.0; - *adr2 = (y + 1.0) / 2.0; + *adr1 = (x + 1.0f) / 2.0f; + *adr2 = (y + 1.0f) / 2.0f; } else if(vlr->puno & proj[2]) { - *adr1 = (x + 1.0) / 2.0; - *adr2 = (z + 1.0) / 2.0; + *adr1 = (x + 1.0f) / 2.0f; + *adr2 = (z + 1.0f) / 2.0f; ret= 1; } else { - *adr1 = (y + 1.0) / 2.0; - *adr2 = (z + 1.0) / 2.0; + *adr1 = (y + 1.0f) / 2.0f; + *adr2 = (z + 1.0f) / 2.0f; ret= 2; } } @@ -922,18 +922,18 @@ static int cubemap_ob(Object *ob, float *n, float x, float y, float z, float *ad z1= fabs(nor[2]); if(z1>=x1 && z1>=y1) { - *adr1 = (x + 1.0) / 2.0; - *adr2 = (y + 1.0) / 2.0; + *adr1 = (x + 1.0f) / 2.0f; + *adr2 = (y + 1.0f) / 2.0f; ret= 0; } else if(y1>=x1 && y1>=z1) { - *adr1 = (x + 1.0) / 2.0; - *adr2 = (z + 1.0) / 2.0; + *adr1 = (x + 1.0f) / 2.0f; + *adr2 = (z + 1.0f) / 2.0f; ret= 1; } else { - *adr1 = (y + 1.0) / 2.0; - *adr2 = (z + 1.0) / 2.0; + *adr1 = (y + 1.0f) / 2.0f; + *adr2 = (z + 1.0f) / 2.0f; ret= 2; } return ret; @@ -957,8 +957,8 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d if(R.osa==0) { if(wrap==MTEX_FLAT) { - fx = (t[0] + 1.0) / 2.0; - fy = (t[1] + 1.0) / 2.0; + fx = (t[0] + 1.0f) / 2.0f; + fy = (t[1] + 1.0f) / 2.0f; } else if(wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]); else if(wrap==MTEX_SPHERE) map_to_sphere( &fx, &fy,t[0], t[1], t[2]); @@ -973,34 +973,34 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d if(tex->xrepeat>1) { float origf= fx *= tex->xrepeat; - if(fx>1.0) fx -= (int)(fx); - else if(fx<0.0) fx+= 1-(int)(fx); + if(fx>1.0f) fx -= (int)(fx); + else if(fx<0.0f) fx+= 1-(int)(fx); if(tex->flag & TEX_REPEAT_XMIR) { int orig= (int)floor(origf); if(orig & 1) - fx= 1.0-fx; + fx= 1.0f-fx; } } if(tex->yrepeat>1) { float origf= fy *= tex->yrepeat; - if(fy>1.0) fy -= (int)(fy); - else if(fy<0.0) fy+= 1-(int)(fy); + if(fy>1.0f) fy -= (int)(fy); + else if(fy<0.0f) fy+= 1-(int)(fy); if(tex->flag & TEX_REPEAT_YMIR) { int orig= (int)floor(origf); if(orig & 1) - fy= 1.0-fy; + fy= 1.0f-fy; } } } /* crop */ - if(tex->cropxmin!=0.0 || tex->cropxmax!=1.0) { + if(tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) { fac1= tex->cropxmax - tex->cropxmin; fx= tex->cropxmin+ fx*fac1; } - if(tex->cropymin!=0.0 || tex->cropymax!=1.0) { + if(tex->cropymin!=0.0f || tex->cropymax!=1.0f) { fac1= tex->cropymax - tex->cropymin; fy= tex->cropymin+ fy*fac1; } @@ -1011,23 +1011,23 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d else { if(wrap==MTEX_FLAT) { - fx= (t[0] + 1.0) / 2.0; - fy= (t[1] + 1.0) / 2.0; - dxt[0]/= 2.0; - dxt[1]/= 2.0; - dxt[2]/= 2.0; - dyt[0]/= 2.0; - dyt[1]/= 2.0; - dyt[2]/= 2.0; + fx= (t[0] + 1.0f) / 2.0f; + fy= (t[1] + 1.0f) / 2.0f; + dxt[0]/= 2.0f; + dxt[1]/= 2.0f; + dxt[2]/= 2.0f; + dyt[0]/= 2.0f; + dyt[1]/= 2.0f; + dyt[2]/= 2.0f; } else if ELEM(wrap, MTEX_TUBE, MTEX_SPHERE) { /* exception: the seam behind (y<0.0) */ ok= 1; - if(t[1]<=0.0) { + if(t[1]<=0.0f) { fx= t[0]+dxt[0]; fy= t[0]+dyt[0]; - if(fx>=0.0 && fy>=0.0 && t[0]>=0.0); - else if(fx<=0.0 && fy<=0.0 && t[0]<=0.0); + if(fx>=0.0f && fy>=0.0f && t[0]>=0.0f); + else if(fx<=0.0f && fy<=0.0f && t[0]<=0.0f); else ok= 0; } if(ok) { @@ -1046,10 +1046,10 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d else { if(wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]); else map_to_sphere( &fx, &fy,t[0], t[1], t[2]); - dxt[0]/= 2.0; - dxt[1]/= 2.0; - dyt[0]/= 2.0; - dyt[1]/= 2.0; + dxt[0]/= 2.0f; + dxt[1]/= 2.0f; + dyt[0]/= 2.0f; + dyt[1]/= 2.0f; } } else { @@ -1143,13 +1143,13 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d } /* crop */ - if(tex->cropxmin!=0.0 || tex->cropxmax!=1.0) { + if(tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) { fac1= tex->cropxmax - tex->cropxmin; fx= tex->cropxmin+ fx*fac1; dxt[0]*= fac1; dyt[0]*= fac1; } - if(tex->cropymin!=0.0 || tex->cropymax!=1.0) { + if(tex->cropymin!=0.0f || tex->cropymax!=1.0f) { fac1= tex->cropymax - tex->cropymin; fy= tex->cropymin+ fy*fac1; dxt[1]*= fac1; @@ -1220,7 +1220,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, * artificer: added the use of tmpvec to avoid scaling texvec */ VECCOPY(tmpvec, texvec); - mul_v3_fl(tmpvec, 1.0/tex->noisesize); + mul_v3_fl(tmpvec, 1.0f/tex->noisesize); switch(tex->stype) { case TEX_MFRACTAL: @@ -1242,7 +1242,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, * artificer: added the use of tmpvec to avoid scaling texvec */ VECCOPY(tmpvec, texvec); - mul_v3_fl(tmpvec, 1.0/tex->noisesize); + mul_v3_fl(tmpvec, 1.0f/tex->noisesize); retval= voronoiTex(tex, tmpvec, texres); break; @@ -1251,7 +1251,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, * artificer: added the use of tmpvec to avoid scaling texvec */ VECCOPY(tmpvec, texvec); - mul_v3_fl(tmpvec, 1.0/tex->noisesize); + mul_v3_fl(tmpvec, 1.0f/tex->noisesize); retval= mg_distNoiseTex(tex, tmpvec, texres); break; @@ -1381,7 +1381,7 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg switch(blendtype) { case MTEX_BLEND: fact*= facg; - facm= 1.0-fact; + facm= 1.0f-fact; in[0]= (fact*tex[0] + facm*out[0]); in[1]= (fact*tex[1] + facm*out[1]); @@ -1390,7 +1390,7 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg case MTEX_MUL: fact*= facg; - facm= 1.0-facg; + facm= 1.0f-facg; in[0]= (facm+fact*tex[0])*out[0]; in[1]= (facm+fact*tex[1])*out[1]; in[2]= (facm+fact*tex[2])*out[2]; @@ -1398,28 +1398,28 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg case MTEX_SCREEN: fact*= facg; - facm= 1.0-facg; - in[0]= 1.0 - (facm+fact*(1.0-tex[0])) * (1.0-out[0]); - in[1]= 1.0 - (facm+fact*(1.0-tex[1])) * (1.0-out[1]); - in[2]= 1.0 - (facm+fact*(1.0-tex[2])) * (1.0-out[2]); + facm= 1.0f-facg; + in[0]= 1.0f - (facm+fact*(1.0f-tex[0])) * (1.0f-out[0]); + in[1]= 1.0f - (facm+fact*(1.0f-tex[1])) * (1.0f-out[1]); + in[2]= 1.0f - (facm+fact*(1.0f-tex[2])) * (1.0f-out[2]); break; case MTEX_OVERLAY: fact*= facg; - facm= 1.0-facg; + facm= 1.0f-facg; if(out[0] < 0.5f) in[0] = out[0] * (facm + 2.0f*fact*tex[0]); else - in[0] = 1.0f - (facm + 2.0f*fact*(1.0 - tex[0])) * (1.0 - out[0]); + in[0] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[0])) * (1.0f - out[0]); if(out[1] < 0.5f) in[1] = out[1] * (facm + 2.0f*fact*tex[1]); else - in[1] = 1.0f - (facm + 2.0f*fact*(1.0 - tex[1])) * (1.0 - out[1]); + in[1] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[1])) * (1.0f - out[1]); if(out[2] < 0.5f) in[2] = out[2] * (facm + 2.0f*fact*tex[2]); else - in[2] = 1.0f - (facm + 2.0f*fact*(1.0 - tex[2])) * (1.0 - out[2]); + in[2] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[2])) * (1.0f - out[2]); break; case MTEX_SUB: @@ -1433,20 +1433,20 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg case MTEX_DIV: fact*= facg; - facm= 1.0-fact; + facm= 1.0f-fact; - if(tex[0]!=0.0) + if(tex[0]!=0.0f) in[0]= facm*out[0] + fact*out[0]/tex[0]; - if(tex[1]!=0.0) + if(tex[1]!=0.0f) in[1]= facm*out[1] + fact*out[1]/tex[1]; - if(tex[2]!=0.0) + if(tex[2]!=0.0f) in[2]= facm*out[2] + fact*out[2]/tex[2]; break; case MTEX_DIFF: fact*= facg; - facm= 1.0-fact; + facm= 1.0f-fact; in[0]= facm*out[0] + fact*fabs(tex[0]-out[0]); in[1]= facm*out[1] + fact*fabs(tex[1]-out[1]); in[2]= facm*out[2] + fact*fabs(tex[2]-out[2]); @@ -1454,7 +1454,7 @@ void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg case MTEX_DARK: fact*= facg; - facm= 1.0-fact; + facm= 1.0f-fact; col= tex[0]+((1-tex[0])*facm); if(col < out[0]) in[0]= col; else in[0]= out[0]; @@ -1516,7 +1516,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen facg= fabsf(facg); fact*= facg; - facm= 1.0-fact; + facm= 1.0f-fact; if(flip) SWAP(float, fact, facm); switch(blendtype) { @@ -1525,21 +1525,21 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen break; case MTEX_MUL: - facm= 1.0-facg; + facm= 1.0f-facg; in= (facm+fact*tex)*out; break; case MTEX_SCREEN: - facm= 1.0-facg; - in= 1.0-(facm+fact*(1.0-tex))*(1.0-out); + facm= 1.0f-facg; + in= 1.0f-(facm+fact*(1.0f-tex))*(1.0f-out); break; case MTEX_OVERLAY: - facm= 1.0-facg; + facm= 1.0f-facg; if(out < 0.5f) in = out * (facm + 2.0f*fact*tex); else - in = 1.0f - (facm + 2.0f*fact*(1.0 - tex)) * (1.0 - out); + in = 1.0f - (facm + 2.0f*fact*(1.0f - tex)) * (1.0f - out); break; case MTEX_SUB: @@ -1549,7 +1549,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen break; case MTEX_DIV: - if(tex!=0.0) + if(tex!=0.0f) in= facm*out + fact*out/tex; break; @@ -1568,15 +1568,15 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen break; case MTEX_SOFT_LIGHT: - scf=1.0 - (1.0 - tex) * (1.0 - out); - in= facm*out + fact * ((1.0 - out) * tex * out) + (out * scf); + scf=1.0f - (1.0f - tex) * (1.0f - out); + in= facm*out + fact * ((1.0f - out) * tex * out) + (out * scf); break; case MTEX_LIN_LIGHT: - if (tex > 0.5) - in = out + fact*(2*(tex - 0.5)); + if (tex > 0.5f) + in = out + fact*(2.0f*(tex - 0.5f)); else - in = out + fact*(2*tex - 1); + in = out + fact*(2.0f*tex - 1.0f); break; } @@ -2296,16 +2296,16 @@ void do_material_tex(ShadeInput *shi) /* texture output */ if( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) { - texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); rgbnor-= TEX_RGB; } if(mtex->texflag & MTEX_NEGATIVE) { if(rgbnor & TEX_RGB) { - texres.tr= 1.0-texres.tr; - texres.tg= 1.0-texres.tg; - texres.tb= 1.0-texres.tb; + texres.tr= 1.0f-texres.tr; + texres.tg= 1.0f-texres.tg; + texres.tb= 1.0f-texres.tb; } - texres.tin= 1.0-texres.tin; + texres.tin= 1.0f-texres.tin; } if(mtex->texflag & MTEX_STENCIL) { if(rgbnor & TEX_RGB) { @@ -2332,8 +2332,8 @@ void do_material_tex(ShadeInput *shi) texres.nor[2]= texres.tb; } else { - float co_nor= 0.5*cos(texres.tin-0.5); - float si= 0.5*sin(texres.tin-0.5); + float co_nor= 0.5*cos(texres.tin-0.5f); + float si= 0.5*sin(texres.tin-0.5f); float f1, f2; f1= shi->vn[0]; @@ -2419,7 +2419,7 @@ void do_material_tex(ShadeInput *shi) // exception for envmap only if(tex->type==TEX_ENVMAP && mtex->blendtype==MTEX_BLEND) { fact= texres.tin*mirrfac; - facm= 1.0- fact; + facm= 1.0f- fact; shi->refcol[0]= fact + facm*shi->refcol[0]; shi->refcol[1]= fact*tcol[0] + facm*shi->refcol[1]; shi->refcol[2]= fact*tcol[1] + facm*shi->refcol[2]; @@ -2564,65 +2564,65 @@ void do_material_tex(ShadeInput *shi) if(rgbnor & TEX_RGB) { if(texres.talpha) texres.tin= texres.ta; - else texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); } if(mtex->mapto & MAP_REF) { float difffac= mtex->difffac*stencilTin; shi->refl= texture_value_blend(mtex->def_var, shi->refl, texres.tin, difffac, mtex->blendtype); - if(shi->refl<0.0) shi->refl= 0.0; + if(shi->refl<0.0f) shi->refl= 0.0f; } if(mtex->mapto & MAP_SPEC) { float specfac= mtex->specfac*stencilTin; shi->spec= texture_value_blend(mtex->def_var, shi->spec, texres.tin, specfac, mtex->blendtype); - if(shi->spec<0.0) shi->spec= 0.0; + if(shi->spec<0.0f) shi->spec= 0.0f; } if(mtex->mapto & MAP_EMIT) { float emitfac= mtex->emitfac*stencilTin; shi->emit= texture_value_blend(mtex->def_var, shi->emit, texres.tin, emitfac, mtex->blendtype); - if(shi->emit<0.0) shi->emit= 0.0; + if(shi->emit<0.0f) shi->emit= 0.0f; } if(mtex->mapto & MAP_ALPHA) { float alphafac= mtex->alphafac*stencilTin; shi->alpha= texture_value_blend(mtex->def_var, shi->alpha, texres.tin, alphafac, mtex->blendtype); - if(shi->alpha<0.0) shi->alpha= 0.0; - else if(shi->alpha>1.0) shi->alpha= 1.0; + if(shi->alpha<0.0f) shi->alpha= 0.0f; + else if(shi->alpha>1.0f) shi->alpha= 1.0f; } if(mtex->mapto & MAP_HAR) { float har; // have to map to 0-1 float hardfac= mtex->hardfac*stencilTin; - har= ((float)shi->har)/128.0; - har= 128.0*texture_value_blend(mtex->def_var, har, texres.tin, hardfac, mtex->blendtype); + har= ((float)shi->har)/128.0f; + har= 128.0f*texture_value_blend(mtex->def_var, har, texres.tin, hardfac, mtex->blendtype); - if(har<1.0) shi->har= 1; - else if(har>511.0) shi->har= 511; + if(har<1.0f) shi->har= 1; + else if(har>511) shi->har= 511; else shi->har= (int)har; } if(mtex->mapto & MAP_RAYMIRR) { float raymirrfac= mtex->raymirrfac*stencilTin; shi->ray_mirror= texture_value_blend(mtex->def_var, shi->ray_mirror, texres.tin, raymirrfac, mtex->blendtype); - if(shi->ray_mirror<0.0) shi->ray_mirror= 0.0; - else if(shi->ray_mirror>1.0) shi->ray_mirror= 1.0; + if(shi->ray_mirror<0.0f) shi->ray_mirror= 0.0f; + else if(shi->ray_mirror>1.0f) shi->ray_mirror= 1.0f; } if(mtex->mapto & MAP_TRANSLU) { float translfac= mtex->translfac*stencilTin; shi->translucency= texture_value_blend(mtex->def_var, shi->translucency, texres.tin, translfac, mtex->blendtype); - if(shi->translucency<0.0) shi->translucency= 0.0; - else if(shi->translucency>1.0) shi->translucency= 1.0; + if(shi->translucency<0.0f) shi->translucency= 0.0f; + else if(shi->translucency>1.0f) shi->translucency= 1.0f; } if(mtex->mapto & MAP_AMB) { float ambfac= mtex->ambfac*stencilTin; shi->amb= texture_value_blend(mtex->def_var, shi->amb, texres.tin, ambfac, mtex->blendtype); - if(shi->amb<0.0) shi->amb= 0.0; - else if(shi->amb>1.0) shi->amb= 1.0; + if(shi->amb<0.0f) shi->amb= 0.0f; + else if(shi->amb>1.0f) shi->amb= 1.0f; shi->ambr= shi->amb*R.wrld.ambr; shi->ambg= shi->amb*R.wrld.ambg; @@ -2718,16 +2718,16 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa /* texture output */ if( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) { - texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); rgbnor-= TEX_RGB; } if(mtex->texflag & MTEX_NEGATIVE) { if(rgbnor & TEX_RGB) { - texres.tr= 1.0-texres.tr; - texres.tg= 1.0-texres.tg; - texres.tb= 1.0-texres.tb; + texres.tr= 1.0f-texres.tr; + texres.tg= 1.0f-texres.tg; + texres.tb= 1.0f-texres.tb; } - texres.tin= 1.0-texres.tin; + texres.tin= 1.0f-texres.tin; } if(mtex->texflag & MTEX_STENCIL) { if(rgbnor & TEX_RGB) { @@ -2784,7 +2784,7 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa if (!(rgbnor & TEX_INT)) { if (rgbnor & TEX_RGB) { if(texres.talpha) texres.tin= texres.ta; - else texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); } } @@ -2792,25 +2792,25 @@ void do_volume_tex(ShadeInput *shi, float *xyz, int mapto_flag, float *col, floa float emitfac= mtex->emitfac*stencilTin; *val = texture_value_blend(mtex->def_var, *val, texres.tin, emitfac, mtex->blendtype); - if(*val<0.0) *val= 0.0; + if(*val<0.0f) *val= 0.0f; } if((mapto_flag & MAP_DENSITY) && (mtex->mapto & MAP_DENSITY)) { float densfac= mtex->densfac*stencilTin; *val = texture_value_blend(mtex->def_var, *val, texres.tin, densfac, mtex->blendtype); - CLAMP(*val, 0.0, 1.0); + CLAMP(*val, 0.0f, 1.0f); } if((mapto_flag & MAP_SCATTERING) && (mtex->mapto & MAP_SCATTERING)) { float scatterfac= mtex->scatterfac*stencilTin; *val = texture_value_blend(mtex->def_var, *val, texres.tin, scatterfac, mtex->blendtype); - CLAMP(*val, 0.0, 1.0); + CLAMP(*val, 0.0f, 1.0f); } if((mapto_flag & MAP_REFLECTION) && (mtex->mapto & MAP_REFLECTION)) { float reflfac= mtex->reflfac*stencilTin; *val = texture_value_blend(mtex->def_var, *val, texres.tin, reflfac, mtex->blendtype); - CLAMP(*val, 0.0, 1.0); + CLAMP(*val, 0.0f, 1.0f); } } } @@ -2854,7 +2854,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf) if(osatex) { - dx= 1.0/har->rad; + dx= 1.0f/har->rad; if(mtex->projx) { dxt[0]= mtex->size[0]*dx; @@ -2882,16 +2882,16 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf) /* texture output */ if(rgb && (mtex->texflag & MTEX_RGBTOINT)) { - texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); rgb= 0; } if(mtex->texflag & MTEX_NEGATIVE) { if(rgb) { - texres.tr= 1.0-texres.tr; - texres.tg= 1.0-texres.tg; - texres.tb= 1.0-texres.tb; + texres.tr= 1.0f-texres.tr; + texres.tg= 1.0f-texres.tg; + texres.tb= 1.0f-texres.tb; } - else texres.tin= 1.0-texres.tin; + else texres.tin= 1.0f-texres.tin; } /* mapping */ @@ -2918,10 +2918,10 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf) } fact= texres.tin*mtex->colfac; - facm= 1.0-fact; + facm= 1.0f-fact; if(mtex->blendtype==MTEX_MUL) { - facm= 1.0-mtex->colfac; + facm= 1.0f-mtex->colfac; } if(mtex->blendtype==MTEX_SUB) fact= -fact; @@ -2941,15 +2941,15 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf) colf[1]= (fact*texres.tg + har->g); colf[2]= (fact*texres.tb + har->b); - CLAMP(colf[0], 0.0, 1.0); - CLAMP(colf[1], 0.0, 1.0); - CLAMP(colf[2], 0.0, 1.0); + CLAMP(colf[0], 0.0f, 1.0f); + CLAMP(colf[1], 0.0f, 1.0f); + CLAMP(colf[2], 0.0f, 1.0f); } } if(mtex->mapto & MAP_ALPHA) { if(rgb) { if(texres.talpha) texres.tin= texres.ta; - else texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); } colf[3]*= texres.tin; @@ -2999,7 +2999,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f /* only works with texture being "real" */ /* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less then -1.0 */ if(lo[0] || lo[1]) { /* check for zero case [#24807] */ - fact= (1.0/M_PI)*saacos(lo[2])/(sqrt(lo[0]*lo[0] + lo[1]*lo[1])); + fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrt(lo[0]*lo[0] + lo[1]*lo[1])); tempvec[0]= lo[0]*fact; tempvec[1]= lo[1]*fact; tempvec[2]= 0.0; @@ -3020,13 +3020,13 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f if(mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1,lo[0], lo[2], lo[1]); else map_to_sphere( tempvec, tempvec+1,lo[0], lo[2], lo[1]); /* tube/spheremap maps for outside view, not inside */ - tempvec[0]= 1.0-tempvec[0]; + tempvec[0]= 1.0f-tempvec[0]; /* only top half */ - tempvec[1]= 2.0*tempvec[1]-1.0; + tempvec[1]= 2.0f*tempvec[1]-1.0f; tempvec[2]= 0.0; /* and correction for do_2d_mapping */ - tempvec[0]= 2.0*tempvec[0]-1.0; - tempvec[1]= 2.0*tempvec[1]-1.0; + tempvec[0]= 2.0f*tempvec[0]-1.0f; + tempvec[1]= 2.0f*tempvec[1]-1.0f; co= tempvec; } else { @@ -3075,16 +3075,16 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f /* texture output */ if(rgb && (mtex->texflag & MTEX_RGBTOINT)) { - texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); rgb= 0; } if(mtex->texflag & MTEX_NEGATIVE) { if(rgb) { - texres.tr= 1.0-texres.tr; - texres.tg= 1.0-texres.tg; - texres.tb= 1.0-texres.tb; + texres.tr= 1.0f-texres.tr; + texres.tg= 1.0f-texres.tg; + texres.tb= 1.0f-texres.tb; } - else texres.tin= 1.0-texres.tin; + else texres.tin= 1.0f-texres.tin; } if(mtex->texflag & MTEX_STENCIL) { if(rgb) { @@ -3145,7 +3145,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f } } if(mtex->mapto & WOMAP_BLEND) { - if(rgb) texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + if(rgb) texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); *blend= texture_value_blend(mtex->def_var, *blend, texres.tin, mtex->blendfac, mtex->blendtype); } @@ -3281,16 +3281,16 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef /* texture output */ if(rgb && (mtex->texflag & MTEX_RGBTOINT)) { - texres.tin= (0.35*texres.tr+0.45*texres.tg+0.2*texres.tb); + texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb); rgb= 0; } if(mtex->texflag & MTEX_NEGATIVE) { if(rgb) { - texres.tr= 1.0-texres.tr; - texres.tg= 1.0-texres.tg; - texres.tb= 1.0-texres.tb; + texres.tr= 1.0f-texres.tr; + texres.tg= 1.0f-texres.tg; + texres.tb= 1.0f-texres.tb; } - else texres.tin= 1.0-texres.tin; + else texres.tin= 1.0f-texres.tin; } if(mtex->texflag & MTEX_STENCIL) { if(rgb) { @@ -3375,7 +3375,7 @@ int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *t rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, thread, mtex->which_output); if(rgb) { - texr.tin= (0.35*texr.tr+0.45*texr.tg+0.2*texr.tb); + texr.tin= (0.35f*texr.tr+0.45f*texr.tg+0.2f*texr.tb); } else { texr.tr= mtex->r; @@ -3424,14 +3424,14 @@ void render_realtime_texture(ShadeInput *shi, Image *ima) tex= &imatex[shi->thread]; tex->iuser.ok= ima->ok; - texvec[0]= 0.5+0.5*suv->uv[0]; - texvec[1]= 0.5+0.5*suv->uv[1]; - texvec[2] = 0; // initalize it because imagewrap looks at it. + texvec[0]= 0.5f+0.5f*suv->uv[0]; + texvec[1]= 0.5f+0.5f*suv->uv[1]; + texvec[2] = 0.0f; // initalize it because imagewrap looks at it. if(shi->osatex) { - dx[0]= 0.5*suv->dxuv[0]; - dx[1]= 0.5*suv->dxuv[1]; - dy[0]= 0.5*suv->dyuv[0]; - dy[1]= 0.5*suv->dyuv[1]; + dx[0]= 0.5f*suv->dxuv[0]; + dx[1]= 0.5f*suv->dxuv[1]; + dy[0]= 0.5f*suv->dyuv[0]; + dy[1]= 0.5f*suv->dyuv[1]; } texr.nor= NULL; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index c08d6c0f456..b66740c87ba 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -758,7 +758,7 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl) if(lar->type==LA_SUN && lar->sunsky) { /* if it's sky continue and don't apply atmosphere effect on it */ - if(*zrect >= 9.9e10 || rgbrect[3]==0.0f) { + if(*zrect >= 9.9e10f || rgbrect[3]==0.0f) { continue; } @@ -1098,7 +1098,7 @@ static unsigned short *make_solid_mask(RenderPart *pa) static void addAlphaOverFloatMask(float *dest, float *source, unsigned short dmask, unsigned short smask) { unsigned short shared= dmask & smask; - float mul= 1.0 - source[3]; + float mul= 1.0f - source[3]; if(shared) { /* overlapping masks */ @@ -1892,13 +1892,13 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har) fla.r= fabs(rc[0]); fla.g= fabs(rc[1]); fla.b= fabs(rc[2]); - fla.alfa= ma->flareboost*fabs(alfa*visifac*rc[3]); - fla.hard= 20.0f + fabs(70*rc[7]); + fla.alfa= ma->flareboost*fabsf(alfa*visifac*rc[3]); + fla.hard= 20.0f + fabsf(70.0f*rc[7]); fla.tex= 0; - type= (int)(fabs(3.9*rc[6])); + type= (int)(fabs(3.9f*rc[6])); - fla.rad= ma->subsize*sqrt(fabs(2.0f*har->rad*rc[4])); + fla.rad= ma->subsize*sqrtf(fabs(2.0f*har->rad*rc[4])); if(type==3) { fla.rad*= 3.0f; @@ -1907,22 +1907,22 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har) fla.radsq= fla.rad*fla.rad; - vec[0]= 1.4*rc[5]*(har->xs-R.winx/2); - vec[1]= 1.4*rc[5]*(har->ys-R.winy/2); - vec[2]= 32.0f*sqrt(vec[0]*vec[0] + vec[1]*vec[1] + 1.0f); + vec[0]= 1.4f*rc[5]*(har->xs-R.winx/2); + vec[1]= 1.4f*rc[5]*(har->ys-R.winy/2); + vec[2]= 32.0f*sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + 1.0f); - fla.xs= R.winx/2 + vec[0] + (1.2+rc[8])*R.rectx*vec[0]/vec[2]; - fla.ys= R.winy/2 + vec[1] + (1.2+rc[8])*R.rectx*vec[1]/vec[2]; + fla.xs= R.winx/2 + vec[0] + (1.2f+rc[8])*R.rectx*vec[0]/vec[2]; + fla.ys= R.winy/2 + vec[1] + (1.2f+rc[8])*R.rectx*vec[1]/vec[2]; if(R.flag & R_SEC_FIELD) { - if(R.r.mode & R_ODDFIELD) fla.ys += 0.5; - else fla.ys -= 0.5; + if(R.r.mode & R_ODDFIELD) fla.ys += 0.5f; + else fla.ys -= 0.5f; } if(type & 1) fla.type= HA_FLARECIRC; else fla.type= 0; renderhalo_post(rr, rectf, &fla); - fla.alfa*= 0.5; + fla.alfa*= 0.5f; if(type & 2) fla.type= HA_FLARECIRC; else fla.type= 0; renderhalo_post(rr, rectf, &fla); @@ -2205,7 +2205,7 @@ static void bake_displacement(void *handle, ShadeInput *UNUSED(shi), float dist, if(R.r.bake_flag & R_BAKE_NORMALIZE && R.r.bake_maxdist) { disp = (dist+R.r.bake_maxdist) / (R.r.bake_maxdist*2); /* alter the range from [-bake_maxdist, bake_maxdist] to [0, 1]*/ } else { - disp = 0.5 + dist; /* alter the range from [-0.5,0.5] to [0,1]*/ + disp = 0.5f + dist; /* alter the range from [-0.5,0.5] to [0,1]*/ } if(bs->rect_float) { @@ -2277,7 +2277,7 @@ static void bake_set_vlr_dxyco(BakeShade *bs, float *uv1, float *uv2, float *uv3 * then taking u and v partial derivatives to get dxco and dyco */ A= (uv2[0] - uv1[0])*(uv3[1] - uv1[1]) - (uv3[0] - uv1[0])*(uv2[1] - uv1[1]); - if(fabs(A) > FLT_EPSILON) { + if(fabsf(A) > FLT_EPSILON) { A= 0.5f/A; d1= uv2[1] - uv3[1]; @@ -2532,8 +2532,8 @@ static void shade_tface(BakeShade *bs) * where a pixel gets in between 2 faces or the middle of a quad, * camera aligned quads also have this problem but they are less common. * Add a small offset to the UVs, fixes bug #18685 - Campbell */ - vec[a][0]= tface->uv[a][0]*(float)bs->rectx - (0.5f + 0.001); - vec[a][1]= tface->uv[a][1]*(float)bs->recty - (0.5f + 0.002); + vec[a][0]= tface->uv[a][0]*(float)bs->rectx - (0.5f + 0.001f); + vec[a][1]= tface->uv[a][1]*(float)bs->recty - (0.5f + 0.002f); } /* UV indices have to be corrected for possible quad->tria splits */ diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 456162d2d30..0c5ad0475ab 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -943,13 +943,13 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f float tin, tr, tg, tb, ta; float xn, yn, zn, texvec[3], hoco[4], hoco1[4]; - if(hasize==0.0) return NULL; + if(hasize==0.0f) return NULL; projectverto(vec, re->winmat, hoco); - if(hoco[3]==0.0) return NULL; + if(hoco[3]==0.0f) return NULL; if(vec1) { projectverto(vec1, re->winmat, hoco1); - if(hoco1[3]==0.0) return NULL; + if(hoco1[3]==0.0f) return NULL; } har= RE_findOrAddHalo(obr, obr->tothalo++); @@ -959,8 +959,8 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f /* actual projectvert is done in function project_renderdata() because of parts/border/pano */ /* we do it here for sorting of halos */ zn= hoco[3]; - har->xs= 0.5*re->winx*(hoco[0]/zn); - har->ys= 0.5*re->winy*(hoco[1]/zn); + har->xs= 0.5f*re->winx*(hoco[0]/zn); + har->ys= 0.5f*re->winy*(hoco[1]/zn); har->zs= 0x7FFFFF*(hoco[2]/zn); har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn); @@ -970,16 +970,16 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f har->type |= HA_VECT; - xn= har->xs - 0.5*re->winx*(hoco1[0]/hoco1[3]); - yn= har->ys - 0.5*re->winy*(hoco1[1]/hoco1[3]); - if(xn==0.0 || (xn==0.0 && yn==0.0)) zn= 0.0; + xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]); + yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]); + if(xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f; else zn= atan2(yn, xn); har->sin= sin(zn); har->cos= cos(zn); zn= len_v3v3(vec1, vec); - har->hasize= vectsize*zn + (1.0-vectsize)*hasize; + har->hasize= vectsize*zn + (1.0f-vectsize)*hasize; sub_v3_v3v3(har->no, vec, vec1); normalize_v3(har->no); @@ -991,7 +991,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f har->r= ma->r; har->g= ma->g; har->b= ma->b; - har->add= (255.0*ma->add); + har->add= (255.0f*ma->add); har->mat= ma; har->hard= ma->har; har->seed= seed % 256; @@ -1032,7 +1032,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f zn= tin*mtex->alphafac; if(mtex->mapto & MAP_COL) { - zn= 1.0-yn; + zn= 1.0f-yn; har->r= (yn*tr+ zn*ma->r); har->g= (yn*tg+ zn*ma->g); har->b= (yn*tb+ zn*ma->b); @@ -1057,13 +1057,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater float xn, yn, zn, texvec[3], hoco[4], hoco1[4], in[3],tex[3],out[3]; int i, hasrgb; - if(hasize==0.0) return NULL; + if(hasize==0.0f) return NULL; projectverto(vec, re->winmat, hoco); - if(hoco[3]==0.0) return NULL; + if(hoco[3]==0.0f) return NULL; if(vec1) { projectverto(vec1, re->winmat, hoco1); - if(hoco1[3]==0.0) return NULL; + if(hoco1[3]==0.0f) return NULL; } har= RE_findOrAddHalo(obr, obr->tothalo++); @@ -1073,8 +1073,8 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater /* actual projectvert is done in function project_renderdata() because of parts/border/pano */ /* we do it here for sorting of halos */ zn= hoco[3]; - har->xs= 0.5*re->winx*(hoco[0]/zn); - har->ys= 0.5*re->winy*(hoco[1]/zn); + har->xs= 0.5f*re->winx*(hoco[0]/zn); + har->ys= 0.5f*re->winy*(hoco[1]/zn); har->zs= 0x7FFFFF*(hoco[2]/zn); har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn); @@ -1084,16 +1084,16 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater har->type |= HA_VECT; - xn= har->xs - 0.5*re->winx*(hoco1[0]/hoco1[3]); - yn= har->ys - 0.5*re->winy*(hoco1[1]/hoco1[3]); - if(xn==0.0 || (xn==0.0 && yn==0.0)) zn= 0.0; + xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]); + yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]); + if(xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0; else zn= atan2(yn, xn); har->sin= sin(zn); har->cos= cos(zn); - zn= len_v3v3(vec1, vec)*0.5; + zn= len_v3v3(vec1, vec)*0.5f; - har->hasize= vectsize*zn + (1.0-vectsize)*hasize; + har->hasize= vectsize*zn + (1.0f-vectsize)*hasize; sub_v3_v3v3(har->no, vec, vec1); normalize_v3(har->no); @@ -1105,7 +1105,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater har->r= ma->r; har->g= ma->g; har->b= ma->b; - har->add= (255.0*ma->add); + har->add= (255.0f*ma->add); har->mat= ma; har->hard= ma->har; har->seed= seed % 256; @@ -1185,13 +1185,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater if(mtex->mapto & MAP_ALPHA) har->alfa = texture_value_blend(mtex->def_var,har->alfa,tin,mtex->alphafac,mtex->blendtype); if(mtex->mapto & MAP_HAR) - har->hard = 1.0+126.0*texture_value_blend(mtex->def_var,((float)har->hard)/127.0,tin,mtex->hardfac,mtex->blendtype); + har->hard = 1.0f+126.0f*texture_value_blend(mtex->def_var,((float)har->hard)/127.0f,tin,mtex->hardfac,mtex->blendtype); if(mtex->mapto & MAP_RAYMIRR) - har->hasize = 100.0*texture_value_blend(mtex->def_var,har->hasize/100.0,tin,mtex->raymirrfac,mtex->blendtype); + har->hasize = 100.0f*texture_value_blend(mtex->def_var,har->hasize/100.0f,tin,mtex->raymirrfac,mtex->blendtype); if(mtex->mapto & MAP_TRANSLU) { - float add = texture_value_blend(mtex->def_var,(float)har->add/255.0,tin,mtex->translfac,mtex->blendtype); + float add = texture_value_blend(mtex->def_var,(float)har->add/255.0f,tin,mtex->translfac,mtex->blendtype); CLAMP(add, 0.f, 1.f); - har->add = 255.0*add; + har->add = 255.0f*add; } /* now what on earth is this good for?? */ //if(mtex->texco & 16) { @@ -1270,24 +1270,24 @@ void project_renderdata(Render *re, void (*projectfunc)(float *, float mat[][4], projectfunc(vec, re->winmat, hoco); /* we clip halos less critical, but not for the Z */ - hoco[0]*= 0.5; - hoco[1]*= 0.5; + hoco[0]*= 0.5f; + hoco[1]*= 0.5f; if( panotestclip(re, do_pano, hoco) ) { har->miny= har->maxy= -10000; /* that way render clips it */ } - else if(hoco[3]<0.0) { + else if(hoco[3]<0.0f) { har->miny= har->maxy= -10000; /* render clips it */ } else /* do the projection...*/ { /* bring back hocos */ - hoco[0]*= 2.0; - hoco[1]*= 2.0; + hoco[0]*= 2.0f; + hoco[1]*= 2.0f; zn= hoco[3]; - har->xs= 0.5*re->winx*(1.0+hoco[0]/zn); /* the 0.5 negates the previous 2...*/ - har->ys= 0.5*re->winy*(1.0+hoco[1]/zn); + har->xs= 0.5f*re->winx*(1.0f+hoco[0]/zn); /* the 0.5 negates the previous 2...*/ + har->ys= 0.5f*re->winy*(1.0f+hoco[1]/zn); /* this should be the zbuffer coordinate */ har->zs= 0x7FFFFF*(hoco[2]/zn); @@ -1298,11 +1298,11 @@ void project_renderdata(Render *re, void (*projectfunc)(float *, float mat[][4], projectfunc(vec, re->winmat, hoco); vec[0]-= har->hasize; zn= hoco[3]; - har->rad= fabs(har->xs- 0.5*re->winx*(1.0+hoco[0]/zn)); + har->rad= fabsf(har->xs- 0.5f*re->winx*(1.0f+hoco[0]/zn)); /* this clip is not really OK, to prevent stars to become too large */ if(har->type & HA_ONLYSKY) { - if(har->rad>3.0) har->rad= 3.0; + if(har->rad>3.0f) har->rad= 3.0f; } har->radsq= har->rad*har->rad; diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index dcb9a3063e1..5860c395b07 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -260,7 +260,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon) } else { /* compute visibility at center between slopes at z */ - slope= (slopemin+slopemax)*0.5; + slope= (slopemin+slopemax)*0.5f; v= newds->v + slope*((z - newds->z)/(double)0x7FFFFFFF); } @@ -774,7 +774,7 @@ void makeshadowbuf(Render *re, LampRen *lar) angle= saacos(lar->spotsi); temp= 0.5f*shb->size*cos(angle)/sin(angle); shb->pixsize= (shb->d)/temp; - wsize= shb->pixsize*(shb->size/2.0); + wsize= shb->pixsize*(shb->size/2.0f); perspective_m4( shb->winmat,-wsize, wsize, -wsize, wsize, shb->d, shb->clipend); mul_m4_m4m4(shb->persmat, shb->viewmat, shb->winmat); @@ -1094,7 +1094,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int else { /* soft area */ temp= ( (float)(zs- zsamp) )/(float)bias; - return 1.0 - temp*temp; + return 1.0f - temp*temp; } } @@ -1287,7 +1287,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i /* soft area */ temp= ( (float)(zs- zsamp) )/(float)bias; - return 1.0 - temp*temp; + return 1.0f - temp*temp; } @@ -1303,15 +1303,15 @@ float shadow_halo(LampRen *lar, float *p1, float *p2) int x, y, z, xs1, ys1; int dx = 0, dy = 0; - siz= 0.5*(float)shb->size; + siz= 0.5f*(float)shb->size; co[0]= p1[0]; co[1]= p1[1]; co[2]= p1[2]/lar->sh_zfac; co[3]= 1.0; mul_m4_v4(shb->winmat, co); /* rational hom co */ - xf1= siz*(1.0+co[0]/co[3]); - yf1= siz*(1.0+co[1]/co[3]); + xf1= siz*(1.0f+co[0]/co[3]); + yf1= siz*(1.0f+co[1]/co[3]); zf1= (co[2]/co[3]); @@ -1320,8 +1320,8 @@ float shadow_halo(LampRen *lar, float *p1, float *p2) co[2]= p2[2]/lar->sh_zfac; co[3]= 1.0; mul_m4_v4(shb->winmat, co); /* rational hom co */ - xf2= siz*(1.0+co[0]/co[3]); - yf2= siz*(1.0+co[1]/co[3]); + xf2= siz*(1.0f+co[0]/co[3]); + yf2= siz*(1.0f+co[1]/co[3]); zf2= (co[2]/co[3]); /* the 2dda (a pixel line formula) */ @@ -1330,8 +1330,8 @@ float shadow_halo(LampRen *lar, float *p1, float *p2) ys1= (int)yf1; if(xf1 != xf2) { - if(xf2-xf1 > 0.0) { - labdax= (xf1-xs1-1.0)/(xf1-xf2); + if(xf2-xf1 > 0.0f) { + labdax= (xf1-xs1-1.0f)/(xf1-xf2); ldx= -shb->shadhalostep/(xf1-xf2); dx= shb->shadhalostep; } @@ -1347,8 +1347,8 @@ float shadow_halo(LampRen *lar, float *p1, float *p2) } if(yf1 != yf2) { - if(yf2-yf1 > 0.0) { - labday= (yf1-ys1-1.0)/(yf1-yf2); + if(yf2-yf1 > 0.0f) { + labday= (yf1-ys1-1.0f)/(yf1-yf2); ldy= -shb->shadhalostep/(yf1-yf2); dy= shb->shadhalostep; } @@ -1389,16 +1389,16 @@ float shadow_halo(LampRen *lar, float *p1, float *p2) } labda= MIN2(labdax, labday); - if(labda==labdao || labda>=1.0) break; + if(labda==labdao || labda>=1.0f) break; zf= zf1 + labda*(zf2-zf1); count+= (float)shb->totbuf; - if(zf<= -1.0) lightcount += 1.0; /* close to the spot */ + if(zf<= -1.0f) lightcount += 1.0f; /* close to the spot */ else { /* make sure, behind the clipend we extend halolines. */ - if(zf>=1.0) z= 0x7FFFF000; + if(zf>=1.0f) z= 0x7FFFF000; else z= (int)(0x7FFFF000*zf); for(shsample= shb->buffers.first; shsample; shsample= shsample->next) @@ -1407,8 +1407,8 @@ float shadow_halo(LampRen *lar, float *p1, float *p2) } } - if(count!=0.0) return (lightcount/count); - return 0.0; + if(count!=0.0f) return (lightcount/count); + return 0.0f; } @@ -2081,11 +2081,11 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v /* ortho viewplane cannot intersect using view vector originating in (0,0,0) */ if(R.r.mode & R_ORTHO) { /* x and y 3d coordinate can be derived from pixel coord and winmat */ - float fx= 2.0/(R.winx*R.winmat[0][0]); - float fy= 2.0/(R.winy*R.winmat[1][1]); + float fx= 2.0f/(R.winx*R.winmat[0][0]); + float fy= 2.0f/(R.winy*R.winmat[1][1]); - hoco[0]= (x - 0.5*R.winx)*fx - R.winmat[3][0]/R.winmat[0][0]; - hoco[1]= (y - 0.5*R.winy)*fy - R.winmat[3][1]/R.winmat[1][1]; + hoco[0]= (x - 0.5f*R.winx)*fx - R.winmat[3][0]/R.winmat[0][0]; + hoco[1]= (y - 0.5f*R.winy)*fy - R.winmat[3][1]/R.winmat[1][1]; /* using a*x + b*y + c*z = d equation, (a b c) is normal */ if(nor[2]!=0.0f) @@ -2141,9 +2141,9 @@ static void isb_add_shadfac(ISBShadfacA **isbsapp, MemArena *mem, int obi, int f /* in osa case, the samples were filled in with factor 1.0/R.osa. if fewer samples we have to correct */ if(R.osa) - shadfacf= ((float)shadfac*R.osa)/(4096.0*samples); + shadfacf= ((float)shadfac*R.osa)/(4096.0f*samples); else - shadfacf= ((float)shadfac)/(4096.0); + shadfacf= ((float)shadfac)/(4096.0f); new= BLI_memarena_alloc(mem, sizeof(ISBShadfacA)); new->obi= obi; @@ -2640,4 +2640,3 @@ void ISB_free(RenderPart *pa) } } } - diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index f7d1b43d4f7..0ba13b31c4b 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -172,7 +172,7 @@ static float f_Rd(float alpha_, float A, float ro) float sq; sq= sqrt(3.0f*(1.0f - alpha_)); - return (alpha_/2.0f)*(1.0f + exp((-4.0f/3.0f)*A*sq))*exp(-sq) - ro; + return (alpha_/2.0f)*(1.0f + expf((-4.0f/3.0f)*A*sq))*expf(-sq) - ro; } static float compute_reduced_albedo(ScatterSettings *ss) @@ -189,10 +189,10 @@ static float compute_reduced_albedo(ScatterSettings *ss) for(i= 0; i < max_iteration_count; i++) { fsub= (fxn - fxn_1); - if(fabs(fsub) < tolerance) + if(fabsf(fsub) < tolerance) break; d= ((xn - xn_1)/fsub)*fxn; - if(fabs(d) < tolerance) + if(fabsf(d) < tolerance) break; xn_1= xn; @@ -221,10 +221,10 @@ static float Rd_rsquare(ScatterSettings *ss, float rr) sr= sqrt(rr + ss->zr*ss->zr); sv= sqrt(rr + ss->zv*ss->zv); - Rdr= ss->zr*(1.0f + ss->sigma*sr)*exp(-ss->sigma*sr)/(sr*sr*sr); - Rdv= ss->zv*(1.0f + ss->sigma*sv)*exp(-ss->sigma*sv)/(sv*sv*sv); + Rdr= ss->zr*(1.0f + ss->sigma*sr)*expf(-ss->sigma*sr)/(sr*sr*sr); + Rdv= ss->zv*(1.0f + ss->sigma*sv)*expf(-ss->sigma*sv)/(sv*sv*sv); - return /*ss->alpha_*/(1.0f/(4.0f*M_PI))*(Rdr + Rdv); + return /*ss->alpha_*/(1.0f/(4.0f*(float)M_PI))*(Rdr + Rdv); } static float Rd(ScatterSettings *ss, float r) @@ -316,7 +316,7 @@ ScatterSettings *scatter_settings_new(float refl, float radius, float ior, float ss->alpha_= compute_reduced_albedo(ss); ss->sigma= 1.0f/ss->ld; - ss->sigma_t_= ss->sigma/sqrt(3.0f*(1.0f - ss->alpha_)); + ss->sigma_t_= ss->sigma/sqrtf(3.0f*(1.0f - ss->alpha_)); ss->sigma_s_= ss->alpha_*ss->sigma_t_; ss->sigma_a= ss->sigma_t_ - ss->sigma_s_; @@ -489,7 +489,7 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) for(i=0; itotpoint; i++) { p= &node->points[i]; - rad= p->area*fabs(p->rad[0] + p->rad[1] + p->rad[2]); + rad= p->area*fabsf(p->rad[0] + p->rad[1] + p->rad[2]); totrad += rad; node->co[0] += rad*p->co[0]; @@ -513,20 +513,20 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) } if(node->area > 1e-16f) { - inv= 1.0/node->area; + inv= 1.0f/node->area; node->rad[0] *= inv; node->rad[1] *= inv; node->rad[2] *= inv; } if(node->backarea > 1e-16f) { - inv= 1.0/node->backarea; + inv= 1.0f/node->backarea; node->backrad[0] *= inv; node->backrad[1] *= inv; node->backrad[2] *= inv; } if(totrad > 1e-16f) { - inv= 1.0/totrad; + inv= 1.0f/totrad; node->co[0] *= inv; node->co[1] *= inv; node->co[2] *= inv; @@ -566,8 +566,8 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) subnode= node->child[i]; - rad= subnode->area*fabs(subnode->rad[0] + subnode->rad[1] + subnode->rad[2]); - rad += subnode->backarea*fabs(subnode->backrad[0] + subnode->backrad[1] + subnode->backrad[2]); + rad= subnode->area*fabsf(subnode->rad[0] + subnode->rad[1] + subnode->rad[2]); + rad += subnode->backarea*fabsf(subnode->backrad[0] + subnode->backrad[1] + subnode->backrad[2]); totrad += rad; node->co[0] += rad*subnode->co[0]; @@ -587,20 +587,20 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) } if(node->area > 1e-16f) { - inv= 1.0/node->area; + inv= 1.0f/node->area; node->rad[0] *= inv; node->rad[1] *= inv; node->rad[2] *= inv; } if(node->backarea > 1e-16f) { - inv= 1.0/node->backarea; + inv= 1.0f/node->backarea; node->backrad[0] *= inv; node->backrad[1] *= inv; node->backrad[2] *= inv; } if(totrad > 1e-16f) { - inv= 1.0/totrad; + inv= 1.0f/totrad; node->co[0] *= inv; node->co[1] *= inv; node->co[2] *= inv; @@ -668,9 +668,9 @@ static void create_octree_node(ScatterTree *tree, ScatterNode *node, float *mid, return; } - subsize[0]= size[0]*0.5; - subsize[1]= size[1]*0.5; - subsize[2]= size[2]*0.5; + subsize[0]= size[0]*0.5f; + subsize[1]= size[1]*0.5f; + subsize[2]= size[2]*0.5f; node->split[0]= mid[0]; node->split[1]= mid[1]; @@ -764,7 +764,7 @@ ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error, for(i=0; iscale*tree->scale); + points[i].area= fabsf(area[i])/(tree->scale*tree->scale); points[i].back= (area[i] < 0.0f); mul_v3_fl(points[i].co, 1.0f/tree->scale); @@ -794,13 +794,13 @@ void scatter_tree_build(ScatterTree *tree) tree->root->points= newpoints; tree->root->totpoint= totpoint; - mid[0]= (tree->min[0]+tree->max[0])*0.5; - mid[1]= (tree->min[1]+tree->max[1])*0.5; - mid[2]= (tree->min[2]+tree->max[2])*0.5; + mid[0]= (tree->min[0]+tree->max[0])*0.5f; + mid[1]= (tree->min[1]+tree->max[1])*0.5f; + mid[2]= (tree->min[2]+tree->max[2])*0.5f; - size[0]= (tree->max[0]-tree->min[0])*0.5; - size[1]= (tree->max[1]-tree->min[1])*0.5; - size[2]= (tree->max[2]-tree->min[2])*0.5; + size[0]= (tree->max[0]-tree->min[0])*0.5f; + size[1]= (tree->max[1]-tree->min[1])*0.5f; + size[2]= (tree->max[2]-tree->min[2])*0.5f; create_octree_node(tree, tree->root, mid, size, tree->refpoints, 0); diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 72cb35e7827..840e5444ff0 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -78,9 +78,9 @@ static float strand_eval_width(Material *ma, float strandco) if(ma->strand_ease!=0.0f) { if(ma->strand_ease<0.0f) - fac= pow(strandco, 1.0+ma->strand_ease); + fac= pow(strandco, 1.0f+ma->strand_ease); else - fac= pow(strandco, 1.0/(1.0f-ma->strand_ease)); + fac= pow(strandco, 1.0f/(1.0f-ma->strand_ease)); } else fac= strandco; @@ -816,8 +816,8 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa zbuf_alloc_span(&zspan, pa->rectx, pa->recty, clipcrop); /* needed for transform from hoco to zbuffer co */ - zspan.zmulx= ((float)winx)/2.0; - zspan.zmuly= ((float)winy)/2.0; + zspan.zmulx= ((float)winx)/2.0f; + zspan.zmuly= ((float)winy)/2.0f; zspan.zofsx= -pa->disprect.xmin; zspan.zofsy= -pa->disprect.ymin; diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 5877fa42292..e824b81096b 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -68,12 +68,12 @@ * */ void ClipColor(float c[3]) { - if (c[0] > 1.0) c[0] = 1.0; - if (c[0] < 0.0) c[0] = 0.0; - if (c[1] > 1.0) c[1] = 1.0; - if (c[1] < 0.0) c[1] = 0.0; - if (c[2] > 1.0) c[2] = 1.0; - if (c[2] < 0.0) c[2] = 0.0; + if (c[0] > 1.0f) c[0] = 1.0f; + if (c[0] < 0.0f) c[0] = 0.0f; + if (c[1] > 1.0f) c[1] = 1.0f; + if (c[1] < 0.0f) c[1] = 0.0f; + if (c[2] > 1.0f) c[2] = 1.0f; + if (c[2] < 0.0f) c[2] = 0.0f; } /** @@ -85,9 +85,9 @@ static float AngleBetween(float thetav, float phiv, float theta, float phi) { float cospsi = sin(thetav) * sin(theta) * cos(phi - phiv) + cos(thetav) * cos(theta); - if (cospsi > 1.0) + if (cospsi > 1.0f) return 0; - if (cospsi < -1.0) + if (cospsi < -1.0f) return M_PI; return acos(cospsi); @@ -117,11 +117,11 @@ static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, { float den, num; - den = ((1 + lam[0] * exp(lam[1])) * - (1 + lam[2] * exp(lam[3] * sunsky->theta) + lam[4] * cos(sunsky->theta) * cos(sunsky->theta))); + den = ((1 + lam[0] * expf(lam[1])) * + (1 + lam[2] * expf(lam[3] * sunsky->theta) + lam[4] * cosf(sunsky->theta) * cosf(sunsky->theta))); - num = ((1 + lam[0] * exp(lam[1] / cos(theta))) * - (1 + lam[2] * exp(lam[3] * gamma) + lam[4] * cos(gamma) * cos(gamma))); + num = ((1 + lam[0] * expf(lam[1] / cosf(theta))) * + (1 + lam[2] * expf(lam[3] * gamma) + lam[4] * cosf(gamma) * cosf(gamma))); return(lvz * num / den);} @@ -173,41 +173,41 @@ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_b T = turb; T2 = turb*turb; - chi = (4.0 / 9.0 - T / 120.0) * (M_PI - 2 * sunsky->theta); - sunsky->zenith_Y = (4.0453 * T - 4.9710) * tan(chi) - .2155 * T + 2.4192; + chi = (4.0f / 9.0f - T / 120.0f) * ((float)M_PI - 2.0f * sunsky->theta); + sunsky->zenith_Y = (4.0453f * T - 4.9710f) * tanf(chi) - 0.2155f * T + 2.4192f; sunsky->zenith_Y *= 1000; // conversion from kcd/m^2 to cd/m^2 if (sunsky->zenith_Y<=0) sunsky->zenith_Y = 1e-6; sunsky->zenith_x = - ( + 0.00165 * theta3 - 0.00374 * theta2 + 0.00208 * sunsky->theta + 0) * T2 + - ( -0.02902 * theta3 + 0.06377 * theta2 - 0.03202 * sunsky->theta + 0.00394) * T + - ( + 0.11693 * theta3 - 0.21196 * theta2 + 0.06052 * sunsky->theta + 0.25885); + ( + 0.00165f * theta3 - 0.00374f * theta2 + 0.00208f * sunsky->theta + 0.0f) * T2 + + ( -0.02902f * theta3 + 0.06377f * theta2 - 0.03202f * sunsky->theta + 0.00394f) * T + + ( + 0.11693f * theta3 - 0.21196f * theta2 + 0.06052f * sunsky->theta + 0.25885f); sunsky->zenith_y = - ( + 0.00275 * theta3 - 0.00610 * theta2 + 0.00316 * sunsky->theta + 0) * T2 + - ( -0.04214 * theta3 + 0.08970 * theta2 - 0.04153 * sunsky->theta + 0.00515) * T + - ( + 0.15346 * theta3 - 0.26756 * theta2 + 0.06669 * sunsky->theta + 0.26688); + ( + 0.00275f * theta3 - 0.00610f * theta2 + 0.00316f * sunsky->theta + 0.0f) * T2 + + ( -0.04214f * theta3 + 0.08970f * theta2 - 0.04153f * sunsky->theta + 0.00515f) * T + + ( + 0.15346f * theta3 - 0.26756f * theta2 + 0.06669f * sunsky->theta + 0.26688f); - sunsky->perez_Y[0] = 0.17872 * T - 1.46303; - sunsky->perez_Y[1] = -0.35540 * T + 0.42749; - sunsky->perez_Y[2] = -0.02266 * T + 5.32505; - sunsky->perez_Y[3] = 0.12064 * T - 2.57705; - sunsky->perez_Y[4] = -0.06696 * T + 0.37027; - - sunsky->perez_x[0] = -0.01925 * T - 0.25922; - sunsky->perez_x[1] = -0.06651 * T + 0.00081; - sunsky->perez_x[2] = -0.00041 * T + 0.21247; - sunsky->perez_x[3] = -0.06409 * T - 0.89887; - sunsky->perez_x[4] = -0.00325 * T + 0.04517; - - sunsky->perez_y[0] = -0.01669 * T - 0.26078; - sunsky->perez_y[1] = -0.09495 * T + 0.00921; - sunsky->perez_y[2] = -0.00792 * T + 0.21023; - sunsky->perez_y[3] = -0.04405 * T - 1.65369; - sunsky->perez_y[4] = -0.01092 * T + 0.05291; + sunsky->perez_Y[0] = 0.17872f * T - 1.46303f; + sunsky->perez_Y[1] = -0.35540f * T + 0.42749f; + sunsky->perez_Y[2] = -0.02266f * T + 5.32505f; + sunsky->perez_Y[3] = 0.12064f * T - 2.57705f; + sunsky->perez_Y[4] = -0.06696f * T + 0.37027f; + + sunsky->perez_x[0] = -0.01925f * T - 0.25922f; + sunsky->perez_x[1] = -0.06651f * T + 0.00081f; + sunsky->perez_x[2] = -0.00041f * T + 0.21247f; + sunsky->perez_x[3] = -0.06409f * T - 0.89887f; + sunsky->perez_x[4] = -0.00325f * T + 0.04517f; + + sunsky->perez_y[0] = -0.01669f * T - 0.26078f; + sunsky->perez_y[1] = -0.09495f * T + 0.00921f; + sunsky->perez_y[2] = -0.00792f * T + 0.21023f; + sunsky->perez_y[3] = -0.04405f * T - 1.65369f; + sunsky->perez_y[4] = -0.01092f * T + 0.05291f; /* suggested by glome in * http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/ @@ -248,17 +248,17 @@ void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float colo float hfade=1, nfade=1; - if (theta>(0.5*M_PI)) { - hfade = 1.0-(theta*M_1_PI-0.5)*2.0; - hfade = hfade*hfade*(3.0-2.0*hfade); + if (theta>(0.5f*(float)M_PI)) { + hfade = 1.0f-(theta*(float)M_1_PI-0.5f)*2.0f; + hfade = hfade*hfade*(3.0f-2.0f*hfade); theta = 0.5*M_PI; } - if (sunsky->theta>(0.5*M_PI)) { - if (theta<=0.5*M_PI) { - nfade = 1.0-(0.5-theta*M_1_PI)*2.0; - nfade *= 1.0-(sunsky->theta*M_1_PI-0.5)*2.0; - nfade = nfade*nfade*(3.0-2.0*nfade); + if (sunsky->theta>(0.5f*(float)M_PI)) { + if (theta<=0.5f*(float)M_PI) { + nfade = 1.0f-(0.5f-theta*(float)M_1_PI)*2.0f; + nfade *= 1.0f-(sunsky->theta*(float)M_1_PI-0.5f)*2.0f; + nfade = nfade*nfade*(3.0f-2.0f*nfade); } } @@ -267,7 +267,7 @@ void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float colo // Compute xyY values x = PerezFunction(sunsky, sunsky->perez_x, theta, gamma, sunsky->zenith_x); y = PerezFunction(sunsky, sunsky->perez_y, theta, gamma, sunsky->zenith_y); - Y = 6.666666667e-5 * nfade * hfade * PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y); + Y = 6.666666667e-5f * nfade * hfade * PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y); if(sunsky->sky_exposure!=0.0f) Y = 1.0 - exp(Y*sunsky->sky_exposure); @@ -296,8 +296,8 @@ void GetSkyXYZRadiancef(struct SunSky* sunsky, const float varg[3], float color_ copy_v3_v3(v, (float*)varg); normalize_v3(v); - if (v[2] < 0.001){ - v[2] = 0.001; + if (v[2] < 0.001f) { + v[2] = 0.001f; normalize_v3(v); } @@ -329,15 +329,15 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3]) fAlpha = 1.3f; fBeta = 0.04608365822050f * turbidity - 0.04586025928522f; - m = 1.0/(cos(theta) + 0.15f*pow(93.885f-theta/M_PI*180.0f,-1.253f)); + m = 1.0f/(cosf(theta) + 0.15f*powf(93.885f-theta/(float)M_PI*180.0f,-1.253f)); for(i = 0; i < 3; i++) { // Rayleigh Scattering - fTauR = exp( -m * 0.008735f * pow(fLambda[i], (float)(-4.08f))); + fTauR = expf( -m * 0.008735f * powf(fLambda[i], (float)(-4.08f))); // Aerosal (water + dust) attenuation - fTauA = exp(-m * fBeta * pow(fLambda[i], -fAlpha)); + fTauA = exp(-m * fBeta * powf(fLambda[i], -fAlpha)); fTau[i] = fTauR * fTauA; } @@ -364,8 +364,8 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r const float pn = 0.035f; const float T = 2.0f; float fTemp, fTemp2, fTemp3, fBeta, fBetaDash; - float c = (6.544*T - 6.51)*1e-17; - float K[3] = {0.685f, 0.679f, 0.670f}; + float c = (6.544f*T - 6.51f)*1e-17f; + float K[3] = {0.685f, 0.679f, 0.670f}; float vBetaMieTemp[3]; float fLambda[3],fLambda2[3], fLambda4[3]; @@ -410,7 +410,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r // Mie scattering constants. - fTemp2 = 0.434*c*(2*pi)*(2*pi)*0.5f; + fTemp2 = 0.434f*c*(2*pi)*(2*pi)*0.5f; vec3opf(sunSky->atm_BetaDashMie, vLambda2, *, fTemp2); fTemp3 = 0.434f*c*pi*(2*pi)*(2*pi); @@ -460,7 +460,7 @@ void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float vec3opv(sunSky->atm_BetaRM, sunSky->atm_BetaRay, +, sunSky->atm_BetaMie); //e^(-(beta_1 + beta_2) * s) = E1 - vec3opf(E1, sunSky->atm_BetaRM, *, -s/M_LN2); + vec3opf(E1, sunSky->atm_BetaRM, *, -s/(float)M_LN2); E1[0] = exp(E1[0]); E1[1] = exp(E1[1]); E1[2] = exp(E1[2]); @@ -469,17 +469,17 @@ void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float //Phase2(theta) = (1-g^2)/(1+g-2g*cos(theta))^(3/2) fTemp = 1 + sunSky->atm_HGg - 2 * sunSky->atm_HGg * costheta; - fTemp = fTemp * sqrt(fTemp); + fTemp = fTemp * sqrtf(fTemp); Phase_2 = (1 - sunSky->atm_HGg * sunSky->atm_HGg)/fTemp; vec3opf(vTemp1, sunSky->atm_BetaDashRay, *, Phase_1); vec3opf(vTemp2, sunSky->atm_BetaDashMie, *, Phase_2); vec3opv(vTemp1, vTemp1, +, vTemp2); - fopvec3(vTemp2, 1.0, -, E1); + fopvec3(vTemp2, 1.0f, -, E1); vec3opv(vTemp1, vTemp1, *, vTemp2); - fopvec3(vTemp2, 1.0, / , sunSky->atm_BetaRM); + fopvec3(vTemp2, 1.0f, / , sunSky->atm_BetaRM); vec3opv(I, vTemp1, *, vTemp2); diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 13d9ead79e8..04e4ce2c647 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -217,24 +217,24 @@ static short cliptestf(float p, float q, float *u1, float *u2) { float r; - if(p<0.0) { + if(p<0.0f) { if(q*u2) return 0; else if(r>*u1) *u1=r; } } else { - if(p>0.0) { - if(q<0.0) return 0; + if(p>0.0f) { + if(q<0.0f) return 0; else if(q0.0) { + if(u1>0.0f) { v1[0]= v1[0]+u1*dx; v1[1]= v1[1]+u1*dy; v1[2]= v1[2]+u1*dz; @@ -898,8 +898,8 @@ void hoco_to_zco(ZSpan *zspan, float *zco, float *hoco) float div; div= 1.0f/hoco[3]; - zco[0]= zspan->zmulx*(1.0+hoco[0]*div) + zspan->zofsx; - zco[1]= zspan->zmuly*(1.0+hoco[1]*div) + zspan->zofsy; + zco[0]= zspan->zmulx*(1.0f+hoco[0]*div) + zspan->zofsx; + zco[1]= zspan->zmuly*(1.0f+hoco[1]*div) + zspan->zofsy; zco[2]= 0x7FFFFFFF *(hoco[2]*div); } @@ -1083,7 +1083,7 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v y0= z1*x2-x1*z2; z0= x1*y2-y1*x2; - if(z0==0.0) return; + if(z0==0.0f) return; xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2]; @@ -1203,7 +1203,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, y0= z1*x2-x1*z2; z0= x1*y2-y1*x2; - if(z0==0.0) return; + if(z0==0.0f) return; xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2]; @@ -1330,7 +1330,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f y0= z1*x2-x1*z2; z0= x1*y2-y1*x2; - if(z0==0.0) return; + if(z0==0.0f) return; xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2]; @@ -1627,12 +1627,12 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a if(cliptestf(-da-dw, v13+v1[a], &u1,&u2)) { if(cliptestf(da-dw, v13-v1[a], &u1,&u2)) { *b3=1; - if(u2<1.0) { + if(u2<1.0f) { labda[1]= u2; *b2=1; } else labda[1]=1.0; /* u2 */ - if(u1>0.0) { + if(u1>0.0f) { labda[0]= u1; *b2=1; } else labda[0]=0.0; @@ -1662,8 +1662,8 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo l1= labda[0]; l2= labda[1]; - if(l1!= -1.0) { - if(l1!= 0.0) { + if(l1!= -1.0f) { + if(l1!= 0.0f) { adr= vez+4*(*clve); trias[*b1]=adr; (*clve)++; @@ -1676,8 +1676,8 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo (*b1)++; } - if(l2!= -1.0) { - if(l2!= 1.0) { + if(l2!= -1.0f) { + if(l2!= 1.0f) { adr= vez+4*(*clve); trias[*b1]=adr; (*clve)++; @@ -2066,8 +2066,8 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*, zbuf_alloc_span(zspan, pa->rectx, pa->recty, R.clipcrop); /* needed for transform from hoco to zbuffer co */ - zspan->zmulx= ((float)R.winx)/2.0; - zspan->zmuly= ((float)R.winy)/2.0; + zspan->zmulx= ((float)R.winx)/2.0f; + zspan->zmuly= ((float)R.winy)/2.0f; if(R.osa) { zspan->zofsx= -pa->disprect.xmin - R.jit[pa->sample+zsample][0]; @@ -2290,8 +2290,8 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int /* 1.0f for clipping in clippyra()... bad stuff actually */ zbuf_alloc_span(&zspan, size, size, 1.0f); - zspan.zmulx= ((float)size)/2.0; - zspan.zmuly= ((float)size)/2.0; + zspan.zmulx= ((float)size)/2.0f; + zspan.zmuly= ((float)size)/2.0f; /* -0.5f to center the sample position */ zspan.zofsx= jitx - 0.5f; zspan.zofsy= jity - 0.5f; @@ -2527,8 +2527,8 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo zspan.sss_func= func; /* needed for transform from hoco to zbuffer co */ - zspan.zmulx= ((float)R.winx)/2.0; - zspan.zmuly= ((float)R.winy)/2.0; + zspan.zmulx= ((float)R.winx)/2.0f; + zspan.zmuly= ((float)R.winy)/2.0f; /* -0.5f to center the sample position */ zspan.zofsx= -pa->disprect.xmin - 0.5f; @@ -2671,7 +2671,7 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float y0= z1*x2-x1*z2; z0= x1*y2-y1*x2; - if(z0==0.0) return; + if(z0==0.0f) return; xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2]; @@ -2840,8 +2840,8 @@ static void quad_bezier_2d(float *result, float *v1, float *v2, float *ipodata) p1[1]= v1[1]; /* official formula 2*p2 - .5*p1 - .5*p3 */ - p2[0]= -0.5*p1[0] - 0.5*p3[0]; - p2[1]= -0.5*p1[1] - 0.5*p3[1]; + p2[0]= -0.5f*p1[0] - 0.5f*p3[0]; + p2[1]= -0.5f*p1[1] - 0.5f*p3[1]; result[0]= ipodata[0]*p1[0] + ipodata[1]*p2[0] + ipodata[2]*p3[0]; result[1]= ipodata[0]*p1[1] + ipodata[1]*p2[1] + ipodata[2]*p3[1]; @@ -2871,8 +2871,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * char *rectmove, *dm; zbuf_alloc_span(&zspan, xsize, ysize, 1.0f); - zspan.zmulx= ((float)xsize)/2.0; - zspan.zmuly= ((float)ysize)/2.0; + zspan.zmulx= ((float)xsize)/2.0f; + zspan.zmuly= ((float)ysize)/2.0f; zspan.zofsx= 0.0f; zspan.zofsy= 0.0f; @@ -3258,8 +3258,8 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase * zbuf_alloc_span(zspan, pa->rectx, pa->recty, re->clipcrop); /* needed for transform from hoco to zbuffer co */ - zspan->zmulx= ((float)winx)/2.0; - zspan->zmuly= ((float)winy)/2.0; + zspan->zmulx= ((float)winx)/2.0f; + zspan->zmuly= ((float)winy)/2.0f; /* the buffers */ zspan->arectz= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "Arectz"); @@ -3344,15 +3344,15 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase * if(partclip==0) { /* a little advantage for transp rendering (a z offset) */ - if(!shadow && ma->zoffs != 0.0) { + if(!shadow && ma->zoffs != 0.0f) { mul= 0x7FFFFFFF; - zval= mul*(1.0+ho1[2]/ho1[3]); + zval= mul*(1.0f+ho1[2]/ho1[3]); VECCOPY(vec, v1->co); /* z is negative, otherwise its being clipped */ vec[2]-= ma->zoffs; projectverto(vec, obwinmat, hoco); - fval= mul*(1.0+hoco[2]/hoco[3]); + fval= mul*(1.0f+hoco[2]/hoco[3]); polygon_offset= (int) fabs(zval - fval ); } @@ -4240,7 +4240,3 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas /* end of zbuf.c */ - - - - -- cgit v1.2.3 From be25346da68be9027757bef101562987483afd1c Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 21 Aug 2011 07:08:15 +0000 Subject: Bugfix [#28308] Crashes when individual channels are moved in Action Editor --- .../blender/editors/animation/anim_channels_edit.c | 73 +++++++++++----------- 1 file changed, 38 insertions(+), 35 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index ffa0b2d5ff5..e993faa71aa 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1042,11 +1042,6 @@ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mod static int animchannels_rearrange_exec(bContext *C, wmOperator *op) { bAnimContext ac; - - ListBase anim_data = {NULL, NULL}; - bAnimListElem *ale; - int filter; - short mode; /* get editor data */ @@ -1056,43 +1051,51 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op) /* get mode */ mode= RNA_enum_get(op->ptr, "direction"); - /* get animdata blocks */ - // XXX: hierarchy visibility is provisional atm... might be wrong decision! - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA); - ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - - for (ale = anim_data.first; ale; ale = ale->next) { - AnimData *adt= ale->data; + /* method to move channels depends on the editor */ + if (ac.datatype == ANIMCONT_GPENCIL) { + /* Grease Pencil channels */ + printf("Grease Pencil not supported for moving yet\n"); + } + else if (ac.datatype == ANIMCONT_ACTION) { + /* Directly rearrange action's channels */ + rearrange_action_channels(&ac, ac.data, mode); + } + else { + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; - switch (ac.datatype) { - case ANIMCONT_NLA: /* NLA-tracks only */ - rearrange_nla_channels(&ac, adt, mode); - break; + /* get animdata blocks */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt= ale->data; - case ANIMCONT_DRIVERS: /* Drivers list only */ - rearrange_driver_channels(&ac, adt, mode); - break; - - case ANIMCONT_GPENCIL: /* Grease Pencil channels */ - // FIXME: this case probably needs to get moved out of here or treated specially... - printf("grease pencil not supported for moving yet\n"); - break; + switch (ac.datatype) { + case ANIMCONT_NLA: /* NLA-tracks only */ + rearrange_nla_channels(&ac, adt, mode); + break; - case ANIMCONT_SHAPEKEY: // DOUBLE CHECK ME... + case ANIMCONT_DRIVERS: /* Drivers list only */ + rearrange_driver_channels(&ac, adt, mode); + break; - default: /* some collection of actions */ - // FIXME: actions should only be considered once! - if (adt->action) - rearrange_action_channels(&ac, adt->action, mode); - else if (G.f & G_DEBUG) - printf("animdata has no action\n"); - break; + case ANIMCONT_SHAPEKEY: // DOUBLE CHECK ME... + + default: /* some collection of actions */ + if (adt->action) + rearrange_action_channels(&ac, adt->action, mode); + else if (G.f & G_DEBUG) + printf("Animdata has no action\n"); + break; + } } + + /* free temp data */ + BLI_freelistN(&anim_data); } - /* free temp data */ - BLI_freelistN(&anim_data); - /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); -- cgit v1.2.3 From 8fcc8dd776d20d51d0e76a5cb0028c052b9dbfc3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Aug 2011 10:14:21 +0000 Subject: fix for out of bounds array access for shaded drawing in the UI, remove alpha blending for uiDrawBoxShade and uiDrawBoxVerticalShade. --- source/blender/editors/interface/interface_draw.c | 48 +++++++++++------------ 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 97299a6a766..dd7d2ca765f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -140,26 +140,25 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r glEnd(); } -static void round_box_shade_col(float *col1, float *col2, float fac) +static void round_box_shade_col(const float col1[3], float const col2[3], const float fac) { - float col[4]; + float col[3]; col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]); col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]); col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]); - col[3]= (fac*col1[3] + (1.0f-fac)*col2[3]); - glColor4fv(col); + glColor3fv(col); } - /* linear horizontal shade within button or in outline */ /* view2d scrollers use it */ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown) { float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; - float div= maxy-miny; - float coltop[4], coldown[4], color[4]; + const float div= maxy - miny; + const float idiv= 1.0f / div; + float coltop[3], coldown[3], color[4]; int a; /* mult */ @@ -173,11 +172,9 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f; coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f; coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f; - coltop[3]= color[3]; coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f; coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f; coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f; - coldown[3]= color[3]; glShadeModel(GL_SMOOTH); glBegin(mode); @@ -189,11 +186,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glVertex2f(maxx-rad, miny); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, vec[a][1]/div); + round_box_shade_col(coltop, coldown, vec[a][1]*idiv); glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); } - round_box_shade_col(coltop, coldown, rad/div); + round_box_shade_col(coltop, coldown, rad*idiv); glVertex2f(maxx, miny+rad); } else { @@ -204,11 +201,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* corner right-top */ if(roundboxtype & 2) { - round_box_shade_col(coltop, coldown, (div-rad)/div); + round_box_shade_col(coltop, coldown, (div-rad)*idiv); glVertex2f(maxx, maxy-rad); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])/div); + round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])*idiv); glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); } round_box_shade_col(coltop, coldown, 1.0); @@ -226,11 +223,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glVertex2f(minx+rad, maxy); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, (div-vec[a][1])/div); + round_box_shade_col(coltop, coldown, (div-vec[a][1])*idiv); glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); } - round_box_shade_col(coltop, coldown, (div-rad)/div); + round_box_shade_col(coltop, coldown, (div-rad)*idiv); glVertex2f(minx, maxy-rad); } else { @@ -241,11 +238,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* corner left-bottom */ if(roundboxtype & 8) { - round_box_shade_col(coltop, coldown, rad/div); + round_box_shade_col(coltop, coldown, rad*idiv); glVertex2f(minx, miny+rad); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, (rad-vec[a][1])/div); + round_box_shade_col(coltop, coldown, (rad-vec[a][1])*idiv); glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); } @@ -267,7 +264,8 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float { float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; - float div= maxx-minx; + const float div= maxx - minx; + const float idiv= 1.0f / div; float colLeft[3], colRight[3], color[4]; int a; @@ -295,11 +293,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glVertex2f(maxx-rad, miny); for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, vec[a][0]/div); + round_box_shade_col(colLeft, colRight, vec[a][0]*idiv); glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); } - round_box_shade_col(colLeft, colRight, rad/div); + round_box_shade_col(colLeft, colRight, rad*idiv); glVertex2f(maxx, miny+rad); } else { @@ -314,10 +312,10 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])/div); + round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])*idiv); glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); } - round_box_shade_col(colLeft, colRight, (div-rad)/div); + round_box_shade_col(colLeft, colRight, (div-rad)*idiv); glVertex2f(maxx-rad, maxy); } else { @@ -327,11 +325,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float /* corner left-top */ if(roundboxtype & 1) { - round_box_shade_col(colLeft, colRight, (div-rad)/div); + round_box_shade_col(colLeft, colRight, (div-rad)*idiv); glVertex2f(minx+rad, maxy); for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])/div); + round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])*idiv); glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); } @@ -349,7 +347,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glVertex2f(minx, miny+rad); for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, (vec[a][0])/div); + round_box_shade_col(colLeft, colRight, (vec[a][0])*idiv); glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); } -- cgit v1.2.3 From 4427c146832a3398178ad4851e9c9606fad17489 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 21 Aug 2011 13:25:19 +0000 Subject: Small fix, report in IRC by Olivier: Click in Compositor on output node invoked a re-composite. Only has to be done for inactive outputs. --- source/blender/editors/space_node/node_edit.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 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 9cafc46ca53..011f9a31c93 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -550,14 +550,16 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) } } else if(node->type==CMP_NODE_COMPOSITE) { - bNode *tnode; - - for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) - if( tnode->type==CMP_NODE_COMPOSITE) - tnode->flag &= ~NODE_DO_OUTPUT; - - node->flag |= NODE_DO_OUTPUT; - ED_node_generic_update(bmain, ntree, node); + if (was_output==0) { + bNode *tnode; + + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) + if( tnode->type==CMP_NODE_COMPOSITE) + tnode->flag &= ~NODE_DO_OUTPUT; + + node->flag |= NODE_DO_OUTPUT; + ED_node_generic_update(bmain, ntree, node); + } } } else if(ntree->type==NTREE_TEXTURE) { -- cgit v1.2.3 From ee938c3be861d55ceea217ff09c5f42c89b956c6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 21 Aug 2011 13:25:56 +0000 Subject: Bugfix [#28309] pose lib too many keyframes in automatic keyframing mode Pose Library was checking in wrong place for what was selected and what wasn't when determining what should get autokeyed. --- source/blender/editors/armature/poselib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index ff6deb6a836..864eaa3bdbd 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -906,11 +906,11 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData /* start tagging/keying */ for (agrp= act->groups.first; agrp; agrp= agrp->next) { - /* only for selected action channels */ - if (agrp->flag & AGRP_SELECTED) { - pchan= get_pose_channel(pose, agrp->name); - - if (pchan) { + /* only for selected bones unless there aren't any selected, in which case all are included */ + pchan= get_pose_channel(pose, agrp->name); + + if (pchan) { + if ( (pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) ) { if (autokey) { /* add datasource override for the PoseChannel, to be used later */ ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); -- cgit v1.2.3 From 36f20f162caf83929e6eb07be6b73eb59740ead4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 21 Aug 2011 13:31:46 +0000 Subject: Fix #28154: linux3-config.py doesn't exist Change OURPLATFORM from "linux" to simple "linux". Since new policy for linux kernel versions that major version in platform doesn't make much sense for building rules so the same rules could be used for both of linux2 and linux3 now/ Tested on both of linux2 and linux3 systems. --- source/blender/blenpluginapi/SConscript | 2 +- source/blender/editors/armature/SConscript | 2 +- source/blender/editors/mesh/SConscript | 2 +- source/blender/editors/object/SConscript | 2 +- source/blender/editors/physics/SConscript | 2 +- source/blender/editors/render/SConscript | 2 +- source/blender/editors/screen/SConscript | 2 +- source/blender/editors/sculpt_paint/SConscript | 2 +- source/blender/editors/space_file/SConscript | 2 +- source/blender/editors/space_node/SConscript | 2 +- source/blender/makesrna/SConscript | 2 +- source/blender/makesrna/intern/SConscript | 4 ++-- source/blender/nodes/SConscript | 2 +- source/blender/render/SConscript | 2 +- source/blender/windowmanager/SConscript | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/blenpluginapi/SConscript b/source/blender/blenpluginapi/SConscript index 32e69069bb0..7c7c1318a6e 100644 --- a/source/blender/blenpluginapi/SConscript +++ b/source/blender/blenpluginapi/SConscript @@ -11,7 +11,7 @@ if env['WITH_BF_QUICKTIME']: defs.append('WITH_QUICKTIME') incs += ' ' + env['BF_QUICKTIME_INC'] -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript index beabd912a20..b7f9a263bc1 100644 --- a/source/blender/editors/armature/SConscript +++ b/source/blender/editors/armature/SConscript @@ -7,7 +7,7 @@ incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../makesrna #/intern/opennl/extern' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 34936c025bc..b992ae5f04c 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -8,7 +8,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript index 660643fbb0f..ca048cb59f9 100644 --- a/source/blender/editors/object/SConscript +++ b/source/blender/editors/object/SConscript @@ -10,7 +10,7 @@ incs += ' ../../render/extern/include ../../gpu' # for object_bake.c defs = [] -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript index 274819c918c..188416eb04c 100644 --- a/source/blender/editors/physics/SConscript +++ b/source/blender/editors/physics/SConscript @@ -10,7 +10,7 @@ incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' defs = '' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript index 2b9737557cd..53418500ea6 100644 --- a/source/blender/editors/render/SConscript +++ b/source/blender/editors/render/SConscript @@ -9,7 +9,7 @@ incs += ' ../../gpu' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' incs += ' ../../blenloader' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript index 61f3429521d..1381c820224 100644 --- a/source/blender/editors/screen/SConscript +++ b/source/blender/editors/screen/SConscript @@ -10,7 +10,7 @@ incs += ' #/intern/guardedalloc #/extern/glew/include' defs = '' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript index 90b56ded2cd..b3927fcee68 100644 --- a/source/blender/editors/sculpt_paint/SConscript +++ b/source/blender/editors/sculpt_paint/SConscript @@ -10,7 +10,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../render/extern/include' incs += ' ../../gpu ../../makesrna ../../blenloader' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript index 7c55b40e816..ad96840f7b9 100644 --- a/source/blender/editors/space_file/SConscript +++ b/source/blender/editors/space_file/SConscript @@ -19,7 +19,7 @@ if env['WITH_BF_OPENEXR']: if env['WITH_BF_TIFF']: defs.append('WITH_TIFF') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript index 634d4b777d9..c4309dcfca3 100644 --- a/source/blender/editors/space_node/SConscript +++ b/source/blender/editors/space_node/SConscript @@ -15,7 +15,7 @@ if env['CC'] == 'gcc': #cf.append('-Werror') pass -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index b706db5e64c..1cb24630fbe 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -54,7 +54,7 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_COLLADA']: defs.append('WITH_COLLADA') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 5e43ed9b2fb..24c892b96c4 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -91,7 +91,7 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_COLLADA']: defs.append('WITH_COLLADA') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' @@ -140,7 +140,7 @@ targetpath = root_build_dir+'/makesrna' if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): targetpath = '#' + targetpath -if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep: +if env['OURPLATFORM'] == 'linux' and root_build_dir[0]==os.sep: makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib']) else: makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib']) diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript index 4bed612144c..8d17c6f5e16 100644 --- a/source/blender/nodes/SConscript +++ b/source/blender/nodes/SConscript @@ -26,7 +26,7 @@ if env['WITH_BF_PYTHON']: if env['BF_DEBUG']: defs.append('_DEBUG') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/render/SConscript b/source/blender/render/SConscript index bff7797e0c7..4ec1ce3de6b 100644 --- a/source/blender/render/SConscript +++ b/source/blender/render/SConscript @@ -31,7 +31,7 @@ if env['OURPLATFORM'] == 'darwin': cflags_raytrace = env['CFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] cxxflags_raytrace = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': if env['WITH_BF_RAYOPTIMIZATION']: cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] cxxflags_raytrace = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS'] diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index 5b6e8b1ab30..e548d99e9a5 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -26,7 +26,7 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_COLLADA']: defs.append('WITH_COLLADA') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' -- cgit v1.2.3 From 4f75566672b06931556888b0b300533c110d6e3d Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 21 Aug 2011 13:51:04 +0000 Subject: export animations if a bone is in a deform group. ( on hold ) --- source/blender/collada/AnimationExporter.cpp | 23 ++++++++++++++++++++++- source/blender/collada/AnimationExporter.h | 2 ++ source/blender/collada/ArmatureExporter.cpp | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 8a7d285abcb..014c13d8986 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -352,13 +352,34 @@ void AnimationExporter::exportAnimations(Scene *sce) if (!ob_arm->adt) return; + //This will only export animations of bones in deform group. + /*if(!is_bone_deform_group(bone)) + return;*/ + sample_and_write_bone_animation_matrix(ob_arm, bone); for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) write_bone_animation_matrix(ob_arm, child); } - + bool AnimationExporter::is_bone_deform_group(Bone * bone) + { + bool is_def; + //Check if current bone is deform + if((bone->flag & BONE_NO_DEFORM) == 0 ) return true; + //Check child bones + else + { + for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next){ + //loop through all the children until deform bone is found, and then return + is_def = is_bone_deform_group(child); + if (is_def) return true; + } + } + //no deform bone found in children also + return false; + } + void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone) { bArmature *arm = (bArmature*)ob_arm->data; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index c628e5633b7..495cdefc9a2 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -102,6 +102,8 @@ protected: void sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type); + bool is_bone_deform_group(Bone * bone); + void sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone); void sample_animation(float *v, std::vector &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 082105baaba..bd7aea16b29 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -167,6 +167,7 @@ std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm) // parent_mat is armature-space void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) { + /*if((bone->flag & BONE_NO_DEFORM) == 0 ){*/ std::string node_id = get_joint_id(bone, ob_arm); std::string node_name = std::string(bone->name); std::string node_sid = get_joint_sid(bone, ob_arm); -- cgit v1.2.3 From 6b99cd05aa5528a931e391c5d78278aeaa6dd861 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 21 Aug 2011 15:47:21 +0000 Subject: Armature object animations export. --- source/blender/collada/AnimationExporter.cpp | 13 ++++++++----- source/blender/collada/ArmatureExporter.cpp | 4 +--- source/blender/collada/ArmatureImporter.cpp | 19 ++++++++++++++++--- source/blender/collada/ArmatureImporter.h | 1 + 4 files changed, 26 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 014c13d8986..2f074992076 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -63,6 +63,8 @@ void AnimationExporter::exportAnimations(Scene *sce) //Export transform animations if(ob->adt && ob->adt->action) { + fcu = (FCurve*)ob->adt->action->curves.first; + //transform matrix export for bones are temporarily disabled here. if ( ob->type == OB_ARMATURE ) { @@ -71,19 +73,20 @@ void AnimationExporter::exportAnimations(Scene *sce) for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) write_bone_animation_matrix(ob, bone); + transformName = fcu->rna_path; } - else { - fcu = (FCurve*)ob->adt->action->curves.first; + else + transformName = extract_transform_name( fcu->rna_path ); + while (fcu) { - transformName = extract_transform_name( fcu->rna_path ); - + transformName = extract_transform_name( fcu->rna_path ); if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)|| (!strcmp(transformName, "rotation_quaternion"))) dae_animation(ob ,fcu, transformName, false); fcu = fcu->next; } - } + } //Export Lamp parameter animations diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index bd7aea16b29..92d06bb639f 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -167,7 +167,6 @@ std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm) // parent_mat is armature-space void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) { - /*if((bone->flag & BONE_NO_DEFORM) == 0 ){*/ std::string node_id = get_joint_id(bone, ob_arm); std::string node_name = std::string(bone->name); std::string node_sid = get_joint_sid(bone, ob_arm); @@ -189,8 +188,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm) for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) { add_bone_node(child, ob_arm); } - - node.end(); + node.end(); //} } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 67828fb967d..1e7879b352f 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -82,6 +82,10 @@ JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node); void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *parent, int totchild, float parent_mat[][4], Object * ob_arm) { + std::vector::iterator it; + it = std::find(finished_joints.begin(),finished_joints.end(),node); + if ( it != finished_joints.end()) return; + float mat[4][4]; float obmat[4][4]; @@ -151,11 +155,18 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p add_leaf_bone(mat, bone, node); } + finished_joints.push_back(node); + } void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild, float parent_mat[][4], bArmature *arm) { + //Checking if bone is already made. + std::vector::iterator it; + it = std::find(finished_joints.begin(),finished_joints.end(),node); + if ( it != finished_joints.end()) return; + float joint_inv_bind_mat[4][4]; // JointData* jd = get_joint_data(node); @@ -183,10 +194,10 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo else copy_m4_m4(mat, obmat); - /*float loc[3], size[3], rot[3][3] , angle; + float loc[3], size[3], rot[3][3] , angle; mat4_to_loc_rot_size( loc, rot, size, obmat); mat3_to_vec_roll(rot, NULL, &angle ); - bone->roll=angle;*/ + bone->roll=angle; } @@ -257,6 +268,8 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo if (!children.getCount() || children.getCount() > 1) { add_leaf_bone(mat, bone , node); } + + finished_joints.push_back(node); } void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW::Node * node) @@ -659,7 +672,7 @@ void ArmatureImporter::make_armatures(bContext *C) } //for bones without skins - //create_armature_bones(); + create_armature_bones(); } #if 0 diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index 92d070ef575..4f4aed210f2 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -89,6 +89,7 @@ private: std::map geom_uid_by_controller_uid; std::map joint_by_uid; // contains all joints std::vector root_joints; + std::vector finished_joints; std::map joint_parent_map; std::map unskinned_armature_map; -- cgit v1.2.3 From 17c8621cc819b5082cc356c8da9735eb2e481455 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Aug 2011 21:17:55 +0000 Subject: fix [bf-blender-Patches][27924] Redundant applying of SetNetworkDevice noticed by Jorge Bernal (lordloki) --- source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 1 - source/gameengine/GamePlayer/ghost/GPG_Application.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'source') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index a3ea85b605c..f00dd279361 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -233,7 +233,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetCanvas(canvas); ketsjiengine->SetRenderTools(rendertools); ketsjiengine->SetRasterizer(rasterizer); - ketsjiengine->SetNetworkDevice(networkdevice); ketsjiengine->SetUseFixedTime(usefixed); ketsjiengine->SetTimingDisplay(frameRate, profile, properties); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index f2b322084ed..a4824e0004d 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -616,7 +616,6 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) m_ketsjiengine->SetCanvas(m_canvas); m_ketsjiengine->SetRenderTools(m_rendertools); m_ketsjiengine->SetRasterizer(m_rasterizer); - m_ketsjiengine->SetNetworkDevice(m_networkdevice); m_ketsjiengine->SetTimingDisplay(frameRate, false, false); #ifdef WITH_PYTHON -- cgit v1.2.3 From cb05e405408d7dd8bd82589453df81b955dd0322 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 22 Aug 2011 01:22:14 +0000 Subject: Improved hotkeys for frame/keyframe/jumping Thanks pepeland and 3duan for the suggestions. I've been looking at improving these for a while... * Left/Right Arrow = Single Frame stepping as before * Up/Down Arrow = Jumps to next/previous keyframe (used to be the uncomfortable Shift PageUp/Down) * Shift Up/Down Arrow = Jumps forward/back in 10 frame increments (used to be Up/Down Arrows). 10 frame increment should get customisable again as in 2.4, but need to find some UI space to put that! * Ctrl Shift Up/Down/Left/Right = Jump to start/end frame (used to be Shift ) --- source/blender/editors/screen/screen_ops.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1410331700f..b9b82dad6ca 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3471,21 +3471,21 @@ void ED_keymap_screen(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Frames", 0, 0); /* frame offsets */ - RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 10); - RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", -10); + RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", 10); + RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", -10); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", -1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "end", 0); - WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEUPKEY, KM_PRESS, KM_CTRL, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEDOWNKEY, KM_PRESS, KM_CTRL, 0)->ptr, "next", 0); + WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "next", 0); WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0)->ptr, "next", 0); -- cgit v1.2.3 From 2b0127a0c5a7c8eaea12af4c662d2b237a2d45e6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 22 Aug 2011 02:01:22 +0000 Subject: Rearrange anim channels - quick hotkey tweak Use PageUp/Down for moving up/down, and Shift PageUp/Down for moving to top/bottom. This is more comfortable than the old combinations involving shift+ctrl. --- source/blender/editors/animation/anim_channels_edit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index e993faa71aa..c9d6f9a6420 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2458,10 +2458,10 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf) RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0)->ptr, "all", 0); /* rearranging */ - RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_UP); - RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_DOWN); - RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_TOP); - RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_BOTTOM); + RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "direction", REARRANGE_ANIMCHAN_UP); + RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "direction", REARRANGE_ANIMCHAN_DOWN); + RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_TOP); + RNA_enum_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_move", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "direction", REARRANGE_ANIMCHAN_BOTTOM); /* Graph Editor only */ WM_keymap_add_item(keymap, "ANIM_OT_channels_visibility_set", VKEY, KM_PRESS, 0, 0); -- cgit v1.2.3 From 06ae5e48258dacc5598b23286d46891be32a08e5 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 22 Aug 2011 02:14:39 +0000 Subject: Reshuffling DopeSheet filter icons so that they appear more obviously related to each other --- source/blender/blenkernel/intern/fmodifier.c | 4 ++-- source/blender/makesrna/intern/rna_action.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 42554679795..95c0aa60991 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -629,11 +629,11 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue), cycyofs = (float)ceil((evaltime - ofs) / cycdx); cycyofs *= cycdy; } - + /* special case for cycle start/end */ if(cyct == 0.0f) { evaltime = (side == 1 ? lastkey[0] : prevkey[0]); - + if((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2)) evaltime = (side == 1 ? prevkey[0] : lastkey[0]); } diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index f24e0a92f78..815a9c92968 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -265,6 +265,7 @@ static void rna_def_dopesheet(BlenderRNA *brna) prop= RNA_def_property(srna, "show_datablock_filters", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_SHOW_DBFILTERS); RNA_def_property_ui_text(prop, "Show Datablock Filters", "Show options for whether channels related to certain types of data are included"); + RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, -1); RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN, NULL); /* General Filtering Settings */ -- cgit v1.2.3 From ee40894c05b1d5f07eda671bad74f18605cde0b6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 22 Aug 2011 11:51:23 +0000 Subject: Bugfix [#28217] Moving multiple selected action strips causes strips to scale towards zero This is an attempted bugfix for a bug which seems to be very fickle to reproduce (it only happens sporadically after quickly jerking the strips around in a certain way). So far when testing, I haven't had any more problems after applying this fix, though it may just be unreliable testing. --- source/blender/blenkernel/intern/nla.c | 35 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 0235724c69c..25f824bba19 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -851,34 +851,35 @@ void BKE_nlameta_flush_transforms (NlaStrip *mstrip) /* for each child-strip, calculate new start/end points based on this new info */ for (strip= mstrip->strips.first; strip; strip= strip->next) { if (scaleChanged) { - PointerRNA ptr; - float p1, p2, nStart, nEnd; + float p1, p2; /* compute positions of endpoints relative to old extents of strip */ p1= (strip->start - oStart) / oLen; p2= (strip->end - oStart) / oLen; - /* compute the new strip endpoints using the proportions */ - nStart= (p1 * nLen) + mstrip->start; - nEnd= (p2 * nLen) + mstrip->start; - - /* firstly, apply the new positions manually, then apply using RNA - * - first time is to make sure no truncation errors from one endpoint not being - * set yet occur - * - second time is to make sure scale is computed properly... - */ - strip->start= nStart; - strip->end= nEnd; - - RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &ptr); - RNA_float_set(&ptr, "frame_start", nStart); - RNA_float_set(&ptr, "frame_end", nEnd); + /* apply new strip endpoints using the proportions, then wait for second pass to flush scale properly */ + strip->start= (p1 * nLen) + mstrip->start; + strip->end= (p2 * nLen) + mstrip->start; } else { /* just apply the changes in offset to both ends of the strip */ strip->start += offset; strip->end += offset; } + } + + /* apply a second pass over child strips, to finish up unfinished business */ + for (strip= mstrip->strips.first; strip; strip= strip->next) { + /* only if scale changed, need to perform RNA updates */ + if (scaleChanged) { + PointerRNA ptr; + + /* use RNA updates to compute scale properly */ + RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &ptr); + + RNA_float_set(&ptr, "frame_start", strip->start); + RNA_float_set(&ptr, "frame_end", strip->end); + } /* finally, make sure the strip's children (if it is a meta-itself), get updated */ BKE_nlameta_flush_transforms(strip); -- cgit v1.2.3 From 817273931a42f807809a9d0f000564e2bd38dfb8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 22 Aug 2011 12:24:14 +0000 Subject: buildinfo is now quoted from the build systems, avoids stripping quotes on startup. tested with linux/cmake linux/scons windows/cmake/mingw windows/cmake/msvc --- source/creator/CMakeLists.txt | 3 --- source/creator/buildinfo.c | 24 ++++++++++-------------- source/creator/creator.c | 26 -------------------------- 3 files changed, 10 insertions(+), 43 deletions(-) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 43fec85b5bf..129ddca8c38 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -25,9 +25,6 @@ # # ***** END GPL LICENSE BLOCK ***** -# So BUILDINFO and BLENDERPATH strings are automatically quoted -cmake_policy(SET CMP0005 NEW) - setup_libdirs() blender_include_dirs( diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index 48a4352b11b..3853d6ca693 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -33,28 +33,24 @@ #ifdef WITH_BUILDINFO_HEADER -#include "buildinfo.h" +# include "buildinfo.h" #endif #ifdef BUILD_DATE -/* copied from BLI_utildefines.h */ -#define STRINGIFY_ARG(x) #x -#define STRINGIFY(x) STRINGIFY_ARG(x) - /* currently only these are defined in the header */ -char build_date[]= STRINGIFY(BUILD_DATE); -char build_time[]= STRINGIFY(BUILD_TIME); -char build_rev[]= STRINGIFY(BUILD_REV); +char build_date[]= BUILD_DATE; +char build_time[]= BUILD_TIME; +char build_rev[]= BUILD_REV; -char build_platform[]= STRINGIFY(BUILD_PLATFORM); -char build_type[]= STRINGIFY(BUILD_TYPE); +char build_platform[]= BUILD_PLATFORM; +char build_type[]= BUILD_TYPE; #ifdef BUILD_CFLAGS -char build_cflags[]= STRINGIFY(BUILD_CFLAGS); -char build_cxxflags[]= STRINGIFY(BUILD_CXXFLAGS); -char build_linkflags[]= STRINGIFY(BUILD_LINKFLAGS); -char build_system[]= STRINGIFY(BUILD_SYSTEM); +char build_cflags[]= BUILD_CFLAGS; +char build_cxxflags[]= BUILD_CXXFLAGS; +char build_linkflags[]= BUILD_LINKFLAGS; +char build_system[]= BUILD_SYSTEM; #else char build_cflags[]= "unmaintained buildsystem alert!"; char build_cxxflags[]= "unmaintained buildsystem alert!"; diff --git a/source/creator/creator.c b/source/creator/creator.c index 36209dbda78..6aa1773be5a 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -182,20 +182,6 @@ static void blender_esc(int sig) } #endif -/* buildinfo can have quotes */ -#ifdef BUILD_DATE -static void strip_quotes(char *str) -{ - if(str[0] == '"') { - int len= strlen(str) - 1; - memmove(str, str+1, len); - if(str[len-1] == '"') { - str[len-1]= '\0'; - } - } -} -#endif - static int print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) { printf (BLEND_VERSION_STRING_FMT); @@ -1181,18 +1167,6 @@ int main(int argc, const char **argv) // need this. BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]); - -#ifdef BUILD_DATE - strip_quotes(build_date); - strip_quotes(build_time); - strip_quotes(build_rev); - strip_quotes(build_platform); - strip_quotes(build_type); - strip_quotes(build_cflags); - strip_quotes(build_cxxflags); - strip_quotes(build_linkflags); - strip_quotes(build_system); -#endif BLI_threadapi_init(); -- cgit v1.2.3 From 7d316b70b842ff376d07f5ba55302d31d92e6dbb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 22 Aug 2011 16:54:26 +0000 Subject: rename NAN_BUILDINFO --> WITH_BUILDINFO --- source/blender/blenloader/CMakeLists.txt | 2 +- source/blender/blenloader/intern/writefile.c | 2 +- source/blender/collada/CMakeLists.txt | 2 +- source/blender/collada/DocumentExporter.cpp | 4 ++-- source/blender/windowmanager/CMakeLists.txt | 2 +- source/blender/windowmanager/intern/wm_operators.c | 8 ++++---- source/creator/CMakeLists.txt | 1 + source/creator/creator.c | 4 ++-- 8 files changed, 13 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index be15b191c8a..4088481c844 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -55,7 +55,7 @@ set(SRC ) if(WITH_BUILDINFO) - add_definitions(-DNAN_BUILDINFO) + add_definitions(-DWITH_BUILDINFO) endif() blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 7d65248c0e9..085cd2cb29c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2461,7 +2461,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar) fg.subversion= BLENDER_SUBVERSION; fg.minversion= BLENDER_MINVERSION; fg.minsubversion= BLENDER_MINSUBVERSION; -#ifdef NAN_BUILDINFO +#ifdef WITH_BUILDINFO { extern char build_rev[]; fg.revision= atoi(build_rev); diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index e2a68d19682..b5c84bc3c84 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -107,7 +107,7 @@ set(SRC ) if(WITH_BUILDINFO) - add_definitions(-DNAN_BUILDINFO) + add_definitions(-DWITH_BUILDINFO) endif() if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index e6e0953680c..b26318f6114 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -52,7 +52,7 @@ extern "C" #include "BLI_path_util.h" #include "BLI_fileops.h" #include "ED_keyframing.h" -#ifdef NAN_BUILDINFO +#ifdef WITH_BUILDINFO extern char build_rev[]; #endif } @@ -1002,7 +1002,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool else { asset.getContributor().mAuthor = "Blender User"; } -#ifdef NAN_BUILDINFO +#ifdef WITH_BUILDINFO char version_buf[128]; sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION, build_rev); asset.getContributor().mAuthoringTool = version_buf; diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index dc83e29b497..7c34c086b2e 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -130,7 +130,7 @@ if(APPLE) endif() if(WITH_BUILDINFO) - add_definitions(-DNAN_BUILDINFO) + add_definitions(-DWITH_BUILDINFO) endif() blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index fdf89cfd2be..d794685ea70 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1202,7 +1202,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE); char url[96]; -#ifdef NAN_BUILDINFO +#ifdef WITH_BUILDINFO int ver_width, rev_width; char *version_str = NULL; char *revision_str = NULL; @@ -1219,7 +1219,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.dpi); ver_width = (int)BLF_width(style->widgetlabel.uifont_id, version_str) + 5; rev_width = (int)BLF_width(style->widgetlabel.uifont_id, revision_str) + 5; -#endif //NAN_BUILDINFO +#endif //WITH_BUILDINFO block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN); @@ -1228,10 +1228,10 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiButSetFunc(but, wm_block_splash_close, block, NULL); uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL); -#ifdef NAN_BUILDINFO +#ifdef WITH_BUILDINFO uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); -#endif //NAN_BUILDINFO +#endif //WITH_BUILDINFO layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style); diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 129ddca8c38..c4a5222a719 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -133,6 +133,7 @@ if(WIN32 AND NOT UNIX) endif() if(WITH_BUILDINFO) + add_definitions(-DWITH_BUILDINFO) # -------------------------------------------------------------------------- # These defines could all be moved into the header below string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}") diff --git a/source/creator/creator.c b/source/creator/creator.c index 6aa1773be5a..9b2cfb08382 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -355,9 +355,9 @@ static int debug_mode(int UNUSED(argc), const char **UNUSED(argv), void *data) printf(BLEND_VERSION_STRING_FMT); MEM_set_memory_debug(); -#ifdef NAN_BUILDINFO +#ifdef WITH_BUILDINFO printf("Build: %s %s %s %s\n", build_date, build_time, build_platform, build_type); -#endif // NAN_BUILDINFO +#endif // WITH_BUILDINFO BLI_argsPrint(data); return 0; -- cgit v1.2.3 From a937729f38875a57f589b8ccb114b13a5b22fd3f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 22 Aug 2011 18:13:37 +0000 Subject: properly escape chars for pythons bpy objects __repr__ --- source/blender/python/intern/bpy_rna.c | 42 ++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 1b8f986e71c..72553872057 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -814,34 +814,40 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self) static PyObject *pyrna_struct_repr(BPy_StructRNA *self) { ID *id= self->ptr.id.data; + PyObject *tmp_str; + PyObject *ret; + if(id == NULL || !PYRNA_STRUCT_IS_VALID(self)) return pyrna_struct_str(self); /* fallback */ + tmp_str= PyUnicode_FromString(id->name+2); + if(RNA_struct_is_ID(self->ptr.type)) { - return PyUnicode_FromFormat("bpy.data.%s[\"%s\"]", + ret= PyUnicode_FromFormat("bpy.data.%s[%R]", BKE_idcode_to_name_plural(GS(id->name)), - id->name+2); + tmp_str); } else { - PyObject *ret; const char *path; path= RNA_path_from_ID_to_struct(&self->ptr); if(path) { - ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", + ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s", BKE_idcode_to_name_plural(GS(id->name)), - id->name+2, + tmp_str, path); MEM_freeN((void *)path); } else { /* cant find, print something sane */ - ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", + ret= PyUnicode_FromFormat("bpy.data.%s[%R]...%s", BKE_idcode_to_name_plural(GS(id->name)), - id->name+2, + tmp_str, RNA_struct_identifier(self->ptr.type)); } - - return ret; } + + Py_DECREF(tmp_str); + + return ret; } static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) @@ -911,27 +917,35 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) { - ID *id; + ID *id= self->ptr.id.data; + PyObject *tmp_str; PyObject *ret; const char *path; PYRNA_PROP_CHECK_OBJ(self) - if((id= self->ptr.id.data) == NULL) + if(id == NULL) return pyrna_prop_str(self); /* fallback */ + tmp_str= PyUnicode_FromString(id->name+2); + path= RNA_path_from_ID_to_property(&self->ptr, self->prop); if(path) { - ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path); + ret= PyUnicode_FromFormat("bpy.data.%s[%R].%s", + BKE_idcode_to_name_plural(GS(id->name)), + tmp_str, + path); MEM_freeN((void *)path); } else { /* cant find, print something sane */ - ret= PyUnicode_FromFormat("bpy.data.%s[\"%s\"]...%s", + ret= PyUnicode_FromFormat("bpy.data.%s[%R]...%s", BKE_idcode_to_name_plural(GS(id->name)), - id->name+2, + tmp_str, RNA_property_identifier(self->prop)); } + Py_DECREF(tmp_str); + return ret; } -- cgit v1.2.3 From a33a26ca07d32f4460f67775150bfacdd8f793c7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 22 Aug 2011 18:49:42 +0000 Subject: FFmpeg library update: - Update scons/cmake rules to use new versions of libs/dlls. - Update rules for buildbot. --- source/creator/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index c4a5222a719..315cd5312cf 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -545,11 +545,11 @@ elseif(WIN32) if(WITH_CODEC_FFMPEG) install( FILES - ${LIBDIR}/ffmpeg/lib/avcodec-52.dll - ${LIBDIR}/ffmpeg/lib/avformat-52.dll - ${LIBDIR}/ffmpeg/lib/avdevice-52.dll - ${LIBDIR}/ffmpeg/lib/avutil-50.dll - ${LIBDIR}/ffmpeg/lib/swscale-0.dll + ${LIBDIR}/ffmpeg/lib/avcodec-53.dll + ${LIBDIR}/ffmpeg/lib/avformat-53.dll + ${LIBDIR}/ffmpeg/lib/avdevice-53.dll + ${LIBDIR}/ffmpeg/lib/avutil-51.dll + ${LIBDIR}/ffmpeg/lib/swscale-2.dll DESTINATION ${TARGETDIR} ) -- cgit v1.2.3 From a9d9a8e569d00d98d487980f00a5626a581cd4c8 Mon Sep 17 00:00:00 2001 From: Morten Mikkelsen Date: Mon, 22 Aug 2011 18:56:13 +0000 Subject: actually, this if is still marginally good to have --- source/blender/imbuf/intern/filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 3f391b91c0f..7f1eef80318 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -397,10 +397,10 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter) float acc[4]={0,0,0,0}; k = 0; - /*if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) || + if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) || check_pixel_assigned(srcbuf, srcmask, filter_make_index(x+1, y, width, height), depth, is_float) || check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y-1, width, height), depth, is_float) || - check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float))*/ { + check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float)) { for(i= -n; i<=n; i++) { for(j=-n; j<=n; j++) { if(i != 0 || j != 0) { -- cgit v1.2.3 From a71c215f228173070d41faef1321db25b40d723e Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Mon, 22 Aug 2011 18:59:56 +0000 Subject: 3D Audio GSoC: Final GSoC commit. * Bugfix: Negative frames crashed * Bugfix: JOS sample buffer size prediction error (wasted memory) * Optimisation: for JOS upsampling (around 12 % difference measured here) * Optimisation: Better filter for JOS resampling * Bugfix: Error in relative 3D audio code. * Removed Attenuation * Bugfix: Multiple scenes in BGE lead to errors, BGE audio now all relative, to support multiple scenes. --- source/blender/makesrna/intern/rna_sequencer.c | 30 ---------------------- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 16 ++++++------ source/gameengine/Ketsji/KX_SoundActuator.cpp | 35 ++++++++++++++++++-------- 3 files changed, 33 insertions(+), 48 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 38575242fd6..d433d494068 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -52,16 +52,6 @@ #ifdef RNA_RUNTIME -static float to_dB(float x) -{ - return logf(x * x + 1e-30f) * 4.34294480f; -} - -static float from_dB(float x) -{ - return expf(x * 0.11512925f); -} - /* build a temp referene to the parent */ static void meta_tmp_ref(Sequence *seq_par, Sequence *seq) { @@ -514,20 +504,6 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) return strlen(path)+1; } -static float rna_Sequence_attenuation_get(PointerRNA *ptr) -{ - Sequence *seq= (Sequence*)(ptr->data); - - return to_dB(seq->volume); -} - -static void rna_Sequence_attenuation_set(PointerRNA *ptr, float value) -{ - Sequence *seq= (Sequence*)(ptr->data); - - seq->volume = from_dB(value); -} - static void rna_Sequence_volume_set(PointerRNA *ptr, float value) { Sequence *seq= (Sequence*)(ptr->data); @@ -1401,12 +1377,6 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, -100.0f, +40.0f); - RNA_def_property_ui_text(prop, "Attenuation/dB", "Attenuation in decibel"); - RNA_def_property_float_funcs(prop, "rna_Sequence_attenuation_get", "rna_Sequence_attenuation_set", NULL); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pitch"); RNA_def_property_range(prop, 0.1f, 10.0f); diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index a51105e0c16..dd1cc09cdc6 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1008,7 +1008,8 @@ void KX_KetsjiEngine::DoSound(KX_Scene* scene) { m_logger->StartLog(tc_sound, m_kxsystem->GetTimeInSeconds(), true); - KX_Camera* cam = scene->GetActiveCamera(); + // nothing to do here, everything relative now... + /*KX_Camera* cam = scene->GetActiveCamera(); if (!cam) return; @@ -1016,16 +1017,17 @@ void KX_KetsjiEngine::DoSound(KX_Scene* scene) if(dev) { AUD_Vector3 v; - float q[4]; - cam->NodeGetWorldPosition().getValue(v.get()); + //float q[4]; + //cam->NodeGetWorldPosition().getValue(v.get()); dev->setListenerLocation(v); - cam->GetLinearVelocity().getValue(v.get()); + //cam->GetLinearVelocity().getValue(v.get()); dev->setListenerVelocity(v); - cam->NodeGetWorldOrientation().getRotation().getValue(q); - dev->setListenerOrientation(AUD_Quaternion(q[3], q[0], q[1], q[2])); - } + //cam->NodeGetWorldOrientation().getRotation().getValue(q); + //dev->setListenerOrientation(AUD_Quaternion(q[3], q[0], q[1], q[2])); + dev->setListenerOrientation(AUD_Quaternion()); + }*/ } diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index eb75e4944a7..6c7b515c095 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -46,6 +46,8 @@ #include "KX_GameObject.h" #include "KX_PyMath.h" // needed for PyObjectFrom() +#include "KX_PythonInit.h" +#include "KX_Camera.h" #include /* ------------------------------------------------------------------------- */ @@ -112,7 +114,7 @@ void KX_SoundActuator::play() if(m_is3d && !handle3d.isNull()) { - handle3d->setRelative(false); + handle3d->setRelative(true); handle3d->setVolumeMaximum(m_3d.max_gain); handle3d->setVolumeMinimum(m_3d.min_gain); handle3d->setDistanceReference(m_3d.reference_distance); @@ -222,16 +224,27 @@ bool KX_SoundActuator::Update(double curtime, bool frame) if(m_is3d && !handle3d.isNull()) { - KX_GameObject* obj = (KX_GameObject*)this->GetParent(); - AUD_Vector3 v; - float q[4]; - - obj->NodeGetWorldPosition().getValue(v.get()); - handle3d->setSourceLocation(v); - obj->GetLinearVelocity().getValue(v.get()); - handle3d->setSourceVelocity(v); - obj->NodeGetWorldOrientation().getRotation().getValue(q); - handle3d->setSourceOrientation(AUD_Quaternion(q[3], q[0], q[1], q[2])); + KX_Camera* cam = KX_GetActiveScene()->GetActiveCamera(); + if (cam) + { + KX_GameObject* obj = (KX_GameObject*)this->GetParent(); + MT_Point3 p; + MT_Matrix3x3 Mo; + AUD_Vector3 v; + float q[4]; + + Mo = cam->NodeGetWorldOrientation().inverse(); + p = (obj->NodeGetWorldPosition() - cam->NodeGetWorldPosition()); + p = Mo * p; + p.getValue(v.get()); + handle3d->setSourceLocation(v); + p = (obj->GetLinearVelocity() - cam->GetLinearVelocity()); + p = Mo * p; + p.getValue(v.get()); + handle3d->setSourceVelocity(v); + (Mo * obj->NodeGetWorldOrientation()).getRotation().getValue(q); + handle3d->setSourceOrientation(AUD_Quaternion(q[3], q[0], q[1], q[2])); + } } result = true; } -- cgit v1.2.3 From c33e0c053ad3f842d1f07454e42e045f5f4fec1c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 22 Aug 2011 19:13:26 +0000 Subject: fix for buildinfo changes with blenderplayer --- source/blenderplayer/bad_level_call_stubs/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index f852d061cf7..0610cf2fdbe 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -49,7 +49,12 @@ if(WITH_BUILDINFO) list(APPEND SRC ../../creator/buildinfo.c ) - add_definitions(-DBUILD_DATE) + add_definitions(-DBUILD_DATE="\"\"" + -DBUILD_TIME="\"\"" + -DBUILD_REV="\"\"" + -DBUILD_PLATFORM="\"\"" + -DBUILD_TYPE="\"\"" + ) endif() if(WITH_GAMEENGINE) -- cgit v1.2.3 From 6a374d266d8213629f74a9f4c9a4984ddf59ef4c Mon Sep 17 00:00:00 2001 From: Morten Mikkelsen Date: Mon, 22 Aug 2011 19:57:54 +0000 Subject: glsl and render support for derivative maps --- source/blender/gpu/intern/gpu_material.c | 29 ++++++++++----- source/blender/gpu/intern/gpu_shader_material.glsl | 16 +++++++++ .../blender/gpu/intern/gpu_shader_material.glsl.c | 20 ++++++++++- source/blender/makesdna/DNA_texture_types.h | 1 + source/blender/makesrna/intern/rna_texture.c | 6 ++++ .../blender/render/intern/source/render_texture.c | 41 ++++++++++++++++------ 6 files changed, 93 insertions(+), 20 deletions(-) (limited to 'source') diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 274884000db..28624e9350c 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -906,6 +906,7 @@ static void do_material_tex(GPUShadeInput *shi) int init_done = 0, iBumpSpacePrev; GPUNodeLink *vNorg, *vNacc, *fPrevMagnitude; int iFirstTimeNMap=1; + int found_deriv_map = 0; GPU_link(mat, "set_value", GPU_uniform(&one), &stencil); @@ -1043,6 +1044,8 @@ static void do_material_tex(GPUShadeInput *shi) if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) { if(tex->type==TEX_IMAGE) { + found_deriv_map = tex->imaflag & TEX_DERIVATIVEMAP; + if(tex->imaflag & TEX_NORMALMAP) { /* normalmap image */ GPU_link(mat, "mtex_normal", texco, GPU_image(tex->ima, &tex->iuser), &tnor ); @@ -1082,9 +1085,10 @@ static void do_material_tex(GPUShadeInput *shi) GPU_link(mat, "mtex_blend_normal", tnorfac, shi->vn, newnor, &shi->vn); } - } else if( mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) { + } else if( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) || found_deriv_map) { /* ntap bumpmap image */ int iBumpSpace; + 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 @@ -1142,9 +1146,24 @@ static void do_material_tex(GPUShadeInput *shi) iBumpSpacePrev = iBumpSpace; } + + // resolve texture resolution + if( (mtex->texflag & MTEX_BUMP_TEXTURESPACE) || found_deriv_map ) { + ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, &tex->iuser); + ima_x= 512.0f; ima_y= 512.f; // prevent calling textureSize, glsl 1.3 only + if(ibuf) { + ima_x= ibuf->x; + ima_y= ibuf->y; + } + } - if( mtex->texflag & MTEX_3TAP_BUMP ) + if(found_deriv_map) { + GPU_link( mat, "mtex_bump_deriv", + texco, GPU_image(tex->ima, &tex->iuser), GPU_uniform(&ima_x), GPU_uniform(&ima_y), tnorfac, + &dBs, &dBt ); + } + else if( mtex->texflag & MTEX_3TAP_BUMP ) GPU_link( mat, "mtex_bump_tap3", texco, GPU_image(tex->ima, &tex->iuser), tnorfac, &dBs, &dBt ); @@ -1155,12 +1174,6 @@ static void do_material_tex(GPUShadeInput *shi) if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { - float ima_x= 512.0f, ima_y= 512.f; // prevent calling textureSize, glsl 1.3 only - ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, &tex->iuser); - if(ibuf) { - ima_x= ibuf->x; - ima_y= ibuf->y; - } GPU_link( mat, "mtex_bump_apply_texspace", fDet, dBs, dBt, vR1, vR2, diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index feb0a84fa87..0aae6d84a01 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -1226,6 +1226,22 @@ void mtex_bump_tap5( vec3 texco, sampler2D ima, float hScale, dBt = hScale * (Hu - Hd); } +void mtex_bump_deriv( vec3 texco, sampler2D ima, float ima_x, float ima_y, float hScale, + out float dBs, out float dBt ) +{ + float s = 1; // negate this if flipped texture coordinate + vec2 TexDx = dFdx(texco.xy); + vec2 TexDy = dFdy(texco.xy); + + // this variant using a derivative map is described here + // http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html + vec2 dim = vec2(ima_x, ima_y); + vec2 dBduv = hScale*dim*(2*texture2D(ima, texco.xy).xy-1); + + dBs = dBduv.x*TexDx.x + s*dBduv.y*TexDx.y; + dBt = dBduv.x*TexDy.x + s*dBduv.y*TexDy.y; +} + void mtex_bump_apply( float fDet, float dBs, float dBt, vec3 vR1, vec3 vR2, vec3 vNacc_in, out vec3 vNacc_out, out vec3 perturbed_norm ) { diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index b60f7f1555e..8b23e2b205d 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,6 +1,6 @@ /* DataToC output of file */ -int datatoc_gpu_shader_material_glsl_size= 39207; +int datatoc_gpu_shader_material_glsl_size= 39783; char datatoc_gpu_shader_material_glsl[]= { 10,102,108,111, 97,116, 32, 101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112, @@ -838,6 +838,24 @@ char datatoc_gpu_shader_material_glsl[]= { 119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, +101,120, 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108, +101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97, + 95,121, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 59, 9, 9, 47, 47, 32,110,101,103, 97, +116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116,117,114,101, 32, 99,111,111,114,100, +105,110, 97,116,101, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120, +121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, + 59, 10, 9, 10, 9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115,105,110,103, 32, 97, 32,100,101,114, +105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101,100, 32,104,101,114,101, 10, 9, 47, + 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98,108,111,103,115,112,111,116, 46, 99, +111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, 97,112,115, 46,104,116,109,108, 10, + 9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, 32,105,109, 97, 95,121, 41, 59, 10, + 9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105,109, 42, 40, 50, 42,116,101,120,116, +117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120,121, 45, 49, 41, 59, 10, 9, 10, 9,100, + 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,120, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, + 42, 84,101,120, 68,120, 46,121, 59, 10, 9,100, 66,116, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,121, 46,120, + 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,121, 46,121, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, 101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32, 118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118, diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index e81a9979c12..6e850a07d94 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -342,6 +342,7 @@ typedef struct TexMapping { #define TEX_NORMALMAP 2048 #define TEX_GAUSS_MIP 4096 #define TEX_FILTER_MIN 8192 +#define TEX_DERIVATIVEMAP 16384 /* texfilter */ // TXF_BOX -> blender's old texture filtering method diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 9e3a31ddb2e..f459563f49e 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -1147,6 +1147,12 @@ static void rna_def_texture_image(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP); RNA_def_property_ui_text(prop, "Normal Map", "Uses image RGB values for normal mapping"); RNA_def_property_update(prop, 0, "rna_Texture_update"); + + /* Derivative Map */ + prop= RNA_def_property(srna, "use_derivative_map", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_DERIVATIVEMAP); + RNA_def_property_ui_text(prop, "Derivative Map", "Uses red and green as derivative values"); + RNA_def_property_update(prop, 0, "rna_Texture_update"); } static void rna_def_texture_plugin(BlenderRNA *brna) diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index ef1b1cd159c..a4c1778c624 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1905,11 +1905,13 @@ 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; // 2 channels for 2D texture and 3 for 3D textures. const int nr_channels = (mtex->texco == TEXCO_UV)? 2 : 3; int c, rgbnor, iBumpSpace; float dHdx, dHdy; + int found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP); // disable internal bump eval in sampler, save pointer float *nvec = texres->nor; @@ -1929,8 +1931,31 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T ntap_bump->init_done = 1; } + + // resolve image dimensions + if(found_deriv_map || (mtex->texflag&MTEX_BUMP_TEXTURESPACE)!=0) { + ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser); + if (ibuf) { + dimx = ibuf->x; + dimy = ibuf->y; + } + } - if(!(mtex->texflag & MTEX_5TAP_BUMP)) { + if(found_deriv_map) { + float dBdu, dBdv; + float s = 1; // negate this if flipped texture coordinate + texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt); + rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres); + + // this variant using a derivative map is described here + // http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html + dBdu = Hscale*dimx*(2*texres->tr-1); + dBdv = Hscale*dimy*(2*texres->tg-1); + + dHdx = dBdu*dxt[0] + s * dBdv*dxt[1]; + dHdy = dBdu*dyt[0] + s * dBdv*dyt[1]; + } + else if(!(mtex->texflag & MTEX_5TAP_BUMP)) { // compute height derivatives with respect to output image pixel coordinates x and y float STll[3], STlr[3], STul[3]; float Hll, Hlr, Hul; @@ -2084,15 +2109,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { if(tex->ima) { - float vec[2]; - int dimx=512, dimy=512; - ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser); - if (ibuf) { - dimx = ibuf->x; - dimy = ibuf->y; - } - // crazy hack solution that gives results similar to normal mapping - part 2 + float vec[2]; vec[0] = dimx*dxt[0]; vec[1] = dimy*dxt[1]; @@ -2126,7 +2144,7 @@ void do_material_tex(ShadeInput *shi) float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3], warpvec[3]={0.0f, 0.0f, 0.0f}, Tnor=1.0; int tex_nr, rgbnor= 0, warpdone=0; int use_compat_bump = 0, use_ntap_bump = 0; - int found_nmapping = 0; + int found_nmapping = 0, found_deriv_map = 0; int iFirstTimeNMap=1; compatible_bump_init(&compat_bump); @@ -2146,8 +2164,9 @@ void do_material_tex(ShadeInput *shi) tex= mtex->tex; if(tex==0) continue; + found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP); use_compat_bump= (mtex->texflag & MTEX_COMPAT_BUMP); - use_ntap_bump= (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)); + use_ntap_bump= ((mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP))!=0 || found_deriv_map!=0) ? 1 : 0; /* XXX texture node trees don't work for this yet */ if(tex->nodetree && tex->use_nodes) { -- cgit v1.2.3 From 34b7bff44b498d23b3dce204ecac2ca9d0c0d57b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 07:59:25 +0000 Subject: change compression level for gzip saving to 1, approx twice as fast when saving a 194mb blend file and only slightly bigger. --- source/blender/blenlib/intern/fileops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 2e0f4b483b1..3299752646b 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -69,8 +69,10 @@ int BLI_gzip(const char *from, const char *to) { int readsize = 0; int rval= 0, err; gzFile gzfile; - - gzfile = gzopen(to, "wb"); + + /* level 1 is very close to 3 (the default) in terms of file size, + * but about twice as fast, best use for speedy saving - campbell */ + gzfile = gzopen(to, "wb1"); if(gzfile == NULL) return -1; -- cgit v1.2.3 From ed3d253c561b504d4b0dad7d4156933ba7adc200 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Tue, 23 Aug 2011 08:02:48 +0000 Subject: Fix for [#28339] Rev:39618 The revision part doesn't suffice. NAN_BUILDINFO > WITH_BUILDINFO change from rev 39618 was missing in those files. --- source/blender/collada/SConscript | 2 +- source/blender/windowmanager/SConscript | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/collada/SConscript b/source/blender/collada/SConscript index 3dd6160c445..17cca9e3706 100644 --- a/source/blender/collada/SConscript +++ b/source/blender/collada/SConscript @@ -38,6 +38,6 @@ else: incs = '../blenlib ../blenkernel ../windowmanager ../makesdna ../blenloader ../makesrna ../editors/include ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter/include [OPENCOLLADA]/COLLADABaseUtils/include [OPENCOLLADA]/COLLADAFramework/include [OPENCOLLADA]/COLLADASaxFrameworkLoader/include [OPENCOLLADA]/GeneratedSaxParser/include '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC']) if env['BF_BUILDINFO']: - defs.append('NAN_BUILDINFO') + defs.append('WITH_BUILDINFO') env.BlenderLib ('bf_collada', sources, Split(incs), defs, libtype='core', priority=200 ) diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index e548d99e9a5..80c526f8649 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -37,6 +37,6 @@ if env['OURPLATFORM'] != 'darwin' or env['WITH_GHOST_COCOA']: sources.remove('intern' + os.sep + 'wm_apple.c') if env['BF_BUILDINFO']: - defs.append('NAN_BUILDINFO') + defs.append('WITH_BUILDINFO') env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] ) -- cgit v1.2.3 From ce9e4472eb2941881836926ba46ab11203bc61c0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 09:05:12 +0000 Subject: Make Ctrl+RMB in editmode behave like 2.4x, was re-using center option which worked but used center select too. instead add 'object' option to VIEW3D_OT_select. --- source/blender/editors/space_view3d/view3d_ops.c | 10 +++++++--- source/blender/editors/space_view3d/view3d_select.c | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index e47cb1db753..8416b37fd5e 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -263,9 +263,13 @@ void view3d_keymap(wmKeyConfig *keyconf) /* selection*/ WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE); - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "center", TRUE); - RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "enumerate", TRUE); + kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); + kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "center", TRUE); + RNA_boolean_set(kmi->ptr, "object", TRUE); /* use Ctrl+Select for 2 purposes */ + kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "enumerate", TRUE); /* selection key-combinations */ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 86112a42d99..f241e640906 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1231,8 +1231,8 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce if(BASACT && BASACT->next) startbase= BASACT->next; /* This block uses the control key to make the object selected by its center point rather than its contents */ - /* XXX later on, in editmode do not activate */ - if(vc.obedit==NULL && obcenter) { + /* in editmode do not activate */ + if(obcenter) { /* note; shift+alt goes to group-flush-selecting */ if(enumerate) { @@ -1838,11 +1838,22 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) short extend= RNA_boolean_get(op->ptr, "extend"); short center= RNA_boolean_get(op->ptr, "center"); short enumerate= RNA_boolean_get(op->ptr, "enumerate"); + short object= RNA_boolean_get(op->ptr, "object"); int retval = 0; view3d_operator_needs_opengl(C); - if(obedit && center==FALSE) { + if(object) { + obedit= NULL; + obact= NULL; + + /* ack, this is incorrect but to do this correctly we would need an + * alternative editmode/objectmode keymap, this copies the functionality + * from 2.4x where Ctrl+Select in editmode does object select only */ + center= FALSE; + } + + if(obedit && object==FALSE) { if(obedit->type==OB_MESH) retval = mouse_mesh(C, event->mval, extend); else if(obedit->type==OB_ARMATURE) @@ -1891,6 +1902,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first."); RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting, in editmode used to extend object selection."); RNA_def_boolean(ot->srna, "enumerate", 0, "Enumerate", "List objects under the mouse (object mode only)."); + RNA_def_boolean(ot->srna, "object", 0, "Object", "Use object selection (editmode only)."); } -- cgit v1.2.3 From ff8daca1f117b34c92462f4ab3bbe2aa50f95166 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 23 Aug 2011 11:44:24 +0000 Subject: Bugfix: Removing a sound from a speaker resulted in a crash. --- source/blender/blenkernel/intern/sound.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index d7385a86105..a364f860255 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -676,11 +676,17 @@ void sound_update_scene(struct Main* bmain, struct Scene* scene) if(AUD_removeSet(scene->speaker_handles, strip->speaker_handle)) { - AUD_moveSequence(strip->speaker_handle, strip->start / FPS, -1, 0); + if(speaker->sound) + AUD_moveSequence(strip->speaker_handle, strip->start / FPS, -1, 0); + else + { + AUD_removeSequence(scene->sound_scene, strip->speaker_handle); + strip->speaker_handle = NULL; + } } else { - if(speaker && speaker->sound) + if(speaker->sound) { strip->speaker_handle = AUD_addSequence(scene->sound_scene, speaker->sound->playback_handle, strip->start / FPS, -1, 0); AUD_setRelativeSequence(strip->speaker_handle, 0); -- cgit v1.2.3 From ba4fd78faca5843e1c44501a0697ce1d4c154854 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 11:46:16 +0000 Subject: fix [#28344] for this file, the multires smiley has 2 materials, but only 1 loads --- source/blender/blenkernel/intern/multires.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 88a670ecb22..e621e800520 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1537,6 +1537,7 @@ void multires_load_old(Object *ob, Mesh *me) me->mface[i].v2 = lvl->faces[i].v[1]; me->mface[i].v3 = lvl->faces[i].v[2]; me->mface[i].v4 = lvl->faces[i].v[3]; + me->mface[i].mat_nr = lvl->faces[i].mat_nr; } /* Add a multires modifier to the object */ -- cgit v1.2.3 From 6fd68b8d76c79b9656aeda4e0ecf7502fc246db2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 12:09:20 +0000 Subject: fix [#28336] Particles: setting to zero the count of all elements of a group crashes Blender --- source/blender/blenkernel/intern/anim.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index ebe7325d96a..fcb8da48962 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1351,6 +1351,10 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p continue; if(part->ren_as==PART_DRAW_GR) { + /* prevent divide by zero below [#28336] */ + if(totgroup == 0) + continue; + /* for groups, pick the object based on settings */ if(part->draw&PART_DRAW_RAND_GR) b= BLI_rand() % totgroup; -- cgit v1.2.3 From abff0032c4dceabbd2cf5b9682f196dd4a283c76 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 23 Aug 2011 13:15:18 +0000 Subject: Fix #28343: glsl error after derivative maps commit. --- source/blender/gpu/intern/gpu_shader_material.glsl | 4 +- .../blender/gpu/intern/gpu_shader_material.glsl.c | 1662 ++++++++++---------- 2 files changed, 833 insertions(+), 833 deletions(-) (limited to 'source') diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index 0aae6d84a01..815b74a1bf4 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -1229,14 +1229,14 @@ void mtex_bump_tap5( vec3 texco, sampler2D ima, float hScale, void mtex_bump_deriv( vec3 texco, sampler2D ima, float ima_x, float ima_y, float hScale, out float dBs, out float dBt ) { - float s = 1; // negate this if flipped texture coordinate + float s = 1.0; // negate this if flipped texture coordinate vec2 TexDx = dFdx(texco.xy); vec2 TexDy = dFdy(texco.xy); // this variant using a derivative map is described here // http://mmikkelsen3d.blogspot.com/2011/07/derivative-maps.html vec2 dim = vec2(ima_x, ima_y); - vec2 dBduv = hScale*dim*(2*texture2D(ima, texco.xy).xy-1); + vec2 dBduv = hScale*dim*(2.0*texture2D(ima, texco.xy).xy-1.0); dBs = dBduv.x*TexDx.x + s*dBduv.y*TexDx.y; dBt = dBduv.x*TexDy.x + s*dBduv.y*TexDy.y; diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index 8b23e2b205d..87a8ed65532 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,858 +1,858 @@ /* DataToC output of file */ -int datatoc_gpu_shader_material_glsl_size= 39783; +int datatoc_gpu_shader_material_glsl_size= 39789; char datatoc_gpu_shader_material_glsl[]= { - 10,102,108,111, 97,116, 32, -101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112, -111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, - 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99, -111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, - 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40, -114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99, -109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, - 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, - 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99, -100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, - 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, - 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, - 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100, -101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, - 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97, -120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115, -101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, - 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, - 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, - 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, - 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, - 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, - 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104, -115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, - 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, - 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, - 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114, -103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, - 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32, -118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, - 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101, -108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32, -118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, - 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, - 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115, -101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, - 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, - 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, - 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97, -116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, - 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, - 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, - 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110, -101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, - 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, - 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32, - 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, - 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, - 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111, -108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102, -114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, - 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115, -114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99, -111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105, -110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111, -117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105, -110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111, -108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102, -114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, - 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99, -111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, - 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, - 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118, -111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, - 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97, -116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, - 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, - 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118, -101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111, -109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110, -118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32, -118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111, -117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118, -105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, - 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46, -120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98, -117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97, -108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114, -109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116, -101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, - 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97, -116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, - 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32, -118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, - 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105, -110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, - 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, - 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101, -119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, - 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105, -101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, - 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, - 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108, -111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, - 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, - 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105, -100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32, -118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, - 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115, -101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105, -100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, - 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117, -116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40, -118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, - 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, -108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40, -102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, - 9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, - 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, - 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117, -116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, - 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32, -118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, - 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102, + 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108, +101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, + 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104, +115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, + 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108, +116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, + 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32, +109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, + 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97, +120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, + 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, + 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, + 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, + 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, + 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, + 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, + 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, + 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, + 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9, +111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, + 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32, +118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, + 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104, +115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, + 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32, +118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, + 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32, +102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118, +101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, + 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, + 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, + 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, + 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, + 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, + 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32, +114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40, +105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, + 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9, +111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108, +111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, + 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, + 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115, +101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, + 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, + 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, + 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, + 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, + 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111, +105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114, +111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, + 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, + 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, + 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, + 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, + 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, + 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, + 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, + 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, + 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, + 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, + 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111, +109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, + 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, + 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99, +111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118, +101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, + 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99, +111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116, +114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10, +123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, + 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, + 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32, +118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97, +116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, + 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114, +109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114, +111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101,119, 32, 61, 32, +110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101, +119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9, +111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116, +116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110, +111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, + 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,118, + 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, + 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, + 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108,111, 97, +116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111, +117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118, +101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41, + 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118,101, 99, 41, 59, + 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109,105, +110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, 97,109,101,114, + 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, 32,111,117,116, + 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,105, +115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, 10, 9,111,117, +116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105,101,119, 32, 61, 32,110, +111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,100,100, 40,102, 108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111, -117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, - 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40, -102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97, -116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, - 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, - 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, - 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32, -102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, - 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97, -108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, - 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, -114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, -108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10, -125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, - 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, - 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105, -100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32, -102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, - 9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, - 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115, -113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102, -108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, - 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, - 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, + 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32,118, 97,108, 50, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97,116, 32,118, 97, +108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, + 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111, +105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, + 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117, +116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, + 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 50, 32, 61, 61, + 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117, +116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, + 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97, +116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97,108, 41, 59, 10, +125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,116, 97, +110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108,111, 97,116, 32, +118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97, +108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97, +108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, + 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, 32,118, 97,108, + 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, + 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, + 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 97,116, 97, +110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, 97,116, 32,118, + 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, + 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97, +108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108,111, 97,116, 32, +118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, + 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, 50, 32, 62, 32, + 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32,108,111,103, 50, + 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, 10,125, 10, 10, +118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32, +118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, +108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116, +104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117, +116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109,105,110, 40, +118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111,117,110,100, 40, +102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, +111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, 10,118,111,105, +100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, + 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, + 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101, +108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, + 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32, +118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97, +108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, + 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117,101,101,122,101, + 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, 97,116, 32, 99, +101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, + 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, 44, 32, + 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32, +111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, + 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, + 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105, +100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, + 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, + 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, + 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111, +105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111, -117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117, -116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10, -125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, - 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97, -116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9, -111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111, -117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, - 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, - 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32, -118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111, -117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, - 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, - 9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, -101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32, -111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, -108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118, -101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, - 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110, -111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101, -103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111, -117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105, -114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117, -116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, - 10, 9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111, -105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, - 99, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, - 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,120, 59, 10, - 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, - 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, - 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, 43, 32, 49, - 46, 48, 41, 42, 48, 46, 53, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9, -111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, - 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, - 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118, -101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, - 46,114, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, - 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117,116, 99,111, -108, 46,103, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114, -101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111,117,116, 99, -111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117, -114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 10, 9,105,102, - 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111,108, - 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99,111, -108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40,102, -108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118,101, 99, - 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111, -108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, 52, 32, 99, -111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, - 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40,111,117,116, - 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, -125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, - 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101, -116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, - 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, - 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, - 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, - 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, - 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 97,100,100, 40,102,108,111, 97,116, - 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32, -118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, - 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, - 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99, -111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116, 40,102,108,111, 97,116, 32,102, 97, - 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, - 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, - 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, - 49, 32, 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, - 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,102, 97, 99, - 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, - 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, - 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, - 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 52, 40,102, 97, - 99,109, 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 50, 41, 41, 42, 40,118, -101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111, -108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108, 97,121, 40,102,108,111, 97,116, 32, -102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118, -101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, - 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, - 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, - 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, - 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, - 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99, -111,108, 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111, -117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 42, 61, 32,102, 97, 99, -109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99, -111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, - 48, 32, 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, - 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 42, - 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,101,108,115,101, 10, 9, - 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, - 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, - 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118, +117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111,117,116,118,101, 99, 32, + 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, + 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, + 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, 9,111,117,116,118, 97, +108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116, +104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, + 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, +111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111,117,116,118, 97,108, 32, + 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97, +116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, +116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, +108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105, +122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97,116,101, 40,118, +101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111,117,116,118, 32, 61, 32, + 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, 32,118,101, 99, + 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32,102,108,111, 97, +116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, 10, 9,111,117,116,100, +111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99,117,114, +118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109, +112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, + 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, + 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,120, 59, 10, 9,111,117,116,118,101, + 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,121, + 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,120,116, +117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, + 53, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, + 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, + 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, + 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32, +111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116, +101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114, +118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, +116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117, +114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111,117,116, 99,111,108, 46, 98, 32, 61, + 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, 49, 68, 40, 99, +117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, + 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111,108, 42,102, 97, 99, 41, 32, + 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, + 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, + 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, + 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118,101, 99, 51, 32, 99,111,108, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111, +108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117, +116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10, +125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40,111,117,116, 32,102,108,111, 97,116, + 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105, +100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, + 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114, +103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, + 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, + 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, + 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,108,101,110,100, 40, +102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, + 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, + 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99, +111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, + 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 97,100,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32, +118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111, +117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, + 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 43, + 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, + 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, + 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99, +111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, + 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 42, 32, 99,111, +108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, + 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, + 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111, +108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, + 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, + 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 52, 40,102, 97, 99,109, 41, 32, 43, 32, +102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 50, 41, 41, 42, 40,118,101, 99, 52, 40, 49, 46, + 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, +125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108, 97,121, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118, 101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117, 116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, - 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 45, 32, - 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, -125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, - 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, - 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, - 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99, -111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,111, -117,116, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99, 42,111,117, -116, 99,111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 33, 61, 32, 48, 46, 48, - 41, 32,111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99, - 42,111,117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 33, 61, 32, - 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32, -102, 97, 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, - 95,100,105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, + 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9, +111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, + 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, + 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, + 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,114, 41, + 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, +103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, + 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, + 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111, +108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117, +116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 42, 61, 32,102, 97, 99,109, + 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111, +108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, + 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, + 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111, +108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10, +123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9, +111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 44, 32, +102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105, +100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32, +118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, + 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97, +116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99, +111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, +114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,114, + 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99, +111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111, +108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,111, +117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99, 42,111,117, +116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,102,102, 40, +102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, + 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, + 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99, +111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 41, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117, +116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100, 97,114, +107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, + 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97, +109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, + 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10, 9,111, +117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105, +103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99, +111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99, +108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 46,114,103, 98, + 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10, + 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, +100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, - 32,109,105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 41, 44, 32,102, 97, 99, - 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109, -105,120, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, - 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, - 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, - 46,114,103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, - 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32, -109,105,120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32, -118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, - 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99, -111,108, 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42, -102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105, -100, 32,109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, + 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, + 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9, + 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, + 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,114, 47,116,109,112, + 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108, +115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, + 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, + 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, + 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116, +109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, + 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, + 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, + 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, + 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, + 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 47,116, +109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9, +101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10, 10,118,111, +105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, - 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117, -116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, - 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, - 50, 46,114, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, -114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, - 46,114, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, - 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9, -105,102, 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109, -112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, - 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, - 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, - 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, - 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 33, 61, 32, - 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99, -111,108, 50, 46, 98, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111, -108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99, -111,108, 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, - 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10, 9,125, - 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, - 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99, -111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, - 41, 59, 10, 9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, - 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, - 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111, -117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, - 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, - 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116, -109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115, -101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, - 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, - 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, - 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 47,116,109,112, 41, 41, 32, 60, - 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, - 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9,101, -108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, - 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, - 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, - 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 47,116,109,112, 41, 41, - 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32, -105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, - 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10,125, 10, 10,118,111,105,100, 32, -109,105,120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, - 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, - 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32, -102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, - 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116, -111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, - 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115, -118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114, -103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111, -117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99, -111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 97,116, 40,102,108,111, 97,116, 32, -102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118, -101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, - 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, - 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, - 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, - 10, 10, 9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104, -115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,102, 97, 99,109, 42, -104,115,118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, - 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,118, 97, -108, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, + 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108, +111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, + 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99, +111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, +114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, + 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9, +111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, + 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117, +116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, + 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111, +108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, + 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, + 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, + 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9, +111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, + 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, + 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, + 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, + 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, + 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, + 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,104,117, +101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97, 109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, - 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10, 9,114, -103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115, -118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32, 61, 32,102, 97, 99,109, 42,104,115, -118, 46,122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115, -118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 99,111,108,111,114, 40,102,108, -111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111, -117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, - 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, - 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32, -104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, - 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, - 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, 46, -120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,115,118, 50, 46,121, 59, 10, 9, 9, -104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, - 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99, -111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,111, -102,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111, -108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, - 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, - 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101, 61, 32,118,101, 99, 52, 40, 49, 46, - 48, 41, 59, 10, 9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,110,101, 32, 45, 32, 99,111,108, 50, - 41, 42, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,102, 97, 99,109, 42, 99, -111,108, 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 42, 99,111,108, 50, 42, 99,111,108, - 49, 32, 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,110,101, 97, -114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, - 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97, -109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111, -108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, -114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 32, 45, 32, 48, - 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, - 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, - 99,111,108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, - 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108, -115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, - 42, 40, 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 62, 32, - 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, - 46, 48, 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99, -111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 41, - 32, 45, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,103, 98, 40,102,108,111, 97,116, 32, -102, 97, 99, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,111,108,111,114,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, - 52, 32,111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, 97,108,112,104, 97, 41, 10,123, 10, - 9,111,117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,111,108,111,114,109, 97,112, 44, 32,102, 97, - 99, 41, 59, 10, 9,111,117,116, 97,108,112,104, 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105, -100, 32,114,103, 98,116,111, 98,119, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 32, 32, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, - 51, 53, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, - 32, 47, 42, 32,107,101,101,112, 32,116,104,101,115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, 99, 32,119, -105,116,104, 32,116,101,120,116,117,114,101, 46,104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, - 32,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, - 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, 32,109,105, -120, 40, 99,111,108, 46,120,121,122, 44, 32,118,101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, - 32, 99,111,108, 46,120,121,122, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46, -119, 59, 10,125, 10, 10,118,111,105,100, 32,104,117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, 32,102,108, -111, 97,116, 32,115, 97,116, 44, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, - 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,118, -101, 99, 52, 32,104,115,118, 59, 10, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, - 10, 10, 9,104,115,118, 91, 48, 93, 32, 43, 61, 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,105,102, 40,104,115, -118, 91, 48, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104, -115,118, 91, 48, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10, 9,104,115,118, 91, 49, 93, - 32, 42, 61, 32,115, 97,116, 59, 10, 9,105,102, 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, - 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, - 61, 32, 48, 46, 48, 59, 10, 9,104,115,118, 91, 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10, 9,105,102, 40,104,115,118, - 91, 50, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115, -118, 91, 50, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10, 9,104,115,118, 95,116,111, 95, -114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, - 40, 99,111,108, 44, 32,111,117,116, 99,111,108, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,112, 97, -114, 97,116,101, 95,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10, 9,114, 32, 61, - 32, 99,111,108, 46,114, 59, 10, 9,103, 32, 61, 32, 99,111,108, 46,103, 59, 10, 9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10, -125, 10, 10,118,111,105,100, 32, 99,111,109, 98,105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32,102,108,111, - 97,116, 32,103, 44, 32,102,108,111, 97,116, 32, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10,123, 10, 9, - 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114, 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105, -100, 32,111,117,116,112,117,116, 95,110,111,100,101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, 32, 97,108, -112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, - 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 32, 84, 69, 88, 84, 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 47, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32, -118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, - 61, 32,118,101, 99, 46,121,120,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, - 95,108,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, - 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, 32,118,101, - 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, - 32,109, 97,120, 40, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10, 9,111,117,116, -118, 97,108, 32, 42, 61, 32,111,117,116,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,119, -111,111,100, 95,115,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117, -101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, - 97,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118,101, 99, 46, -120, 32, 43, 32,118,101, 99, 46,121, 42,118,101, 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, - 48, 46, 48, 59, 10, 9,102,108,111, 97,116, 32,119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, - 41, 59, 10, 10, 9,118, 97,108,117,101, 32, 61, 32,119,105, 59, 10, 9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40,119, -105, 44, 32,119,105, 44, 32,119,105, 44, 32, 49, 46, 48, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, - 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, -105,109, 97,103,101, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32, -111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116, -117,114,101, 50, 68, 40,105,109, 97, 44, 32, 40,118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, - 46, 48, 41, 41, 42, 48, 46, 53, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10, 9,110,111,114,109, 97, -108, 46,120, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,110,111,114,109, - 97,108, 46,121, 32, 61, 32, 50, 46, 48, 42, 40, 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10, 9,110,111,114, -109, 97,108, 46,122, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, - 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, 97,116,116, -111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 41, 10,123, 10, 9,111,114, 99,111, 32, 61, 32, 97, -116,116,111,114, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, 32, 97,116, -116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9, 47, 42, 32,100,105,115, 97, 98,108,101,100, - 32,102,111,114, 32,110,111,119, 44, 32,119,111,114,107,115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, 32,108,101, - 97,118,105,110,103, 32,111,117,116, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 10, 9, 32, 32, 32,117,118, - 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, - 48, 41, 44, 32, 48, 46, 48, 41, 59, 32, 42, 47, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, - 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114, -109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 99, -111,114,114,101,115,112,111,110,100,115, 32,116,111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, 32,105,115, - 32,110,101,103, 97,116,101,100, 32,115,111, 32, 99, 97,110, 99,101,108,115, 10, 9, 32, 32, 32,111,117,116, 32, 98,108,101,110, -100,101,114, 32,110,111,114,109, 97,108, 32,110,101,103, 97,116,105,111,110, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97, -108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116, -101,120, 99,111, 95,116, 97,110,103,101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,111,117,116, 32,118, -101, 99, 51, 32,111,117,116,116, 97,110,103,101,110,116, 41, 10,123, 10, 9,111,117,116,116, 97,110,103,101,110,116, 32, 61, 32, -110,111,114,109, 97,108,105,122,101, 40,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -116,101,120, 99,111, 95,103,108,111, 98, 97,108, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, - 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10, 9,103,108,111, 98, 97, -108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120, -121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105, -101,119,105,110,118,109, 97,116, 44, 32,109, 97,116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, - 44, 32,111,117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 41, 10,123, 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 40, -111, 98,105,110,118,109, 97,116, 42, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, - 48, 41, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, - 51, 32,118,110, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, - 10, 9,114,101,102, 32, 61, 32,118,105,101,119, 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, - 42,118,110, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114, -109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 98, -108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, - 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97, -108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32, -111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, - 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9, -102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99, -109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, - 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, -114,103, 98, 95,109,117,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, - 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, - 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99, -111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111, -117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32, -102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102, -108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, - 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, - 32, 45, 32, 40,118,101, 99, 51, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, - 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32, -111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, - 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9, -102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99, -109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, - 53, 41, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, - 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111, -108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, - 48, 32, 45, 32,116,101,120, 99,111,108, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, - 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,103, 32, - 61, 32,111,117,116, 99,111,108, 46,103, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99, -111,108, 46,103, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, -102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, - 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, - 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, - 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10, 9,101,108,115,101, 10, - 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, - 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99, -111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, - 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, - 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, - 9,105,110, 99,111,108, 32, 61, 32, 45,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, - 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111, -117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32, -102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105, -110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99, -111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, - 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97, -116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, - 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32, -105,110, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111, -117,116, 99,111,108, 46,114, 47,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, - 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, - 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40,116,101,120, - 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, - 99,111,108, 46, 98, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10, -125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111, + 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118, +101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, + 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, + 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9, +104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, + 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, + 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, + 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 97,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118, +101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117, +116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, + 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9, +111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, + 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, 9,105,102, 40, +104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, + 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46,121, 32, + 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32, +111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,118, 97,108, 40,102,108,111, 97, +116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, + 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, + 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, + 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95, +104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, + 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46,122, 32, 43, 32, +102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, + 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 99,111,108,111,114, 40,102,108,111, 97,116, 32,102, 97, + 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, + 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, + 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, + 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104, +115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, + 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116, +111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115, +118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, + 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, + 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, + 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,111,102,116, 40,102,108,111, + 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117, +116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, + 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, + 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10, 9,118, +101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,110,101, 32, 45, 32, 99,111,108, 50, 41, 42, 40,111,110,101, + 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,102, 97, 99,109, 42, 99,111,108, 49, 32, 43, 32, +102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 42, 99,111,108, 50, 42, 99,111,108, 49, 32, 43, 32, 99,111, +108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,110,101, 97,114, 40,102,108,111, 97, +116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, + 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, + 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9, +105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, + 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, + 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, + 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,103, + 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, + 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111, +117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, + 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 62, 32, 48, 46, 53, 41, 10, 9, + 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111, +108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, + 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 41, 32, 45, 32, 49, 46, 48, + 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,115, + 97,109,112,108,101,114, 49, 68, 32, 99,111,108,111,114,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99, +111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, 97,108,112,104, 97, 41, 10,123, 10, 9,111,117,116, 99,111, +108, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,111,108,111,114,109, 97,112, 44, 32,102, 97, 99, 41, 59, 10, 9,111, +117,116, 97,108,112,104, 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98,116, +111, 98,119, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, + 41, 32, 32, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 53, 32, 43, 32, 99, +111,108,111,114, 46,103, 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, 32, 47, 42, 32,107,101, +101,112, 32,116,104,101,115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, 99, 32,119,105,116,104, 32,116,101, +120,116,117,114,101, 46,104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, 32,105,110,118,101,114, +116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32, +111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, 32,109,105,120, 40, 99,111,108, 46, +120,121,122, 44, 32,118,101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 46,120, +121,122, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46,119, 59, 10,125, 10, 10, +118,111,105,100, 32,104,117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, 32,102,108,111, 97,116, 32,115, 97, +116, 44, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, + 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32,104,115, +118, 59, 10, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, 9,104,115,118, + 91, 48, 93, 32, 43, 61, 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,105,102, 40,104,115,118, 91, 48, 93, 62, 49, + 46, 48, 41, 32,104,115,118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 48, 93, 60, + 48, 46, 48, 41, 32,104,115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10, 9,104,115,118, 91, 49, 93, 32, 42, 61, 32,115, 97, +116, 59, 10, 9,105,102, 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 49, 46, 48, 59, 32, +101,108,115,101, 32,105,102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 48, 46, 48, 59, + 10, 9,104,115,118, 91, 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10, 9,105,102, 40,104,115,118, 91, 50, 93, 62, 49, 46, + 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 50, 93, 60, 48, + 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115, +118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 44, 32, +111,117,116, 99,111,108, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,112, 97,114, 97,116,101, 95,114, +103, 98, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10, 9,114, 32, 61, 32, 99,111,108, 46,114, + 59, 10, 9,103, 32, 61, 32, 99,111,108, 46,103, 59, 10, 9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105, +100, 32, 99,111,109, 98,105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32,102,108,111, 97,116, 32,103, 44, 32, +102,108,111, 97,116, 32, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10,123, 10, 9, 99,111,108, 32, 61, 32, +118,101, 99, 52, 40,114, 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,111,117,116,112, +117,116, 95,110,111,100,101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111, +117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, + 40,114,103, 98, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 32, 84, 69, 88, 84, 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105, +100, 32,116,101,120,116,117,114,101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111, +117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 46, +121,120,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,108,105,110, 40,118, +101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117, +116,118, 97,108, 32, 61, 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32, +116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, + 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40, 40, + 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 42, 61, + 32,111,117,116,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,119,111,111,100, 95,115,105, +110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, + 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, + 9,102,108,111, 97,116, 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118,101, 99, 46,120, 32, 43, 32,118,101, + 99, 46,121, 42,118,101, 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, 48, 46, 48, 59, 10, 9, +102,108,111, 97,116, 32,119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, 41, 59, 10, 10, 9,118, + 97,108,117,101, 32, 61, 32,119,105, 59, 10, 9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40,119,105, 44, 32,119,105, 44, + 32,119,105, 44, 32, 49, 46, 48, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, + 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,105,109, 97,103,101, 40, +118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, + 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, +105,109, 97, 44, 32, 40,118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 41, 42, 48, + 46, 53, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10, 9,110,111,114,109, 97,108, 46,120, 32, 61, 32, + 50, 46, 48, 42, 40, 99,111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,110,111,114,109, 97,108, 46,121, 32, 61, + 32, 50, 46, 48, 42, 40, 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10, 9,110,111,114,109, 97,108, 46,122, 32, + 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, + 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32, +111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 41, 10,123, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, + 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111, +117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9, 47, 42, 32,100,105,115, 97, 98,108,101,100, 32,102,111,114, 32,110, +111,119, 44, 32,119,111,114,107,115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, 32,108,101, 97,118,105,110,103, 32, +111,117,116, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 10, 9, 32, 32, 32,117,118, 32, 61, 32,118,101, 99, + 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, + 48, 41, 59, 32, 42, 47, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, 46, 48, 41, 59, 10,125, + 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111, +117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 99,111,114,114,101,115,112, +111,110,100,115, 32,116,111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, 32,105,115, 32,110,101,103, 97,116, +101,100, 32,115,111, 32, 99, 97,110, 99,101,108,115, 10, 9, 32, 32, 32,111,117,116, 32, 98,108,101,110,100,101,114, 32,110,111, +114,109, 97,108, 32,110,101,103, 97,116,105,111,110, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111, +114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,116, + 97,110,103,101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, +116,116, 97,110,103,101,110,116, 41, 10,123, 10, 9,111,117,116,116, 97,110,103,101,110,116, 32, 61, 32,110,111,114,109, 97,108, +105,122,101, 40,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95, +103,108,111, 98, 97,108, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118, +105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, + 10,118,111,105,100, 32,116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, + 97,116, 44, 32,109, 97,116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,111, 98,106,101, 99,116, 41, 10,123, 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, + 97,116, 42, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120, +121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32, +118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10, 9,114,101,102, 32, + 61, 32,118,105,101,119, 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, + 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111, +117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 98,108,101,110,100,101,114, + 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,111,117, +116,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, + 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, + 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, + 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, +102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, + 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32, +102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,109,117, +108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, +116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99, +111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99, +103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32, 40, +102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, + 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, +102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, + 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, + 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, + 99, 51, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, + 99,111,108, 41, 41, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, + 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, + 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, +102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, + 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105, +110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, + 99,116, 42,116,101,120, 99,111,108, 46,114, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32, + 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101, +120, 99,111,108, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40, +111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99, +111,108, 46,103, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, + 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, + 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, + 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, + 53, 41, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, + 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111, +108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, + 48, 32, 45, 32,116,101,120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111, 108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, - 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, - 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, - 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118, +116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, + 32, 61, 32, 45,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, + 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, + 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, +102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, + 32,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, + 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99, +103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, + 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, + 99,116, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, +114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, +114, 47,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, + 32,105,110, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42, +111,117,116, 99,111,108, 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, + 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, + 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105, +100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, + 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, + 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, + 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99, +116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, + 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, +101,120, 95,114,103, 98, 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101, +120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, + 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, + 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99, +111,108, 32, 60, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108, +115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, + 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, + 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111, +117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9, +105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, + 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111, +105,100, 32,109,116,101,120, 95,114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118, 101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99, 109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, - 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99, + 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99, 111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111, -108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, +108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111, -108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, +108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, - 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, - 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108, -111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, - 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, - 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, - 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, - 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46, -114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, - 32, 62, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, - 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, - 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105, -110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, - 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, - 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, - 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, - 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32, -118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, - 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99, -111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, - 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, - 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40, -111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, - 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10, -118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118, -101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, - 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, - 10, 10, 9,109,105,120, 95,118, 97,108, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111, -108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, - 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32, -109,116,101,120, 95,114,103, 98, 95, 99,111,108,111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, - 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, - 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9, -109,105,120, 95, 99,111,108,111,114, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111, +108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97, +116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, + 99,111,108, 59, 10, 10, 9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111, +117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, + 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, + 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99, +103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, + 10, 9,109,105,120, 95,115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, - 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10, 9, -102, 97, 99,116, 32, 42, 61, 32, 97, 98,115, 40,102, 97, 99,103, 41, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, - 97, 99,116, 59, 10, 10, 9,105,102, 40,102, 97, 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32, -116,109,112, 32, 61, 32,102, 97, 99,116, 59, 10, 9, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10, 9, 9,102, 97, 99, -109, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98, -108,101,110,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, - 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, - 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, - 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105, -110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111, -117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, - 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, - 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, - 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32, -102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99, -111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, - 99,114,101,101,110, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, - 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95, -118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9, -102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, - 45, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, - 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117, -101, 95,115,117, 98, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, - 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95, -118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9, -102, 97, 99,116, 32, 61, 32, 45,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99, -111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, - 97,100,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32, -102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97, -116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97, -108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, - 99,116, 32, 61, 32,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, - 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, - 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, - 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105, -110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, - 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,102, 40,116,101, -120, 99,111,108, 32, 33, 61, 32, 48, 46, 48, 41, 10, 9, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99, -111,108, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, - 9,105,110, 99,111,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, - 95,100,105,102,102, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, - 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95, -118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9, -105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116, -101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97, -108,117,101, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, - 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116, -101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, - 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, - 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32, -105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108, -117,101, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, - 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116, -101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, - 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, - 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32, -105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108, -117,101, 95, 99,108, 97,109,112, 95,112,111,115,105,116,105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, - 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97, -109,112, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10, -123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32, -104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,111,117,116,104, 97,114, - 32, 61, 32,104, 97,114, 47, 49, 50, 56, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109, -117,108,116,105,112,108,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, - 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10, 9,105,102, - 40,104, 97,114, 32, 60, 32, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32, -105,102, 40,104, 97,114, 32, 62, 32, 53, 49, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10, - 9,101,108,115,101, 32,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, - 95, 97,108,112,104, 97, 95,102,114,111,109, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32, 97,108,112,104, 97, 41, 10,123, 10, 9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10, -118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, - 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, - 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, - 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,105,110,116,101,110,115,105, -116,121, 32, 61, 32,100,111,116, 40,118,101, 99, 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32, -114,103, 98, 46,114,103, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118, -101,114,116, 40,102,108,111, 97,116, 32,105,110,118, 97,108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108,117,101, 41, 10,123, 10, 9,111,117,116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108, -117,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, - 32,105,110,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114, -103, 98, 32, 61, 32,118,101, 99, 52, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, - 32,105,110,114,103, 98, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116, -101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110, -115,105,116,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,111,117,116,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99, -116, 32, 61, 32,105,110,116,101,110,115,105,116,121, 59, 10, 9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105, -110,116,101,110,115,105,116,121, 42,115,116,101,110, 99,105,108, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32, -115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, -116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111, -117,116,114,103, 98, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10, 9,111, -117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, - 99,105,108, 41, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32, -116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, - 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, - 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101, -120, 99,111, 44, 32,118,101, 99, 51, 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99, -111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10, -118,111,105,100, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111, -117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, - 40,118,101, 99, 46,120,121, 42, 48, 46, 53, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, - 99, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101, -120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97, -108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32, -116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118, 97,108,117,101, - 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, - 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 47, 32, 84,104,101, 32,105,110,118,101,114,116, 32,111,102, 32,116,104,101, 32, -114,101,100, 32, 99,104, 97,110,110,101,108, 32,105,115, 32,116,111, 32,109, 97,107,101, 10, 9, 47, 47, 32,116,104,101, 32,110, -111,114,109, 97,108, 32,109, 97,112, 32, 99,111,109,112,108,105, 97,110,116, 32,119,105,116,104, 32,116,104,101, 32,111,117,116, -115,105,100,101, 32,119,111,114,108,100, 46, 10, 9, 47, 47, 32, 73,116, 32,110,101,101,100,115, 32,116,111, 32, 98,101, 32,100, -111,110,101, 32, 98,101, 99, 97,117,115,101, 32,105,110, 32, 66,108,101,110,100,101,114, 10, 9, 47, 47, 32,116,104,101, 32,110, -111,114,109, 97,108, 32,117,115,101,100, 32,112,111,105,110,116,115, 32,105,110,119, 97,114,100, 46, 10, 9, 47, 47, 32, 83,104, -111,117,108,100, 32,116,104,105,115, 32,101,118,101,114, 32, 99,104, 97,110,103,101, 32,116,104,105,115, 32,110,101,103, 97,116, -101, 32,109,117,115,116, 32, 98,101, 32,114,101,109,111,118,101,100, 46, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111, -114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,110, -111,114,109, 97,108, 32, 61, 32, 50, 46, 48, 42, 40,118,101, 99, 51, 40, 45, 99,111,108,111,114, 46,114, 44, 32, 99,111,108,111, -114, 46,103, 44, 32, 99,111,108,111,114, 46, 98, 41, 32, 45, 32,118,101, 99, 51, 40, 45, 48, 46, 53, 44, 32, 48, 46, 53, 44, 32, - 48, 46, 53, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,110,111,114,109, 97,108,115, - 95,105,110,105,116, 40, 32,118,101, 99, 51, 32,118, 78, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,111,114,103, 44, 32, -111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, - 97,103,110,105,116,117,100,101, 32, 41, 10,123, 10, 9,118, 78,111,114,103, 32, 61, 32,118, 78, 59, 10, 9,118, 78, 97, 99, 99, - 32, 61, 32,118, 78, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, - 10, 47, 42, 42, 32,104,101,108,112,101,114, 32,109,101,116,104,111,100, 32,116,111, 32,101,120,116,114, 97, 99,116, 32,116,104, -101, 32,117,112,112,101,114, 32,108,101,102,116, 32, 51,120, 51, 32,109, 97,116,114,105,120, 32,102,114,111,109, 32, 97, 32, 52, -120, 52, 32,109, 97,116,114,105,120, 32, 42, 47, 10,109, 97,116, 51, 32,116,111, 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, - 52, 41, 10,123, 10, 9,109, 97,116, 51, 32,109, 51, 59, 10, 9,109, 51, 91, 48, 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121, -122, 59, 10, 9,109, 51, 91, 49, 93, 32, 61, 32,109, 52, 91, 49, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 50, 93, 32, 61, 32, -109, 52, 91, 50, 93, 46,120,121,122, 59, 10, 9,114,101,116,117,114,110, 32,109, 51, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,111, 98,106,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114, -102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, -109, 97,116, 52, 32,109, 86,105,101,119, 44, 32,109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, 32, -109, 79, 98,106, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 73,110,118, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108, -111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, - 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97, -103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, - 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, - 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,109, 97,116, 51, - 32,111, 98,106, 50,118,105,101,119, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,109, 86,105,101,119, 32, 42, 32,109, 79, 98,106, - 41, 59, 10, 9,109, 97,116, 51, 32,118,105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,109, 79, 98,106, - 73,110,118, 32, 42, 32,109, 86,105,101,119, 73,110,118, 41, 59, 10, 9, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, - 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, - 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,121, 40, - 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110,111,114,109, 97,108,105,122, -101, 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10, 9,118, 82, 49, - 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, - 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100, -111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9, 47, 42, 32,112,114,101,116,114, - 97,110,115,102,111,114,109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108, -121, 41, 32,117,115,105,110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110,115,112,111,115,101,100, 32, - 42, 47, 10, 9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 82, 50, 32, 61, - 32,118, 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,118,105,101,119, - 50,111, 98,106, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40, -102, 68,101,116, 41, 32, 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, - 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, - 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117, -116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109, -112, 95,105,110,105,116, 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112, -111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,102, -108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, - 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, - 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117, -116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118, -101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, - 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, - 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, 97, -108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,108, - 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, - 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32,110,111,114,109, 97,108,105,122,101, - 40, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, 10, 9,102, 68,101,116, 32, - 61, 32,115,105,103,110, 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, 32, 41, 59, 10, 9, 10, 9, -102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, - 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100, -101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97, -103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105, -100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,118,101, 99, 51, - 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, - 9, 9, 9, 32, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118, -101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,102,108,111, 97, -116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, - 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, - 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, - 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95, -112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114, -102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, - 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, - 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, - 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103, -109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, - 82, 49, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40, -102, 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40, -102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, - 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100, -101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,101, 99, 51, 32, -116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97, -108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108, -111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, - 50, 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108,114, 32, 61, 32, -116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9,118,101, 99, - 50, 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120, -121, 41, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10, 9,114,103, 98,116, -111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,108,108, 32, 41, - 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,114, 41, - 44, 32, 72,108,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, - 44, 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, - 42, 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, - 72,117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97, -112, 53, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102, -108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, - 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, - 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, - 10, 10, 9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84, -108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, - 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, - 59, 10, 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84, -101,120, 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, - 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114, 44, 72,100, - 44, 72,117, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84, - 99, 41, 44, 32, 72, 99, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, - 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, - 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101, -120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10, 9,114,103, 98,116,111, 98, -119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10, 9, 10, - 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10, 9,100, 66,116, 32, - 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, -101,120, 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108, -101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97, - 95,121, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 59, 9, 9, 47, 47, 32,110,101,103, 97, -116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116,117,114,101, 32, 99,111,111,114,100, -105,110, 97,116,101, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120, -121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, - 59, 10, 9, 10, 9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115,105,110,103, 32, 97, 32,100,101,114, -105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101,100, 32,104,101,114,101, 10, 9, 47, - 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98,108,111,103,115,112,111,116, 46, 99, -111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, 97,112,115, 46,104,116,109,108, 10, - 9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, 32,105,109, 97, 95,121, 41, 59, 10, - 9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105,109, 42, 40, 50, 42,116,101,120,116, -117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120,121, 45, 49, 41, 59, 10, 9, 10, 9,100, +116,101,120, 95,114,103, 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101, +120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, + 95,118, 97,108, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, + 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99, +111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114, +103, 98, 95, 99,111,108,111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111, +108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118, +101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95, 99,111, +108,111,114, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, + 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111, +108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97, +108,117,101, 95,118, 97,114,115, 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, + 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10, 9,102, 97, 99,116, 32, 42, + 61, 32, 97, 98,115, 40,102, 97, 99,103, 41, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, + 9,105,102, 40,102, 97, 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, +102, 97, 99,116, 59, 10, 9, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10, 9, 9,102, 97, 99,109, 32, 61, 32,116,109, +112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98,108,101,110,100, 40,102, +108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, + 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99, +111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, + 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, + 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, + 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, + 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, + 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, + 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, + 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117, +116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, 99,114,101,101,110, 40, +102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, +116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, + 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95, +118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, + 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99, +109, 32, 43, 32,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32, +111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40, +102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, +116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, + 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95, +118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, + 32, 45,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111, +117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108, +111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32, +102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111, +108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97, +114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32,102, + 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99, +111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, 40,102,108,111, 97,116, + 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99, +116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10, +123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40, +102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 32, 33, + 61, 32, 48, 46, 48, 41, 10, 9, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, + 97, 99,116, 42,111,117,116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, + 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,102,102, 40, +102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, +116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, + 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95, +118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, + 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, + 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100, 97, +114,107, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102, +108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108, +117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, + 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32, +111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, + 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,108,105,103, +104,116, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102, +108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108, +117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, + 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32, +111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, + 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97, +109,112, 95,112,111,115,105,116,105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, + 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, + 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116, +102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, + 47, 49, 50, 56, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109,117,108,116,105,112,108, +121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, +104, 97,114, 41, 10,123, 10, 9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10, 9,105,102, 40,104, 97,114, 32, 60, + 32, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,104, 97,114, + 32, 62, 32, 53, 49, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10, 9,101,108,115,101, 32, +111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, + 95,102,114,111,109, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108, +112,104, 97, 41, 10,123, 10, 9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109, +116,101,120, 95, 97,108,112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, + 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99, +111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,109,116,101,120, 95,114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102, +108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,105,110,116,101,110,115,105,116,121, 32, 61, 32,100, +111,116, 40,118,101, 99, 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, + 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118,101,114,116, 40,102,108, +111, 97,116, 32,105,110,118, 97,108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, + 10,123, 10, 9,111,117,116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, + 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, + 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118, +101, 99, 52, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, + 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116,101,110, 99,105,108, 40, +102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, +111,117,116,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110, +116,101,110,115,105,116,121, 59, 10, 9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105,110,116,101,110,115,105, +116,121, 42,115,116,101,110, 99,105,108, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105, +108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, + 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, + 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10, 9,111,117,116,114,103, 98, 32, + 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10, + 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, + 32,118,101, 99, 51, 32,111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, + 9,111,117,116,116,101,120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, + 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118, +101, 99, 51, 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9, +111,117,116,116,101,120, 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109, +116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120, +121, 42, 48, 46, 53, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10, +125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, + 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111, +117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114, +101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, + 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, + 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, + 41, 10,123, 10, 9, 47, 47, 32, 84,104,101, 32,105,110,118,101,114,116, 32,111,102, 32,116,104,101, 32,114,101,100, 32, 99,104, + 97,110,110,101,108, 32,105,115, 32,116,111, 32,109, 97,107,101, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32, +109, 97,112, 32, 99,111,109,112,108,105, 97,110,116, 32,119,105,116,104, 32,116,104,101, 32,111,117,116,115,105,100,101, 32,119, +111,114,108,100, 46, 10, 9, 47, 47, 32, 73,116, 32,110,101,101,100,115, 32,116,111, 32, 98,101, 32,100,111,110,101, 32, 98,101, + 99, 97,117,115,101, 32,105,110, 32, 66,108,101,110,100,101,114, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32, +117,115,101,100, 32,112,111,105,110,116,115, 32,105,110,119, 97,114,100, 46, 10, 9, 47, 47, 32, 83,104,111,117,108,100, 32,116, +104,105,115, 32,101,118,101,114, 32, 99,104, 97,110,103,101, 32,116,104,105,115, 32,110,101,103, 97,116,101, 32,109,117,115,116, + 32, 98,101, 32,114,101,109,111,118,101,100, 46, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101, +120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,110,111,114,109, 97,108, 32, + 61, 32, 50, 46, 48, 42, 40,118,101, 99, 51, 40, 45, 99,111,108,111,114, 46,114, 44, 32, 99,111,108,111,114, 46,103, 44, 32, 99, +111,108,111,114, 46, 98, 41, 32, 45, 32,118,101, 99, 51, 40, 45, 48, 46, 53, 44, 32, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,110,111,114,109, 97,108,115, 95,105,110,105,116, 40, + 32,118,101, 99, 51, 32,118, 78, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, + 99, 51, 32,118, 78, 97, 99, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117, +100,101, 32, 41, 10,123, 10, 9,118, 78,111,114,103, 32, 61, 32,118, 78, 59, 10, 9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, + 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104, +101,108,112,101,114, 32,109,101,116,104,111,100, 32,116,111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101, +114, 32,108,101,102,116, 32, 51,120, 51, 32,109, 97,116,114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116, +114,105,120, 32, 42, 47, 10,109, 97,116, 51, 32,116,111, 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10, 9, +109, 97,116, 51, 32,109, 51, 59, 10, 9,109, 51, 91, 48, 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10, 9,109, 51, + 91, 49, 93, 32, 61, 32,109, 52, 91, 49, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46, +120,121,122, 59, 10, 9,114,101,116,117,114,110, 32,109, 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117, +109,112, 95,105,110,105,116, 95,111, 98,106,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, + 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,109, 97,116, 52, 32,109, + 86,105,101,119, 44, 32,109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32, +109, 97,116, 52, 32,109, 79, 98,106, 73,110,118, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80, +114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, + 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100, +101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, + 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, + 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,109, 97,116, 51, 32,111, 98,106, 50,118, +105,101,119, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,109, 86,105,101,119, 32, 42, 32,109, 79, 98,106, 41, 59, 10, 9,109, 97, +116, 51, 32,118,105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,109, 79, 98,106, 73,110,118, 32, 42, 32, +109, 86,105,101,119, 73,110,118, 41, 59, 10, 9, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,118,105,101, +119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32, +118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,121, 40, 32,115,117,114,102, 95, +112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,115,117,114, +102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111, +115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, + 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, + 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9, 47, 42, 32,112,114,101,116,114, 97,110,115,102,111,114, +109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 41, 32,117,115,105, +110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110,115,112,111,115,101,100, 32, 42, 47, 10, 9,118, 82, + 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 82, 50, 32, 61, 32,118, 82, 50, 32, 42, + 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, + 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 32, + 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, + 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117, +100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, + 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, + 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, + 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, + 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, + 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116, +117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, + 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, + 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83, +105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32, +118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, + 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32, +105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, + 9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, + 44, 32,118, 78, 32, 41, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115, +115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, 10, 9,102, 68,101,116, 32, 61, 32,115,105,103,110, + 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, +102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111, +117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80, +114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100, +101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, + 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95, +112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32, +102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, + 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101, +118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111, +117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, + 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9, +118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, + 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, + 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, + 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97, +108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, + 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, + 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, + 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, + 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105, +116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101, +118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10, +118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, + 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66, +115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 83, 84,108,108, + 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108,114, 32, 61, 32,116,101,120, 99,111, 46, +120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117,108, + 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9, + 10, 9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116, +101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,108,108, 32, 41, 59, 10, 9,114,103, 98, +116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,114, 41, 44, 32, 72,108,114, 32, + 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117,108, + 41, 44, 32, 72,117,108, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,108,114, + 32, 45, 32, 72,108,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117,108, 32, 45, 32, + 72,108,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 53, 40, 32,118,101, + 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, + 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, + 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9, +118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, + 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, + 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101, +120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,114, + 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, + 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, + 10, 9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101, +120, 68,121, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114, 44, 72,100, 44, 72,117, 59, 10, 9, +114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84, 99, 41, 44, 32, 72, 99, + 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, + 41, 44, 32, 72,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, + 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, + 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120, +116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, + 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97, +108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109, +112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105, +109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,121, 44, 32,102,108, +111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, + 32, 10,123, 10, 9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 46, 48, 59, 9, 9, 47, 47, 32,110,101,103, 97,116,101, 32,116, +104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116,117,114,101, 32, 99,111,111,114,100,105,110, 97,116, +101, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, + 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9, 10, + 9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115,105,110,103, 32, 97, 32,100,101,114,105,118, 97,116, +105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101,100, 32,104,101,114,101, 10, 9, 47, 47, 32,104,116, +116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98,108,111,103,115,112,111,116, 46, 99,111,109, 47, 50, + 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, 97,112,115, 46,104,116,109,108, 10, 9,118,101, 99, + 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, 32,105,109, 97, 95,121, 41, 59, 10, 9,118,101, 99, + 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105,109, 42, 40, 50, 46, 48, 42,116,101,120,116,117,114, +101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120,121, 45, 49, 46, 48, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,120, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,120, 46,121, 59, 10, 9,100, 66,116, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,121, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,121, 46,121, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, -- cgit v1.2.3 From f6a2b8d724646ac357a0eafc2d29b345fdc1ba5f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 15:08:54 +0000 Subject: BLI_strescape for a basic, python like string escaping, currently only use for drag and drop ID's into the console but should eventually be used for the animsys too. --- source/blender/blenlib/BLI_string.h | 2 + source/blender/blenlib/intern/string.c | 43 ++++++++++++++++++++++ .../blender/editors/space_console/space_console.c | 5 ++- 3 files changed, 49 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 408809661cf..4a0c2ab9482 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -122,6 +122,8 @@ __attribute__ ((format (printf, 1, 2))) #endif ; +size_t BLI_strescape(char *dst, const char *src, const size_t maxlen); + /** * Compare two strings without regard to case. * diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 8e0314ec17f..2f1ddf294ce 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -117,6 +117,49 @@ char *BLI_sprintfN(const char *format, ...) return n; } + +/* match pythons string escaping, assume double quotes - (") + * TODO: should be used to create RNA animation paths. + * TODO: support more fancy string escaping. current code is primitive + * this basically is an ascii version of PyUnicode_EncodeUnicodeEscape() + * which is a useful reference. */ +size_t BLI_strescape(char *dst, const char *src, const size_t maxlen) +{ + size_t len= 0; + while(len < maxlen) { + switch(*src) { + case '\0': + *dst= '\0'; + break; + case '\\': + case '"': + + /* less common but should also be support */ + case '\t': + case '\n': + case '\r': + if(len + 1 < maxlen) { + *dst++ = '\\'; + len++; + } + else { + /* not enough space to escape */ + *dst= '\0'; + break; + } + /* intentionally pass through */ + default: + *dst = *src; + } + dst++; + src++; + len++; + } + + return len; +} + + /* Makes a copy of the text within the "" that appear after some text 'blahblah' * i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples" * diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 890a6cf545a..52c5100900d 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -165,8 +165,11 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) { char text[64]; ID *id= drag->poin; + char id_esc[(sizeof(id->name) - 2) * 2]; - snprintf(text, sizeof(text), "bpy.data.%s['%s']", BKE_idcode_to_name_plural(GS(id->name)), id->name+2); + BLI_strescape(id_esc, id->name+2, sizeof(id_esc)); + + snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); /* copy drag path to properties */ RNA_string_set(drop->ptr, "text", text); -- cgit v1.2.3 From 9a9513a9f09f5524235e202a095b04863a07a52b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 19:58:15 +0000 Subject: fix for 3 bugs in bone renaming - renaming a bone could crash if the area had to spaces in it (reported by Sebastian Koenig). - renaming bones wouldn't update inactive 3d views locked bone names. - selecting locked bones in the UI didnt work in editmode. --- source/blender/editors/armature/editarmature.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 628cdbf21e9..bd8f431535e 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -5402,12 +5402,14 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) ScrArea *sa; /* add regions */ for(sa= screen->areabase.first; sa; sa= sa->next) { - SpaceLink *sl= sa->spacedata.first; - if(sl->spacetype == SPACE_VIEW3D) { - View3D *v3d= (View3D *)sl; - if(v3d->ob_centre && v3d->ob_centre->data == arm) { - if (!strcmp(v3d->ob_centre_bone, oldname)) { - BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME); + SpaceLink *sl; + for (sl= sa->spacedata.first; sl; sl= sl->next) { + if(sl->spacetype==SPACE_VIEW3D) { + View3D *v3d= (View3D *)sl; + if(v3d->ob_centre && v3d->ob_centre->data == arm) { + if (!strcmp(v3d->ob_centre_bone, oldname)) { + BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME); + } } } } -- cgit v1.2.3 From a35b3c5b505ded03bc8a233e6943c3d9fe3faeb5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 20:49:06 +0000 Subject: fix [#28352] Deleting group name in particle system -> panel: Render crashes Blender --- source/blender/blenloader/intern/writefile.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 085cd2cb29c..5b7fcc0e935 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -867,10 +867,12 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) for(; dw; dw=dw->next) { /* update indices */ dw->index = 0; - go = part->dup_group->gobject.first; - while(go && go->ob != dw->ob) { - go=go->next; - dw->index++; + if(part->dup_group) { /* can be NULL if lining fails or set to None */ + go = part->dup_group->gobject.first; + while(go && go->ob != dw->ob) { + go=go->next; + dw->index++; + } } writestruct(wd, DATA, "ParticleDupliWeight", 1, dw); } -- cgit v1.2.3 From 3bb397be76e99a0ea0851179bb264df02b9f244c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Aug 2011 20:54:44 +0000 Subject: fix [#28351] active RenderLayer can be set to None, leading to crash --- source/blender/makesrna/intern/rna_scene.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 29cfc695911..0129629291f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -700,8 +700,8 @@ static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA valu { RenderData *rd= (RenderData*)ptr->data; SceneRenderLayer *srl= (SceneRenderLayer*)value.data; - - rd->actlay = BLI_findindex(&rd->layers, srl); + const int index= BLI_findindex(&rd->layers, srl); + if (index != -1) rd->actlay= index; } static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) @@ -1973,7 +1973,7 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) 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_flag(prop, PROP_EDITABLE); + 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); -- cgit v1.2.3 From f9bffb3ca0ca88a7e774b0ee0da1d384707f0495 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 24 Aug 2011 00:44:58 +0000 Subject: fix [#28340] Can't set image depth, quality from image save --- source/blender/editors/space_image/image_ops.c | 242 ++++++++++++++----------- source/blender/makesdna/DNA_space_types.h | 2 +- source/blender/makesrna/RNA_enum_types.h | 1 + source/blender/makesrna/intern/rna_scene.c | 16 +- 4 files changed, 147 insertions(+), 114 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 6e0d1909963..d483dd45f7f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -938,9 +938,100 @@ void IMAGE_OT_replace(wmOperatorType *ot) /******************** save image as operator ********************/ +typedef struct { + /* matching scene->r settings */ + short planes, imtype, subimtype, quality; + char filepath[FILE_MAX]; /* keep absolute */ +} SaveImageOptions; + +static void save_image_options_defaults(SaveImageOptions *simopts) +{ + simopts->planes= R_PLANES24; + simopts->imtype= R_PNG; + simopts->subimtype= 0; + simopts->quality= 90; + simopts->filepath[0]= '\0'; +} + +static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, Scene *scene, const short guess_path) +{ + void *lock; + ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock); + + if(ibuf) { + Image *ima= sima->image; + RenderResult *rr= BKE_image_acquire_renderresult(scene, ima); + + simopts->planes= ibuf->depth; + + /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */ + if(rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER)) + simopts->imtype= R_MULTILAYER; + else if(ima->type==IMA_TYPE_R_RESULT) + simopts->imtype= scene->r.imtype; + else if (ima->source == IMA_SRC_GENERATED) + simopts->imtype= R_PNG; + else + simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype); + + simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */ + simopts->quality= ibuf->ftype & 0xff; + + BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath)); + + /* sanitize all settings */ + + /* unlikely but just incase */ + if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) { + simopts->planes= 32; + } + + /* some formats dont use quality so fallback to scenes quality */ + if (simopts->quality == 0) { + simopts->quality= scene->r.quality; + } + + /* check for empty path */ + if(guess_path && simopts->filepath[0]==0) { + if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) { + BLI_strncpy(simopts->filepath, "//untitled", FILE_MAX); + } else { + BLI_strncpy(simopts->filepath, G.ima, FILE_MAX); + } + BLI_path_abs(simopts->filepath, G.main->name); + } + + /* cleanup */ + BKE_image_release_renderresult(scene, ima); + } + + ED_space_image_release_buffer(sima, lock); + + return (ibuf != NULL); +} + +static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op) +{ + if (RNA_property_is_set(op->ptr, "color_mode")) simopts->planes= RNA_enum_get(op->ptr, "color_mode"); + if (RNA_property_is_set(op->ptr, "file_format")) simopts->imtype= RNA_enum_get(op->ptr, "file_format"); + // if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX + if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality"); + + if (RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", simopts->filepath); +} + +static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op) +{ + RNA_enum_set(op->ptr, "color_mode", simopts->planes); + RNA_enum_set(op->ptr, "file_format", simopts->imtype); + // RNA_enum_set(op->ptr, "subimtype", simopts->subimtype); + RNA_int_set(op->ptr, "file_quality", simopts->quality); + RNA_string_set(op->ptr, "filepath", simopts->filepath); +} + /* assumes name is FILE_MAX */ /* ima->name and ibuf->name should end up the same */ -static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOperator *op, char *path, int do_newpath) +static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, int do_newpath) { Image *ima= ED_space_image(sima); void *lock; @@ -952,18 +1043,17 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera const short save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); short ok= FALSE; - BLI_path_abs(path, bmain->name); /* old global to ensure a 2nd save goes to same dir */ - BLI_strncpy(G.ima, path, sizeof(G.ima)); + BLI_strncpy(G.ima, simopts->filepath, sizeof(G.ima)); WM_cursor_wait(1); if(ima->type == IMA_TYPE_R_RESULT) { /* enforce user setting for RGB or RGBA, but skip BW */ - if(scene->r.planes==32) { + if(simopts->planes==32) { ibuf->depth= 32; } - else if(scene->r.planes==24) { + else if(simopts->planes==24) { ibuf->depth= 24; } } @@ -974,15 +1064,12 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera ibuf->depth= BKE_alphatest_ibuf(ibuf) ? 32 : 24; } } - - if(scene->r.scemode & R_EXTENSION) { - BKE_add_image_extension(path, sima->imtypenr); - } - if(sima->imtypenr==R_MULTILAYER) { + if(simopts->imtype==R_MULTILAYER) { + Scene *scene= CTX_data_scene(C); RenderResult *rr= BKE_image_acquire_renderresult(scene, ima); if(rr) { - RE_WriteRenderResult(rr, path, scene->r.quality); + RE_WriteRenderResult(rr, simopts->filepath, simopts->quality); ok= TRUE; } else { @@ -990,23 +1077,23 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera } BKE_image_release_renderresult(scene, ima); } - else if (BKE_write_ibuf(ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) { + else if (BKE_write_ibuf(ibuf, simopts->filepath, simopts->imtype, simopts->subimtype, simopts->quality)) { ok= TRUE; } if(ok) { if(relative) - BLI_path_rel(path, bmain->name); /* only after saving */ + BLI_path_rel(simopts->filepath, bmain->name); /* only after saving */ if(ibuf->name[0]==0) { - BLI_strncpy(ibuf->name, path, sizeof(ibuf->name)); - BLI_strncpy(ima->name, path, sizeof(ima->name)); + BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name)); + BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name)); } if(!save_copy) { if(do_newpath) { - BLI_strncpy(ima->name, path, sizeof(ima->name)); - BLI_strncpy(ibuf->name, path, sizeof(ibuf->name)); + BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name)); + BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name)); } ibuf->userflags &= ~IB_BITMAPDIRTY; @@ -1034,7 +1121,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera } } else { - BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", path); + BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", simopts->filepath); } @@ -1049,17 +1136,14 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera static int save_as_exec(bContext *C, wmOperator *op) { SpaceImage *sima= CTX_wm_space_image(C); - Scene *scene= CTX_data_scene(C); - Image *ima = ED_space_image(sima); - char str[FILE_MAX]; + SaveImageOptions simopts; - if(!ima) - return OPERATOR_CANCELLED; + /* just incase to initialize values, + * these should be set on invoke or by the caller. */ + save_image_options_defaults(&simopts); + save_image_options_from_op(&simopts, op); - sima->imtypenr= RNA_enum_get(op->ptr, "file_type"); - RNA_string_get(op->ptr, "filepath", str); - - save_image_doit(C, sima, scene, op, str, TRUE); + save_image_doit(C, sima, op, &simopts, TRUE); return OPERATOR_FINISHED; } @@ -1069,7 +1153,7 @@ static int save_as_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); - if(BKE_add_image_extension(filepath, RNA_enum_get(op->ptr, "file_type"))) { + if(BKE_add_image_extension(filepath, RNA_enum_get(op->ptr, "file_format"))) { RNA_string_set(op->ptr, "filepath", filepath); return TRUE; } @@ -1081,65 +1165,33 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) SpaceImage *sima= CTX_wm_space_image(C); Image *ima = ED_space_image(sima); Scene *scene= CTX_data_scene(C); - ImBuf *ibuf; - char filename[FILE_MAX]; - - void *lock; + SaveImageOptions simopts; if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); if(RNA_property_is_set(op->ptr, "filepath")) return save_as_exec(C, op); - - if(!ima) - return OPERATOR_CANCELLED; - /* always opens fileselect */ - ibuf= ED_space_image_acquire_buffer(sima, &lock); - - if(ibuf) { - /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */ - if(ima->rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER)) - sima->imtypenr= R_MULTILAYER; - else if(ima->type==IMA_TYPE_R_RESULT) - sima->imtypenr= scene->r.imtype; - else if (ima->source == IMA_SRC_GENERATED) - sima->imtypenr= R_PNG; - else - sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype); - - RNA_enum_set(op->ptr, "file_type", sima->imtypenr); - - if(ibuf->name[0]==0) - if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) { - BLI_strncpy(filename, "//untitled", FILE_MAX); - } else { - BLI_strncpy(filename, G.ima, FILE_MAX); - } - else - BLI_strncpy(filename, ibuf->name, FILE_MAX); - - /* enable save_copy by default for render results */ - if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_property_is_set(op->ptr, "copy")) { - RNA_boolean_set(op->ptr, "copy", TRUE); - } - - // XXX note: we can give default menu enums to operator for this - image_filesel(C, op, filename); + if (save_image_options_init(&simopts, sima, scene, TRUE) == 0) + return OPERATOR_CANCELLED; + save_image_options_to_op(&simopts, op); - ED_space_image_release_buffer(sima, lock); - - return OPERATOR_RUNNING_MODAL; + /* enable save_copy by default for render results */ + if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_property_is_set(op->ptr, "copy")) { + RNA_boolean_set(op->ptr, "copy", TRUE); } - ED_space_image_release_buffer(sima, lock); + // XXX note: we can give default menu enums to operator for this + image_filesel(C, op, simopts.filepath); - return OPERATOR_CANCELLED; + return OPERATOR_RUNNING_MODAL; } void IMAGE_OT_save_as(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Save As Image"; ot->idname= "IMAGE_OT_save_as"; @@ -1154,7 +1206,13 @@ void IMAGE_OT_save_as(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); + + /* format options */ + RNA_def_enum(ot->srna, "file_format", image_file_type_items, R_PNG, "File Type", "File type to save image as."); + RNA_def_enum(ot->srna, "color_mode", image_color_mode_items, R_PLANES24, "Channels", "Image channels to save"); + prop= RNA_def_int(ot->srna, "file_quality", 90, 0, 100, "Quality", "", 0, 100); + RNA_def_property_subtype(prop, PROP_PERCENTAGE); + WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender"); @@ -1164,45 +1222,19 @@ void IMAGE_OT_save_as(wmOperatorType *ot) static int save_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); SpaceImage *sima= CTX_wm_space_image(C); - Image *ima = ED_space_image(sima); - void *lock; - ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock); Scene *scene= CTX_data_scene(C); - RenderResult *rr; - char name[FILE_MAX]; + SaveImageOptions simopts; - if(!ima || !ibuf) { - ED_space_image_release_buffer(sima, lock); + if (save_image_options_init(&simopts, sima, scene, FALSE) == 0) return OPERATOR_CANCELLED; - } - - /* if exists, saves over without fileselect */ - - BLI_strncpy(name, ima->name, FILE_MAX); - if(name[0]==0) - BLI_strncpy(name, G.ima, FILE_MAX); - else - BLI_path_abs(name, bmain->name); - - if(BLI_exists(name) && BLI_is_writable(name)) { - rr= BKE_image_acquire_renderresult(scene, ima); + save_image_options_from_op(&simopts, op); - if(rr) - sima->imtypenr= R_MULTILAYER; - else - sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype); - - BKE_image_release_renderresult(scene, ima); - ED_space_image_release_buffer(sima, lock); - - save_image_doit(C, sima, scene, op, name, FALSE); + if (BLI_exists(simopts.filepath) && BLI_is_writable(simopts.filepath)) { + save_image_doit(C, sima, op, &simopts, FALSE); } else { - ED_space_image_release_buffer(sima, lock); - - BKE_report(op->reports, RPT_ERROR, "Can not save image."); + BKE_reportf(op->reports, RPT_ERROR, "Can not save image, path '%s' is not writable.", simopts.filepath); return OPERATOR_CANCELLED; } diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 1549bd71748..67899db5538 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -267,7 +267,7 @@ typedef struct SpaceImage { float centx, centy; /* storage for offset while render drawing */ short curtile; /* the currently active tile of the image when tile is enabled, is kept in sync with the active faces tile */ - short imtypenr; + short pad; short lock; short pin; char dt_uv; /* UV draw type */ diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index fc415dc8082..c82a43e371c 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -54,6 +54,7 @@ extern EnumPropertyItem constraint_type_items[]; extern EnumPropertyItem boidrule_type_items[]; extern EnumPropertyItem image_type_items[]; +extern EnumPropertyItem image_color_mode_items[]; extern EnumPropertyItem beztriple_keyframe_type_items[]; extern EnumPropertyItem beztriple_handle_type_items[]; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 0129629291f..552ff7b6365 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -155,6 +155,12 @@ EnumPropertyItem image_type_items[] = { #endif {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem image_color_mode_items[] ={ + {R_PLANESBW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"}, + {R_PLANES24, "RGB", 0, "RGB", "Images are saved with RGB (color) data"}, + {R_PLANES32, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "DNA_anim_types.h" @@ -1999,13 +2005,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {R_ALPHAPREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"}, {R_ALPHAKEY, "STRAIGHT", 0, "Straight Alpha", "Transparent RGB and alpha pixels are unmodified"}, {0, NULL, 0, NULL, NULL}}; - - static EnumPropertyItem color_mode_items[] ={ - {R_PLANESBW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"}, - {R_PLANES24, "RGB", 0, "RGB", "Images are saved with RGB (color) data"}, - {R_PLANES32, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"}, - {0, NULL, 0, NULL, NULL}}; - + static EnumPropertyItem display_mode_items[] ={ {R_OUTPUT_SCREEN, "SCREEN", 0, "Full Screen", "Images are rendered in full Screen"}, {R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in Image Editor"}, @@ -2194,7 +2194,7 @@ 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, color_mode_items); + 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_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); -- cgit v1.2.3 From 82e622f1585ff615cc9607f1f9492b961842ce1b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 24 Aug 2011 14:22:41 +0000 Subject: fix [#28356] Import export STL files, problem in script in version r39307 & correct some bad comments. --- source/blender/editors/space_file/file_ops.c | 16 +++++++++++----- source/blender/python/intern/bpy_rna.c | 1 - 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 4dd97c63d40..a34335a031d 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -621,25 +621,31 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) } /* some ops have multiple files to select */ + /* this is called on operators check() so clear collections first since + * they may be already set. */ { PointerRNA itemptr; + PropertyRNA *prop_files= RNA_struct_find_property(op->ptr, "files"); + PropertyRNA *prop_dirs= RNA_struct_find_property(op->ptr, "dirs"); int i, numfiles = filelist_numfiles(sfile->files); - if(RNA_struct_find_property(op->ptr, "files")) { + if(prop_files) { + RNA_property_collection_clear(op->ptr, prop_files); for (i=0; ifiles, i, CHECK_FILES)) { struct direntry *file= filelist_file(sfile->files, i); - RNA_collection_add(op->ptr, "files", &itemptr); + RNA_property_collection_add(op->ptr, prop_files, &itemptr); RNA_string_set(&itemptr, "name", file->relname); } } } - - if(RNA_struct_find_property(op->ptr, "dirs")) { + + if(prop_dirs) { + RNA_property_collection_clear(op->ptr, prop_dirs); for (i=0; ifiles, i, CHECK_DIRS)) { struct direntry *file= filelist_file(sfile->files, i); - RNA_collection_add(op->ptr, "dirs", &itemptr); + RNA_property_collection_add(op->ptr, prop_dirs, &itemptr); RNA_string_set(&itemptr, "name", file->relname); } } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 72553872057..831d6a281ee 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -4320,7 +4320,6 @@ static PyObject *small_dict_get_item_string(PyObject *dict, const char *key_look Py_ssize_t pos = 0; PyObject *value = NULL; - /* case not, search for it in the script's global dictionary */ while (PyDict_Next(dict, &pos, &key, &value)) { if(PyUnicode_Check(key)) { if(strcmp(key_lookup, _PyUnicode_AsString(key))==0) { -- cgit v1.2.3 From 9ad6434c4e6c1d157d4ce4d0904c46154229aec9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 24 Aug 2011 16:04:35 +0000 Subject: opencollada find module. hopefully solves the problem where includes can in an `/include` subdir or not. --- source/blender/collada/CMakeLists.txt | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'source') diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index b5c84bc3c84..3466c3ab5c0 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -39,27 +39,9 @@ set(INC ) set(INC_SYS - + ${OPENCOLLADA_INCLUDE_DIRS} ) -if(APPLE) - list(APPEND INC_SYS - ${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter - ${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils - ${OPENCOLLADA_INCLUDE_DIR}/COLLADAFramework - ${OPENCOLLADA_INCLUDE_DIR}/COLLADASaxFrameworkLoader - ${OPENCOLLADA_INCLUDE_DIR}/GeneratedSaxParser - ) -else() - list(APPEND INC_SYS - ${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter/include - ${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils/include - ${OPENCOLLADA_INCLUDE_DIR}/COLLADAFramework/include - ${OPENCOLLADA_INCLUDE_DIR}/COLLADASaxFrameworkLoader/include - ${OPENCOLLADA_INCLUDE_DIR}/GeneratedSaxParser/include - ) -endif() - set(SRC AnimationImporter.cpp ArmatureExporter.cpp -- cgit v1.2.3 From 7fc26e0123e700113f340068a964c1a12133b7e1 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 24 Aug 2011 20:28:54 +0000 Subject: Committing patch #25675 "Make "Cast Buffer Shadows" option work in viewport and BGE" by me. Description from the tracker: "It's really handy to be able to prevent an object/material from casting a shadow. So, I made use of the Cast Buffer Shadows option in the material settings, and made it work in the viewport and the BGE." --- source/blender/editors/space_view3d/drawobject.c | 14 +++++++++++++- source/blender/editors/space_view3d/view3d_draw.c | 2 +- source/blender/makesdna/DNA_view3d_types.h | 1 + source/gameengine/Converter/BL_BlenderDataConversion.cpp | 2 ++ source/gameengine/Ketsji/BL_Material.h | 3 ++- source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 1 + source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp | 5 +++++ source/gameengine/Rasterizer/RAS_IPolygonMaterial.h | 4 +++- source/gameengine/Rasterizer/RAS_MaterialBucket.cpp | 3 +++ 9 files changed, 31 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index ddc10d78cac..3133ad131bb 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2843,8 +2843,20 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D Object *ob= base->object; Object *obedit= scene->obedit; Mesh *me= ob->data; + Material *ma=NULL; EditMesh *em= me->edit_mesh; - int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha; + int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i; + + /* If we are drawing shadows and any of the materials don't cast a shadow, then don't draw the object */ + if (v3d->flag2 & V3D_RENDER_SHADOW) + { + for(i=0; itotcol; ++i) + { + ma = give_current_material(ob, i); + if (ma && !(ma->mode & MA_SHADBUF)) + return 1; + } + } if(obedit && ob!=obedit && ob->data==obedit->data) { if(ob_get_key(ob) || ob_get_key(obedit)); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index f8837594ddb..9249d4d2bf0 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2155,7 +2155,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) v3d->drawtype = OB_SOLID; v3d->lay &= GPU_lamp_shadow_layer(shadow->lamp); v3d->flag2 &= ~V3D_SOLID_TEX; - v3d->flag2 |= V3D_RENDER_OVERRIDE; + v3d->flag2 |= V3D_RENDER_OVERRIDE | V3D_RENDER_SHADOW; GPU_lamp_shadow_buffer_bind(shadow->lamp, viewmat, &winsize, winmat); diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 89b8bad2806..3c8d20a6f16 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -247,6 +247,7 @@ typedef struct View3D { #define V3D_SOLID_TEX 8 #define V3D_DISPGP 16 #define V3D_LOCK_CAMERA 32 +#define V3D_RENDER_SHADOW 64 /* This is a runtime only flag that's used to tell draw_mesh_object() that we're doing a shadow pass instead of a regular draw */ /* View3D->around */ #define V3D_CENTER 0 diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 7b9c5d4b4d6..35c319e263b 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -350,6 +350,8 @@ bool ConvertMaterial( // use lighting? material->ras_mode |= ( mat->mode & MA_SHLESS )?0:USE_LIGHT; + // cast shadows? + material->ras_mode |= ( mat->mode & MA_SHADBUF )?CAST_SHADOW:0; MTex *mttmp = 0; numchan = getNumTexChannels(mat); int valid_index = 0; diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h index ef25c9218a3..c0440e66501 100644 --- a/source/gameengine/Ketsji/BL_Material.h +++ b/source/gameengine/Ketsji/BL_Material.h @@ -157,7 +157,8 @@ enum BL_ras_mode ALPHA=8, // TRIANGLE=16, USE_LIGHT=32, - WIRE=64 + WIRE=64, + CAST_SHADOW=128 }; // ------------------------------------- diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 9ff32ba57c5..4226896aec0 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -85,6 +85,7 @@ void KX_BlenderMaterial::Initialize( m_flag |= (mMaterial->IdMode>=ONETEX)? RAS_MULTITEX: 0; m_flag |= ((mMaterial->ras_mode & USE_LIGHT)!=0)? RAS_MULTILIGHT: 0; m_flag |= (mMaterial->glslmat)? RAS_BLENDERGLSL: 0; + m_flag |= ((mMaterial->ras_mode & CAST_SHADOW)!=0)? RAS_CASTSHADOW: 0; // figure max int enabled = mMaterial->num_enabled; diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index 47f1dcb412a..5a1b52489b4 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -246,6 +246,11 @@ bool RAS_IPolyMaterial::UsesLighting(RAS_IRasterizer *rasty) const return dolights; } +bool RAS_IPolyMaterial::CastsShadows() const +{ + return (m_flag & RAS_CASTSHADOW) != 0; +} + bool RAS_IPolyMaterial::UsesObjectColor() const { return !(m_flag & RAS_BLENDERGLSL); diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h index b0e7daf81d7..2a5c6a179b6 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h @@ -62,7 +62,8 @@ enum MaterialProps RAS_AUTOGEN =128, RAS_NORMAL =256, RAS_DEFMULTI =512, - RAS_BLENDERGLSL =1024 + RAS_BLENDERGLSL =1024, + RAS_CASTSHADOW =2048 }; /** @@ -169,6 +170,7 @@ public: virtual void GetMaterialRGBAColor(unsigned char *rgba) const; virtual bool UsesLighting(RAS_IRasterizer *rasty) const; virtual bool UsesObjectColor() const; + virtual bool CastsShadows() const; virtual void Replace_IScene(SCA_IScene *val) {}; /* overridden by KX_BlenderMaterial */ diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index 7647f7d3f27..85284096bb9 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -586,6 +586,9 @@ bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_I RAS_IRenderTools *rendertools) { bool uselights; + + if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !m_material->CastsShadows()) + return false; if(!rasty->SetMaterial(*m_material)) return false; -- cgit v1.2.3 From 5f66f37e225eb87532374af6c495a409da4ece66 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Wed, 24 Aug 2011 20:48:37 +0000 Subject: Patch for bug #28289 updated the logic behind node delete with reconnect. When on input and output socket is connected, these two will be reconnected see bug report for example. http://projects.blender.org/tracker/?func=detail&aid=28289&group_id=9&atid=498 --- source/blender/editors/space_node/node_edit.c | 89 +++++++++++++++++++-------- 1 file changed, 63 insertions(+), 26 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 011f9a31c93..508cb82ee1b 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3080,78 +3080,115 @@ void NODE_OT_delete(wmOperatorType *ot) } /* ****************** Delete with reconnect ******************* */ +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) { + if (link->tosock == sock) { + return sock->type; + } + } + } + return -1; +} -/* note: in cmp_util.c is similar code, for node_compo_pass_on() */ -/* used for disabling node (similar code in node_draw.c for disable line) */ static void node_delete_reconnect(bNodeTree* tree, bNode* node) { - bNodeLink *link, *next; + bNodeLink *link, *next, *first = NULL; bNodeSocket *valsocket= NULL, *colsocket= NULL, *vecsocket= NULL; bNodeSocket *deliveringvalsocket= NULL, *deliveringcolsocket= NULL, *deliveringvecsocket= NULL; bNode *deliveringvalnode= NULL, *deliveringcolnode= NULL, *deliveringvecnode= NULL; bNodeSocket *sock; - - /* test the inputs */ - for(sock= node->inputs.first; sock; sock= sock->next) { - int type = sock->type; - if(type==SOCK_VALUE && valsocket==NULL) valsocket = sock; - if(type==SOCK_VECTOR && vecsocket==NULL) vecsocket = sock; - if(type==SOCK_RGBA && colsocket==NULL) colsocket = sock; - } - // we now have the input sockets for the 'data types' - // now find the output sockets (and nodes) in the tree that delivers data to these input sockets + int type; + int numberOfConnectedOutputSockets = 0; + int numberOfReconnections = 0; + int numberOfConnectedInputSockets = 0; + + /* + test the inputs, not really correct when a node has multiple input sockets of the same type + the first link evaluated will be used to determine the possible connection. + */ for(link= tree->links.first; link; link=link->next) { - if (valsocket != NULL) { - if (link->tosock == valsocket) { - deliveringvalnode = link->fromnode; - deliveringvalsocket = link->fromsock; + if (link->tonode == node) { numberOfConnectedInputSockets++; } + type = is_connected_to_input_socket(node, link); + switch (type) { + case SOCK_RGBA: + if (colsocket == NULL) { + colsocket = link->tosock; + deliveringcolnode = link->fromnode; + deliveringcolsocket = link->fromsock; } - } - if (vecsocket != NULL) { - if (link->tosock == vecsocket) { + break; + case SOCK_VECTOR: + if (vecsocket == NULL) { + vecsocket = link->tosock; deliveringvecnode = link->fromnode; deliveringvecsocket = link->fromsock; } - } - if (colsocket != NULL) { - if (link->tosock == colsocket) { - deliveringcolnode = link->fromnode; - deliveringcolsocket = link->fromsock; + break; + case SOCK_VALUE: + if (valsocket == NULL) { + valsocket = link->tosock; + deliveringvalnode = link->fromnode; + deliveringvalsocket = link->fromsock; } + break; + default: + break; } } + // we now have the sockets+nodes that fill the inputsockets be aware for group nodes these can be NULL // now make the links for all outputlinks of the node to be reconnected for(link= tree->links.first; link; link=next) { next= link->next; if (link->fromnode == node) { sock = link->fromsock; + numberOfConnectedOutputSockets ++; + if (!first) first = link; switch(sock->type) { case SOCK_VALUE: if (deliveringvalsocket) { link->fromnode = deliveringvalnode; link->fromsock = deliveringvalsocket; + numberOfReconnections++; } break; case SOCK_VECTOR: if (deliveringvecsocket) { link->fromnode = deliveringvecnode; link->fromsock = deliveringvecsocket; + numberOfReconnections++; } break; case SOCK_RGBA: if (deliveringcolsocket) { link->fromnode = deliveringcolnode; link->fromsock = deliveringcolsocket; + numberOfReconnections++; } break; } } } + + /* when no connections have been made, and if only one delivering input socket type and one output socket we will connect those two */ + if (numberOfConnectedOutputSockets == 1 && numberOfReconnections == 0 && numberOfConnectedInputSockets == 1) { + if (deliveringcolsocket) { + first->fromnode = deliveringcolnode; + first->fromsock = deliveringcolsocket; + } else if (deliveringvecsocket) { + first->fromnode = deliveringvecnode; + first->fromsock = deliveringvecsocket; + } else if (deliveringvalsocket) { + first->fromnode = deliveringvalnode; + first->fromsock = deliveringvalsocket; + } + } + if(node->id) node->id->us--; nodeFreeNode(tree, node); - } static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op)) -- cgit v1.2.3 From 44f7a8aee2dcd664717b58f8e1265f832d67062d Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 25 Aug 2011 07:30:12 +0000 Subject: Fix for [#28239] Particles Billboard 3x3 Split Error. * Patch by Alex Fraser. --- source/blender/render/intern/source/convertblender.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 7033ec27fc0..2f79560efd6 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1345,8 +1345,11 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl VlakRen *vlr; MTFace *mtf; float xvec[3], yvec[3], zvec[3], bb_center[3]; + /* Number of tiles */ int totsplit = bb->uv_split * bb->uv_split; - float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; + int tile, x, y; + /* Tile offsets */ + 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++); @@ -1420,11 +1423,14 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl else if(bb->split_offset==PART_BB_OFF_RANDOM) time = (float)fmod(time + bb->random, 1.0f); - uvx = uvdx * floor((float)(bb->uv_split * bb->uv_split) * (float)fmod((double)time, (double)uvdx)); - uvy = uvdy * floor((1.0f - time) * (float)bb->uv_split); - - if(fmod(time, 1.0f / bb->uv_split) == 0.0f) - uvy -= uvdy; + /* Find the coordinates in tile space (integer), then convert to UV + * space (float). Note that Y is flipped. */ + tile = (int)((time + FLT_EPSILON10) * totsplit); + x = tile % bb->uv_split; + y = tile / bb->uv_split; + y = (bb->uv_split - 1) - y; + uvx = uvdx * x; + uvy = uvdy * y; } /* normal UVs */ -- cgit v1.2.3 From b7eac1edcf472df7c705e6c3463e8404f72422df Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Aug 2011 15:49:52 +0000 Subject: picky style edits with screen/view/drawing, also remove own bad example doc. --- source/blender/editors/interface/interface_draw.c | 40 +++++++--------------- .../blender/editors/interface/interface_handlers.c | 3 +- source/blender/editors/interface/interface_icons.c | 3 +- source/blender/editors/screen/screen_edit.c | 3 +- source/blender/editors/screen/screen_ops.c | 15 ++++---- source/blender/editors/space_view3d/drawobject.c | 24 ++++++------- source/blender/editors/space_view3d/view3d_draw.c | 10 +++--- source/blender/editors/space_view3d/view3d_edit.c | 18 +++++----- source/blender/editors/space_view3d/view3d_view.c | 6 ++-- 9 files changed, 48 insertions(+), 74 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index dd7d2ca765f..76ed9891b8e 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -530,14 +530,11 @@ static void ui_draw_but_CHARTAB(uiBut *but) int charmax = G.charmax; /* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */ - if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) - { - if(G.ui_international == TRUE) - { + if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) { + if(G.ui_international == TRUE) { charmax = 0xff; } - else - { + else { charmax = 0xff; } } @@ -562,16 +559,13 @@ static void ui_draw_but_CHARTAB(uiBut *but) cs = G.charstart; /* Set the font, in case it is not FO_BUILTIN_NAME font */ - if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) - { + if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) { // Is the font file packed, if so then use the packed file - if(G.selfont->packedfile) - { + if(G.selfont->packedfile) { pf = G.selfont->packedfile; FTF_SetFont(pf->data, pf->size, 14.0); } - else - { + else { char tmpStr[256]; int err; @@ -580,10 +574,8 @@ static void ui_draw_but_CHARTAB(uiBut *but) err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); } } - else - { - if(G.ui_international == TRUE) - { + else { + if(G.ui_international == TRUE) { FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0); } } @@ -595,8 +587,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax)); glColor3ub(0, 0, 0); - for(y = 0; y < 6; y++) - { + for(y = 0; y < 6; y++) { // Do not draw more than the category allows if(cs > charmax) break; @@ -676,23 +667,19 @@ static void ui_draw_but_CHARTAB(uiBut *but) glShadeModel(GL_FLAT); /* Return Font Settings to original */ - if(U.fontsize && U.fontname[0]) - { + if(U.fontsize && U.fontname[0]) { result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize); } - else if (U.fontsize) - { + else if (U.fontsize) { result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize); } - if (result == 0) - { + if (result == 0) { result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11); } /* resets the font size */ - if(G.ui_international == TRUE) - { + if(G.ui_international == TRUE) { // uiSetCurFont(but->block, UI_HELV); } } @@ -1604,7 +1591,6 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select)) #endif { a= i*aspect; - } for(; i--; a-=aspect) { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 3bd29f8de3e..d7eba8c0ac7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -800,8 +800,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to) if(!act_iter) return; /* (3) add a new controller */ - if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) - { + if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) { cont = (bController *)ob->controllers.last; /* (4) link the sensor->controller->actuator */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 412c0233c35..c3a0f438fbe 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1103,8 +1103,7 @@ int ui_id_icon_get(bContext *C, ID *id, int big) int iconid= 0; /* icon */ - switch(GS(id->name)) - { + switch(GS(id->name)) { case ID_BR: iconid= ui_id_brush_get_icon(C, id); break; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 80a65d3224e..5e875e40f14 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -533,8 +533,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2) dir = area_getorientation(sa1, sa2); /*printf("dir is : %i \n", dir);*/ - if (dir < 0) - { + if (dir < 0) { if (sa1 ) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM; if (sa2 ) sa2->flag &= ~AREA_FLAG_DRAWJOINTO; return 0; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 1410331700f..0ac30853eae 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1544,8 +1544,7 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) /* subtractwidth of regions on opposite side * prevents dragging regions into other opposite regions */ - for (ar=sa->regionbase.first; ar; ar=ar->next) - { + for (ar=sa->regionbase.first; ar; ar=ar->next) { if (ar == scalear) continue; @@ -2021,12 +2020,12 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot) */ typedef struct sAreaJoinData - { - ScrArea *sa1; /* first area to be considered */ - ScrArea *sa2; /* second area to be considered */ - ScrArea *scr; /* designed for removal */ - - } sAreaJoinData; +{ + ScrArea *sa1; /* first area to be considered */ + ScrArea *sa2; /* second area to be considered */ + ScrArea *scr; /* designed for removal */ + +} sAreaJoinData; /* validate selection inside screen, set variables OK */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 3133ad131bb..638d197ccf7 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2843,18 +2843,17 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D Object *ob= base->object; Object *obedit= scene->obedit; Mesh *me= ob->data; - Material *ma=NULL; EditMesh *em= me->edit_mesh; int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i; - /* If we are drawing shadows and any of the materials don't cast a shadow, then don't draw the object */ - if (v3d->flag2 & V3D_RENDER_SHADOW) - { - for(i=0; itotcol; ++i) - { - ma = give_current_material(ob, i); - if (ma && !(ma->mode & MA_SHADBUF)) + /* If we are drawing shadows and any of the materials don't cast a shadow, + * then don't draw the object */ + if (v3d->flag2 & V3D_RENDER_SHADOW) { + for(i=0; itotcol; ++i) { + Material *ma= give_current_material(ob, i); + if (ma && !(ma->mode & MA_SHADBUF)) { return 1; + } } } @@ -6125,8 +6124,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } /* draw code for smoke */ - if((md = modifiers_findByType(ob, eModifierType_Smoke))) - { + if((md = modifiers_findByType(ob, eModifierType_Smoke))) { SmokeModifierData *smd = (SmokeModifierData *)md; // draw collision objects @@ -6518,7 +6516,6 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec switch( ob->type) { case OB_MESH: - { if(ob->mode & OB_MODE_EDIT) { Mesh *me= ob->data; EditMesh *em= me->edit_mesh; @@ -6552,8 +6549,9 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec EM_free_index_arrays(); } - else bbs_mesh_solid(scene, ob); - } + else { + bbs_mesh_solid(scene, ob); + } break; case OB_CURVE: case OB_SURF: diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 9249d4d2bf0..80da75bc603 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1141,12 +1141,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) glRectf(x1i, y1i, x2i, y2i); #ifdef VIEW3D_CAMERA_BORDER_HACK - { - if(view3d_camera_border_hack_test == TRUE) { - glColor4fv(view3d_camera_border_hack_col); - glRectf(x1i+1, y1i+1, x2i-1, y2i-1); - view3d_camera_border_hack_test= FALSE; - } + if(view3d_camera_border_hack_test == TRUE) { + glColor4fv(view3d_camera_border_hack_col); + glRectf(x1i+1, y1i+1, x2i-1, y2i-1); + view3d_camera_border_hack_test= FALSE; } #endif diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 979a602b4f5..0e8dd38c02c 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -372,12 +372,12 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec) y/= (float)((rect->ymax - rect->ymin)/2); d = sqrt(x*x + y*y); - if (d < radius * (float)M_SQRT1_2) /* Inside sphere */ - z = sqrt(radius*radius - d*d); - else - { /* On hyperbola */ - t = radius / (float)M_SQRT2; - z = t*t / d; + if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */ + z= sqrt(radius*radius - d*d); + } + else { /* On hyperbola */ + t= radius / (float)M_SQRT2; + z= t*t / d; } vec[0]= x; @@ -1620,8 +1620,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) vod= op->customdata; /* if one or the other zoom position aren't set, set from event */ - if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) - { + if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) { RNA_int_set(op->ptr, "mx", event->x); RNA_int_set(op->ptr, "my", event->y); } @@ -1834,8 +1833,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) vod= op->customdata; /* if one or the other zoom position aren't set, set from event */ - if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) - { + if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) { RNA_int_set(op->ptr, "mx", event->x); RNA_int_set(op->ptr, "my", event->y); } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index ed0b2645c99..c48459108eb 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -840,8 +840,7 @@ void project_int_noclip(ARegion *ar, const float vec[3], int adr[2]) adr[0] = (int)floor(fx); adr[1] = (int)floor(fy); } - else - { + else { adr[0] = ar->winx / 2; adr[1] = ar->winy / 2; } @@ -904,8 +903,7 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2]) 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]; } - else - { + else { adr[0] = ar->winx / 2.0f; adr[1] = ar->winy / 2.0f; } -- cgit v1.2.3 From 88ba2504c7269c408f400de6637545333641ee1f Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Thu, 25 Aug 2011 16:41:08 +0000 Subject: Fix for [#28304] Show A: and B: drives in Windows file browser. --- source/blender/editors/space_file/fsmenu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index a6e84b0c41d..aa2ea124fe0 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -300,7 +300,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu) tmp= GetLogicalDrives(); - for (i=2; i < 26; i++) { + for (i=0; i < 26; i++) { if ((tmp>>i) & 1) { tmps[0]='A'+i; tmps[1]=':'; -- cgit v1.2.3 From a244a787de9d3353efdd4dd42794e14b830b3ddb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Aug 2011 16:42:42 +0000 Subject: sanity checks on operator exec/modal/invoke return values. --- source/blender/makesdna/DNA_windowmanager_types.h | 18 ++++++++++++------ source/blender/windowmanager/intern/wm_event_system.c | 5 +++++ source/blender/windowmanager/intern/wm_operators.c | 10 +++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 1f0ae28a00d..47ebf111eba 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -320,14 +320,20 @@ typedef struct wmOperator { } wmOperator; -/* operator type exec(), invoke() modal(), return values */ -#define OPERATOR_RUNNING_MODAL 1 -#define OPERATOR_CANCELLED 2 -#define OPERATOR_FINISHED 4 + +/* operator type return flags: exec(), invoke() modal(), return values */ +#define OPERATOR_RUNNING_MODAL (1<<0) +#define OPERATOR_CANCELLED (1<<1) +#define OPERATOR_FINISHED (1<<2) /* add this flag if the event should pass through */ -#define OPERATOR_PASS_THROUGH 8 +#define OPERATOR_PASS_THROUGH (1<<3) /* in case operator got executed outside WM code... like via fileselect */ -#define OPERATOR_HANDLED 16 +#define OPERATOR_HANDLED (1<<4) + +#define OPERATOR_FLAGS_ALL ((1<<5)-1) + +/* sanity checks for debug mode only */ +#define OPERATOR_RETVAL_CHECK(ret) BLI_assert(ret != 0 && (ret & OPERATOR_FLAGS_ALL) == ret) /* wmOperator flag */ #define OP_GRAB_POINTER 1 diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 413ff181f11..27586525253 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -531,6 +531,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat) wm->op_undo_depth++; retval= op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) wm->op_undo_depth--; @@ -690,6 +691,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P wm->op_undo_depth++; retval= op->type->invoke(C, op, event); + OPERATOR_RETVAL_CHECK(retval); if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) wm->op_undo_depth--; @@ -699,6 +701,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P wm->op_undo_depth++; retval= op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) wm->op_undo_depth--; @@ -917,6 +920,7 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, int context, PointerRNA wm->op_undo_depth++; retval= op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) wm->op_undo_depth--; @@ -1203,6 +1207,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand wm->op_undo_depth++; retval= ot->modal(C, op, event); + OPERATOR_RETVAL_CHECK(retval); if(ot->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) wm->op_undo_depth--; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index d794685ea70..a4efa8fff84 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -213,6 +213,7 @@ static int wm_macro_exec(bContext *C, wmOperator *op) if(opm->type->exec) { retval= opm->type->exec(C, opm); + OPERATOR_RETVAL_CHECK(retval); if (retval & OPERATOR_FINISHED) { MacroData *md = op->customdata; @@ -237,6 +238,8 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event, else if(opm->type->exec) retval= opm->type->exec(C, opm); + OPERATOR_RETVAL_CHECK(retval); + BLI_movelisttolist(&op->reports->list, &opm->reports->list); if (retval & OPERATOR_FINISHED) { @@ -265,6 +268,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event) printf("macro error, calling NULL modal()\n"); else { retval = opm->type->modal(C, opm, event); + OPERATOR_RETVAL_CHECK(retval); /* if this one is done but it's not the last operator in the macro */ if ((retval & OPERATOR_FINISHED) && opm->next) { @@ -655,7 +659,9 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) printf("WM_menu_invoke: %s \"%s\" is not an enum property\n", op->type->idname, RNA_property_identifier(prop)); } else if (RNA_property_is_set(op->ptr, RNA_property_identifier(prop))) { - return op->type->exec(C, op); + const int retval= op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + return retval; } else { pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); @@ -2345,7 +2351,6 @@ static void gesture_circle_apply(bContext *C, wmOperator *op) if(op->type->exec) op->type->exec(C, op); - #ifdef GESTURE_MEMORY circle_select_size= rect->xmax; #endif @@ -2566,7 +2571,6 @@ static void gesture_lasso_apply(bContext *C, wmOperator *op) if(op->type->exec) op->type->exec(C, op); - } int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event) -- cgit v1.2.3 From 166970f68ea4949484e4e187b65972dca320484b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Aug 2011 17:01:33 +0000 Subject: bpy-rna - simplify enum string/set parsing. --- source/blender/python/intern/bpy_rna.c | 44 ++++++++++++++++------------------ 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 831d6a281ee..17992fdae31 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1117,6 +1117,7 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr return 1; } +/* 'value' _must_ be a set type, error check before calling */ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix) { /* set of enum items, concatenate all values with OR */ @@ -1138,8 +1139,10 @@ int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_ error_prefix, Py_TYPE(key)->tp_name); return -1; } - if(pyrna_enum_value_from_id(items, param, &ret, error_prefix) < 0) + + if(pyrna_enum_value_from_id(items, param, &ret, error_prefix) < 0) { return -1; + } flag |= ret; } @@ -1156,6 +1159,14 @@ static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObj *r_value= 0; + if (!PyAnySet_Check(value)) { + PyErr_Format(PyExc_TypeError, + "%.200s, %.200s.%.200s expected a set, not a %.200s", + error_prefix, RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop), Py_TYPE(value)->tp_name); + return -1; + } + RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free); if(item) { @@ -1529,33 +1540,18 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb { int val= 0; - if (PyUnicode_Check(value)) { - if (!pyrna_string_to_enum(value, ptr, prop, &val, error_prefix)) - return -1; - } - else if (PyAnySet_Check(value)) { - if(RNA_property_flag(prop) & PROP_ENUM_FLAG) { - /* set of enum items, concatenate all values with OR */ - if(pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) - return -1; - } - else { - PyErr_Format(PyExc_TypeError, - "%.200s, %.200s.%.200s is not a bitflag enum type", - error_prefix, RNA_struct_identifier(ptr->type), - RNA_property_identifier(prop)); + /* type checkins is done by each function */ + if(RNA_property_flag(prop) & PROP_ENUM_FLAG) { + /* set of enum items, concatenate all values with OR */ + if(pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) { return -1; } } else { - const char *enum_str= pyrna_enum_as_string(ptr, prop); - PyErr_Format(PyExc_TypeError, - "%.200s %.200s.%.200s expected a string enum or a set of strings in (%.2000s), not %.200s", - error_prefix, RNA_struct_identifier(ptr->type), - RNA_property_identifier(prop), enum_str, - Py_TYPE(value)->tp_name); - MEM_freeN((void *)enum_str); - return -1; + /* simple enum string */ + if (!pyrna_string_to_enum(value, ptr, prop, &val, error_prefix) < 0) { + return -1; + } } if(data) *((int*)data)= val; -- cgit v1.2.3 From 9436769cd45f1c63ef6764d86b1fbfefe408ad2f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Aug 2011 17:54:30 +0000 Subject: error when a python operator gave an incorrect return value was near useless, re-raise a more comprehensive error which includes the operator name. --- source/blender/python/intern/bpy_operator.c | 2 +- source/blender/python/intern/bpy_rna.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 7310878f661..742dce30124 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -293,7 +293,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) * function corrects bpy.data (internal Main pointer) */ BPY_modules_update(C); - /* needed for when WM_OT_read_factory_settings us called fro within a script */ + /* needed for when WM_OT_read_factory_settings us called from within a script */ bpy_import_main_set(CTX_data_main(C)); /* return operator_ret as a bpy enum */ diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 17992fdae31..a3ff4314002 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6417,7 +6417,21 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param err= -1; } else if(ret_len==1) { - err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:"); + err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, ""); + + /* when calling operator funcs only gives Function.result with + * no line number since the func has finished calling on error, + * re-raise the exception with more info since it would be slow to + * create prefix on every call (when there are no errors) */ + if(err == -1 && PyErr_Occurred()) { + PyObject *error_type, *error_value, *error_traceback; + PyErr_Fetch(&error_type, &error_value, &error_traceback); + + PyErr_Format(error_type, + "expected class %.200s, function %.200s: incompatible return value%S", + RNA_struct_identifier(ptr->type), RNA_function_identifier(func), + error_value); + } } else if (ret_len > 1) { -- cgit v1.2.3 From 291ae8822d5ff2fafbb53568c040828058cee0db Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Aug 2011 17:59:37 +0000 Subject: executing operators that changed the context from the console wasnt returning an operator set/flag. --- source/blender/python/intern/bpy_rna.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index a3ff4314002..b83626bc3e9 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6428,7 +6428,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param PyErr_Fetch(&error_type, &error_value, &error_traceback); PyErr_Format(error_type, - "expected class %.200s, function %.200s: incompatible return value%S", + "class %.200s, function %.200s: incompatible return value%S", RNA_struct_identifier(ptr->type), RNA_function_identifier(func), error_value); } -- cgit v1.2.3 From 566da261737731a2e58e8e3ab489c2823068ef2b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Aug 2011 01:32:07 +0000 Subject: file-selector: when converting operator arguments to the file selector, wasnt making paths absolute (abs paths are made relative when converting the other way). --- source/blender/editors/space_file/file_ops.c | 32 ++++++++++++++------------ source/blender/editors/space_image/image_ops.c | 8 +++---- source/blender/python/intern/bpy_operator.c | 1 - 3 files changed, 21 insertions(+), 20 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index a34335a031d..1b0893e50e0 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -657,25 +657,27 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) { - int change= FALSE; - if(RNA_struct_find_property(op->ptr, "filename")) { - RNA_string_get(op->ptr, "filename", sfile->params->file); - change= TRUE; - } - if(RNA_struct_find_property(op->ptr, "directory")) { - RNA_string_get(op->ptr, "directory", sfile->params->dir); - change= TRUE; - } - + PropertyRNA *prop; + /* If neither of the above are set, split the filepath back */ - if(RNA_struct_find_property(op->ptr, "filepath")) { - if(change==FALSE) { - char filepath[FILE_MAX]; - RNA_string_get(op->ptr, "filepath", filepath); - BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + if((prop= RNA_struct_find_property(op->ptr, "filepath"))) { + char filepath[FILE_MAX]; + RNA_property_string_get(op->ptr, prop, filepath); + BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + } + else { + if((prop= RNA_struct_find_property(op->ptr, "filename"))) { + RNA_property_string_get(op->ptr, prop, sfile->params->file); + } + if((prop= RNA_struct_find_property(op->ptr, "directory"))) { + RNA_property_string_get(op->ptr, prop, sfile->params->dir); } } + /* we could check for relative_path property which is used when converting + * in the other direction but doesnt hurt to do this every time */ + BLI_path_abs(sfile->params->dir, G.main->name); + /* XXX, files and dirs updates missing, not really so important though */ } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index d483dd45f7f..d58b78ff6a7 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -983,7 +983,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, /* unlikely but just incase */ if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) { - simopts->planes= 32; + simopts->planes= R_PLANES32; } /* some formats dont use quality so fallback to scenes quality */ @@ -1000,7 +1000,6 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, } BLI_path_abs(simopts->filepath, G.main->name); } - /* cleanup */ BKE_image_release_renderresult(scene, ima); } @@ -1026,6 +1025,7 @@ static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op) RNA_enum_set(op->ptr, "file_format", simopts->imtype); // RNA_enum_set(op->ptr, "subimtype", simopts->subimtype); RNA_int_set(op->ptr, "file_quality", simopts->quality); + RNA_string_set(op->ptr, "filepath", simopts->filepath); } @@ -1050,10 +1050,10 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI if(ima->type == IMA_TYPE_R_RESULT) { /* enforce user setting for RGB or RGBA, but skip BW */ - if(simopts->planes==32) { + if(simopts->planes==R_PLANES32) { ibuf->depth= 32; } - else if(simopts->planes==24) { + else if(simopts->planes==R_PLANES24) { ibuf->depth= 24; } } diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 742dce30124..7327679cc7e 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -117,7 +117,6 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) } context_dict_back= CTX_py_dict_get(C); - CTX_py_dict_set(C, (void *)context_dict); Py_XINCREF(context_dict); /* so we done loose it */ -- cgit v1.2.3 From e5ddaefecc1c6df3df15f22d6ce5609bb5c6cc3d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Aug 2011 06:22:12 +0000 Subject: when applying armature object transform now transform the bone roll too. This means you can import a BVH, rotate 90d and apply the rotation, the animation will still work as expected - thanks to Benjy's script for showing how obvious it is that this works :) --- source/blender/editors/armature/editarmature.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index bd8f431535e..451154ce842 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -494,15 +494,32 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) EditBone *ebone; bArmature *arm= ob->data; float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */ - + float mat3[3][3]; + + copy_m3_m4(mat3, mat); + normalize_m3(mat3); + /* Put the armature into editmode */ ED_armature_to_edit(ob); /* Do the rotations */ - for (ebone = arm->edbo->first; ebone; ebone=ebone->next){ + for (ebone = arm->edbo->first; ebone; ebone=ebone->next) { + float delta[3], tmat[3][3]; + + /* find the current bone's roll matrix */ + sub_v3_v3v3(delta, ebone->tail, ebone->head); + vec_roll_to_mat3(delta, ebone->roll, tmat); + + /* transform the roll matrix */ + mul_m3_m3m3(tmat, mat3, tmat); + + /* transform the bone */ mul_m4_v3(mat, ebone->head); mul_m4_v3(mat, ebone->tail); - + + /* apply the transfiormed roll back */ + mat3_to_vec_roll(tmat, delta, &ebone->roll); + ebone->rad_head *= scale; ebone->rad_tail *= scale; ebone->dist *= scale; -- cgit v1.2.3 From 1273a1133e13d5703d8ece8ac88ec2fa00cb2cf5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 26 Aug 2011 11:35:33 +0000 Subject: Fix #28370: border select for curve and metaball did not update number of selected vertices in info header. Patch by Julien Duroure, thanks! --- source/blender/editors/space_view3d/view3d_select.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index f241e640906..65914ead899 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1765,9 +1765,15 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) case OB_CURVE: case OB_SURF: ret= do_nurbs_box_select(&vc, &rect, select, extend); + if(ret & OPERATOR_FINISHED) { + WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data); + } break; case OB_MBALL: ret= do_meta_box_select(&vc, &rect, select, extend); + if(ret & OPERATOR_FINISHED) { + WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data); + } break; case OB_ARMATURE: ret= do_armature_box_select(&vc, &rect, select, extend); -- cgit v1.2.3 From cdbb904b32a859a1b3a65dbe79057248f4425832 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Fri, 26 Aug 2011 15:16:27 +0000 Subject: code review fixes --- source/blender/collada/AnimationExporter.cpp | 176 ++++++++++++--------------- source/blender/collada/AnimationImporter.cpp | 3 +- 2 files changed, 79 insertions(+), 100 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 2f074992076..bbd6fef803f 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -41,126 +41,104 @@ void forEachObjectInScene(Scene *sce, Functor &f) } void AnimationExporter::exportAnimations(Scene *sce) - { - if(hasAnimations(sce)) { - this->scene = sce; +{ + if(hasAnimations(sce)) { + this->scene = sce; - openLibrary(); + openLibrary(); - forEachObjectInScene(sce, *this); + forEachObjectInScene(sce, *this); - closeLibrary(); - } + closeLibrary(); } +} - // called for each exported object - void AnimationExporter::operator() (Object *ob) +// called for each exported object +void AnimationExporter::operator() (Object *ob) +{ + FCurve *fcu; + char * transformName ; + bool isMatAnim = false; + + //Export transform animations + if(ob->adt && ob->adt->action) { - FCurve *fcu; - char * transformName ; - bool isMatAnim = false; + fcu = (FCurve*)ob->adt->action->curves.first; - //Export transform animations - if(ob->adt && ob->adt->action) + //transform matrix export for bones are temporarily disabled here. + if ( ob->type == OB_ARMATURE ) { - fcu = (FCurve*)ob->adt->action->curves.first; - - //transform matrix export for bones are temporarily disabled here. - if ( ob->type == OB_ARMATURE ) - { - if (!ob->data) return; - bArmature *arm = (bArmature*)ob->data; - for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) - write_bone_animation_matrix(ob, bone); - - transformName = fcu->rna_path; - } - else - transformName = extract_transform_name( fcu->rna_path ); + bArmature *arm = (bArmature*)ob->data; + for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) + write_bone_animation_matrix(ob, bone); - while (fcu) { - transformName = extract_transform_name( fcu->rna_path ); - if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || - (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)|| - (!strcmp(transformName, "rotation_quaternion"))) - dae_animation(ob ,fcu, transformName, false); - fcu = fcu->next; - } - + transformName = fcu->rna_path; } - - //Export Lamp parameter animations - if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) - { - fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); - while (fcu) { + else transformName = extract_transform_name( fcu->rna_path ); - - if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))|| (!strcmp(transformName, "spot_blend"))|| - (!strcmp(transformName, "distance")) ) - dae_animation(ob , fcu, transformName, true ); - fcu = fcu->next; - } + + while (fcu) { + transformName = extract_transform_name( fcu->rna_path ); + if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || + (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)|| + (!strcmp(transformName, "rotation_quaternion"))) + dae_animation(ob ,fcu, transformName, false); + fcu = fcu->next; } + + } - //Export Camera parameter animations - if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) - { - fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); - while (fcu) { - transformName = extract_transform_name( fcu->rna_path ); - - if ((!strcmp(transformName, "lens"))|| - (!strcmp(transformName, "ortho_scale"))|| - (!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start"))) - dae_animation(ob , fcu, transformName, true ); - fcu = fcu->next; - } + //Export Lamp parameter animations + if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) + { + fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first); + while (fcu) { + transformName = extract_transform_name( fcu->rna_path ); + + if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))|| (!strcmp(transformName, "spot_blend"))|| + (!strcmp(transformName, "distance")) ) + dae_animation(ob , fcu, transformName, true ); + fcu = fcu->next; } + } - //Export Material parameter animations. - for(int a = 0; a < ob->totcol; a++) - { - Material *ma = give_current_material(ob, a+1); - if (!ma) continue; - if(ma->adt && ma->adt->action) - { - isMatAnim = true; - fcu = (FCurve*)ma->adt->action->curves.first; - while (fcu) { - transformName = extract_transform_name( fcu->rna_path ); - - if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color")) - ||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))|| - (!strcmp(transformName, "ior"))) - dae_animation(ob ,fcu, transformName, true, ma ); - fcu = fcu->next; - } - } + //Export Camera parameter animations + if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) + { + fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first); + while (fcu) { + transformName = extract_transform_name( fcu->rna_path ); + if ((!strcmp(transformName, "lens"))|| + (!strcmp(transformName, "ortho_scale"))|| + (!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start"))) + dae_animation(ob , fcu, transformName, true ); + fcu = fcu->next; } - /* Old System - if (!ob->adt || !ob->adt->action) - fcu = (FCurve*)((Lamp*)ob->data)->adt->action->curves.first; //this is already checked in hasAnimations() - else - fcu = (FCurve*)ob->adt->action->curves.first; - - if (ob->type == OB_ARMATURE) { - if (!ob->data) return; - bArmature *arm = (bArmature*)ob->data; - while(fcu) - { + } + + //Export Material parameter animations. + for(int a = 0; a < ob->totcol; a++) + { + Material *ma = give_current_material(ob, a+1); + if (!ma) continue; + if(ma->adt && ma->adt->action) + { + isMatAnim = true; + fcu = (FCurve*)ma->adt->action->curves.first; + while (fcu) { transformName = extract_transform_name( fcu->rna_path ); - // std::string ob_name = getObjectBoneName( ob , fcu); - // for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) - // write_bone_animation(ob, bone); - dae_animation(ob, fcu, ob_name, transformName); + + if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color")) + ||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))|| + (!strcmp(transformName, "ior"))) + dae_animation(ob ,fcu, transformName, true, ma ); fcu = fcu->next; } } - else {*/ } +} //euler sources from quternion sources float * AnimationExporter::get_eul_source_for_quat(Object *ob ) @@ -193,7 +171,7 @@ void AnimationExporter::exportAnimations(Scene *sce) eul[i*3 + k] = temp_eul[k]; } - + MEM_freeN(quat); return eul; } @@ -287,6 +265,8 @@ void AnimationExporter::exportAnimations(Scene *sce) for ( int i = 0 ; i< fcu->totvert ; i++) eul_axis[i] = eul[i*3 + fcu->array_index]; output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name); + MEM_freeN(eul); + MEM_freeN(eul_axis); } else { diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index ee04c270843..4a3cd5eeb06 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -179,7 +179,6 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) cu->bezt[i].vec[1][1] *= M_PI / 180.0f; cu->bezt[i].vec[0][1] *= M_PI / 180.0f; cu->bezt[i].vec[2][1] *= M_PI / 180.0f; - cu->bezt[i].vec[1][0]; } } @@ -439,7 +438,7 @@ void AnimationImporter::modify_fcurve(std::vector* curves , char* rna_p int i; for (it = curves->begin(), i = 0; it != curves->end(); it++, i++) { FCurve *fcu = *it; - fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path)); + fcu->rna_path = BLI_strdup(rna_path); if (array_index == -1) fcu->array_index = i; else fcu->array_index = array_index; -- cgit v1.2.3 From 1439ddccae91898812b3a040b35dedcb639894e5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 26 Aug 2011 16:38:23 +0000 Subject: Fix #28301: Sculpting a object with rotational have desface Patch from Juha Maki-Kanto - initgrabz was called with local space coord. - Brush radiu was multiplying by 2.0 for grab and snake brushes. Not sure why this was needed. Made some tests and didn't notice any regressions without this multiplication. --- source/blender/editors/sculpt_paint/sculpt.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index be985342ea8..2ee49f71a78 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2979,7 +2979,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush) SCULPT_TOOL_GRAB, SCULPT_TOOL_NUDGE, SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)) { - float grab_location[3], imat[4][4], delta[3]; + float grab_location[3], imat[4][4], delta[3], loc[3]; if(cache->first_time) { copy_v3_v3(cache->orig_grab_location, @@ -2989,10 +2989,8 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush) add_v3_v3(cache->true_location, cache->grab_delta); /* compute 3d coordinate at same z from original location + mouse */ - initgrabz(cache->vc->rv3d, - cache->orig_grab_location[0], - cache->orig_grab_location[1], - cache->orig_grab_location[2]); + mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location); + initgrabz(cache->vc->rv3d, loc[0], loc[1], loc[2]); ED_view3d_win_to_delta(cache->vc->ar, cache->mouse, grab_location); @@ -3088,9 +3086,6 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st else { cache->initial_radius= brush_unprojected_radius(brush); } - - if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK)) - cache->initial_radius *= 2.0f; } if(brush_use_size_pressure(brush)) { -- cgit v1.2.3 From 8a619a3eee0775d338e41763b219d661a6845dea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Aug 2011 17:55:03 +0000 Subject: fix for crash when running a python script in a non utf8 blend path, inspecting the exception for the path assumed utf8. --- source/blender/editors/armature/editarmature.c | 2 +- source/blender/python/intern/bpy_traceback.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 451154ce842..08f313bfadd 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -518,7 +518,7 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) mul_m4_v3(mat, ebone->tail); /* apply the transfiormed roll back */ - mat3_to_vec_roll(tmat, delta, &ebone->roll); + mat3_to_vec_roll(tmat, NULL, &ebone->roll); ebone->rad_head *= scale; ebone->rad_tail *= scale; diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c index 17f082b79dc..747a876d6df 100644 --- a/source/blender/python/intern/bpy_traceback.c +++ b/source/blender/python/intern/bpy_traceback.c @@ -30,9 +30,9 @@ #include "bpy_traceback.h" -static const char *traceback_filepath(PyTracebackObject *tb) +static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce) { - return _PyUnicode_AsString(tb->tb_frame->f_code->co_filename); + return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(tb->tb_frame->f_code->co_filename))); } /* copied from pythonrun.c, 3.2.0 */ @@ -146,7 +146,12 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset) PyErr_Print(); for(tb= (PyTracebackObject *)PySys_GetObject("last_traceback"); tb && (PyObject *)tb != Py_None; tb= tb->tb_next) { - if(strcmp(traceback_filepath(tb), filepath) != 0) { + PyObject *coerce; + const char *tb_filepath= traceback_filepath(tb, &coerce); + const int match= strcmp(tb_filepath, filepath) != 0; + Py_DECREF(coerce); + + if(match) { *lineno= tb->tb_lineno; break; } -- cgit v1.2.3 From a9dea3afe9ca590e3d2d6788066d52dab3fd872c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Aug 2011 18:48:48 +0000 Subject: correct missing bpy doc references. --- source/blender/python/intern/bpy_rna.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b83626bc3e9..4abcbc684e2 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6591,9 +6591,9 @@ void pyrna_free_types(void) PyDoc_STRVAR(pyrna_register_class_doc, ".. method:: register_class(cls)\n" "\n" -" Register a subclass of a blender type in (:class:`Panel`,\n" -" :class:`Menu`, :class:`Header`, :class:`Operator`,\n" -" :class:`KeyingSetInfo`, :class:`RenderEngine`).\n" +" Register a subclass of a blender type in (:class:`bpy.types.Panel`,\n" +" :class:`bpy.types.Menu`, :class:`bpy.types.Header`, :class:`bpy.types.Operator`,\n" +" :class:`bpy.types.KeyingSetInfo`, :class:`bpy.types.RenderEngine`).\n" "\n" " If the class has a *register* class method it will be called\n" " before registration.\n" -- cgit v1.2.3 From 722be28d68bee132f54c3bcd984caf274197c205 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Aug 2011 22:37:20 +0000 Subject: sub_v4_v4v4 was taking float[3] arguments. --- source/blender/blenlib/BLI_math_vector.h | 4 +- source/blender/blenlib/intern/math_vector_inline.c | 56 +++++++++++----------- 2 files changed, 30 insertions(+), 30 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index decfa22c3e6..c8b598a1e85 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -99,7 +99,7 @@ MINLINE float dot_v3v3(const float a[3], const float b[3]); MINLINE float cross_v2v2(const float a[2], const float b[2]); MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]); -MINLINE void star_m3_v3(float R[3][3],float a[3]); +MINLINE void star_m3_v3(float rmat[3][3],float a[3]); /*********************************** Length **********************************/ @@ -133,7 +133,7 @@ MINLINE int is_zero_v3(const float a[3]); MINLINE int is_zero_v4(const float a[4]); MINLINE int is_one_v3(const float a[3]); -MINLINE int equals_v2v2(const float *v1, const float *v2); +MINLINE int equals_v2v2(const float v1[2], const float v2[2]); MINLINE int equals_v3v3(const float a[3], const float b[3]); MINLINE int compare_v3v3(const float a[3], const float b[3], const float limit); MINLINE int compare_len_v3v3(const float a[3], const float b[3], const float limit); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index e2b7c770356..28708af7486 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -136,26 +136,26 @@ MINLINE void add_v3_v3(float *r, const float *a) r[2] += a[2]; } -MINLINE void add_v3_v3v3(float *r, const float *a, const float *b) +MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3]) { r[0]= a[0] + b[0]; r[1]= a[1] + b[1]; r[2]= a[2] + b[2]; } -MINLINE void sub_v2_v2(float *r, const float *a) +MINLINE void sub_v2_v2(float r[2], const float a[2]) { r[0] -= a[0]; r[1] -= a[1]; } -MINLINE void sub_v2_v2v2(float *r, const float *a, const float *b) +MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2]) { r[0]= a[0] - b[0]; r[1]= a[1] - b[1]; } -MINLINE void sub_v3_v3(float *r, const float *a) +MINLINE void sub_v3_v3(float r[3], const float a[3]) { r[0] -= a[0]; r[1] -= a[1]; @@ -177,7 +177,7 @@ MINLINE void sub_v4_v4(float r[4], const float a[4]) r[3] -= a[3]; } -MINLINE void sub_v4_v4v4(float r[3], const float a[3], const float b[3]) +MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]) { r[0]= a[0] - b[0]; r[1]= a[1] - b[1]; @@ -186,10 +186,10 @@ MINLINE void sub_v4_v4v4(float r[3], const float a[3], const float b[3]) } -MINLINE void mul_v2_fl(float *v1, float f) +MINLINE void mul_v2_fl(float r[2], float f) { - v1[0]*= f; - v1[1]*= f; + r[0]*= f; + r[1]*= f; } MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f) @@ -281,11 +281,11 @@ MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f) r[3] += a[3]*f; } -MINLINE void mul_v3_v3v3(float *v, const float *v1, const float *v2) +MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3]) { - v[0] = v1[0] * v2[0]; - v[1] = v1[1] * v2[1]; - v[2] = v1[2] * v2[2]; + r[0] = v1[0] * v2[0]; + r[1] = v1[1] * v2[1]; + r[2] = v1[2] * v2[2]; } MINLINE void negate_v3(float r[3]) @@ -340,15 +340,15 @@ MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]) r[2]= a[0]*b[1] - a[1]*b[0]; } -MINLINE void star_m3_v3(float mat[][3], float *vec) +MINLINE void star_m3_v3(float rmat[][3], float a[3]) { - mat[0][0]= mat[1][1]= mat[2][2]= 0.0; - mat[0][1]= -vec[2]; - mat[0][2]= vec[1]; - mat[1][0]= vec[2]; - mat[1][2]= -vec[0]; - mat[2][0]= -vec[1]; - mat[2][1]= vec[0]; + rmat[0][0]= rmat[1][1]= rmat[2][2]= 0.0; + rmat[0][1]= -a[2]; + rmat[0][2]= a[1]; + rmat[1][0]= a[2]; + rmat[1][2]= -a[0]; + rmat[2][0]= -a[1]; + rmat[2][1]= a[0]; } /*********************************** Length **********************************/ @@ -465,27 +465,27 @@ MINLINE int is_zero_v4(const float v[4]) return (v[0] == 0 && v[1] == 0 && v[2] == 0 && v[3] == 0); } -MINLINE int is_one_v3(const float *v) +MINLINE int is_one_v3(const float v[3]) { return (v[0] == 1 && v[1] == 1 && v[2] == 1); } -MINLINE int equals_v2v2(const float *v1, const float *v2) +MINLINE int equals_v2v2(const float v1[2], const float v2[2]) { return ((v1[0]==v2[0]) && (v1[1]==v2[1])); } -MINLINE int equals_v3v3(const float *v1, const float *v2) +MINLINE int equals_v3v3(const float v1[3], const float v2[3]) { return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2])); } -MINLINE int equals_v4v4(const float *v1, const float *v2) +MINLINE int equals_v4v4(const float v1[4], const float v2[4]) { return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2]) && (v1[3]==v2[3])); } -MINLINE int compare_v3v3(const float *v1, const float *v2, const float limit) +MINLINE int compare_v3v3(const float v1[3], const float v2[3], const float limit) { if(fabsf(v1[0]-v2[0]) Date: Sat, 27 Aug 2011 01:20:55 +0000 Subject: F3TOCHAR4 macro was assigning the same value twice (setting the alpha, then overwriting with 255). --- source/blender/blenlib/BLI_utildefines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 28ebb254f2a..f8f8e12b341 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -105,7 +105,7 @@ #define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f)) #define F3TOCHAR3(v2,v1) (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])) #define F3TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ - (v1)[3]=FTOCHAR((v2[3])); (v1)[3] = 255; } + (v1)[3] = 255; } #define F4TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ (v1)[3]=FTOCHAR((v2[3])); (v1)[3]=FTOCHAR((v2[3])); } -- cgit v1.2.3 From 2311e624d7717f1123abcf91882830e5dd841669 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 01:24:05 +0000 Subject: eek F4TOCHAR4 was assigning alpha twice too!, tsk tsk. --- source/blender/blenlib/BLI_utildefines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index f8f8e12b341..1a1f7be2471 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -107,7 +107,7 @@ #define F3TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ (v1)[3] = 255; } #define F4TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ - (v1)[3]=FTOCHAR((v2[3])); (v1)[3]=FTOCHAR((v2[3])); } + (v1)[3]=FTOCHAR((v2[3])); } #define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);} -- cgit v1.2.3 From 974a06823e3a2ac740f93243cefb0db6b5582dcb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 01:37:47 +0000 Subject: bge py api XK_GameObject.linVelocityMin was returning linVelocityMax. --- source/gameengine/Ketsji/KX_GameObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 7ca8e7e3b52..74652877e48 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1839,7 +1839,7 @@ PyObject* KX_GameObject::pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBU { KX_GameObject* self= static_cast(self_v); KX_IPhysicsController *spc = self->GetPhysicsController(); - return PyFloat_FromDouble(spc ? spc->GetLinVelocityMax() : 0.0f); + return PyFloat_FromDouble(spc ? spc->GetLinVelocityMin() : 0.0f); } int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -- cgit v1.2.3 From a05d4a729ae6ccf26a7ef5786fdfffde6d2cb5d4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 01:42:49 +0000 Subject: remove deprecated & unused mat3_to_vec_rot and mat4_to_vec_rot functions. --- source/blender/blenlib/BLI_math_rotation.h | 3 --- source/blender/blenlib/intern/math_rotation.c | 22 ---------------------- 2 files changed, 25 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index ee8c3d5e10c..ef20408a37e 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -107,9 +107,6 @@ void mat4_to_axis_angle(float axis[3], float *angle, float M[4][4]); /* TODO: the following calls should probably be depreceated sometime */ /* conversion */ -void mat3_to_vec_rot(float vec[3], float *phi, float mat[3][3]); -void mat4_to_vec_rot(float vec[3], float *phi, float mat[4][4]); - void vec_rot_to_quat(float quat[4], const float vec[3], const float phi); void vec_rot_to_mat3(float mat[3][3], const float vec[3], const float phi); void vec_rot_to_mat4(float mat[4][4], const float vec[3], const float phi); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index e3e507d016a..6800b59c2c7 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -774,28 +774,6 @@ void mat4_to_axis_angle(float axis[3], float *angle,float mat[4][4]) /****************************** Vector/Rotation ******************************/ /* TODO: the following calls should probably be depreceated sometime */ -/* 3x3 matrix to axis angle */ -void mat3_to_vec_rot(float axis[3], float *angle,float mat[3][3]) -{ - float q[4]; - - /* use quaternions as intermediate representation */ - // TODO: it would be nicer to go straight there... - mat3_to_quat(q,mat); - quat_to_axis_angle(axis, angle,q); -} - -/* 4x4 matrix to axis angle */ -void mat4_to_vec_rot(float axis[3], float *angle,float mat[4][4]) -{ - float q[4]; - - /* use quaternions as intermediate representation */ - // TODO: it would be nicer to go straight there... - mat4_to_quat(q,mat); - quat_to_axis_angle(axis, angle,q); -} - /* axis angle to 3x3 matrix */ void vec_rot_to_mat3(float mat[][3], const float vec[3], const float phi) { -- cgit v1.2.3 From 9ae67bf38036f15b39ba129bea61415d8cfb95ae Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 02:04:29 +0000 Subject: bugfix for procedural textures used as bumpmap with osa not rendering right, also remove redundant assignment. --- source/blender/render/intern/source/render_texture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index a4c1778c624..fbbb33d0172 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1789,7 +1789,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, const float adx[3] = {fabsf(dx[0]), fabsf(dx[1]), fabsf(dx[2])}; const float ady[3] = {fabsf(dy[0]), fabsf(dy[1]), fabsf(dy[2])}; du = MAX3(adx[0], adx[1], adx[2]); - dv = MAX3(ady[1], ady[1], ady[2]); + dv = MAX3(ady[0], ady[1], ady[2]); } } @@ -2358,7 +2358,6 @@ void do_material_tex(ShadeInput *shi) f1= shi->vn[0]; f2= shi->vn[1]; texres.nor[0]= f1*co_nor+f2*si; - texres.nor[1]= f2*co_nor-f1*si; f1= shi->vn[1]; f2= shi->vn[2]; texres.nor[1]= f1*co_nor+f2*si; -- cgit v1.2.3 From 95c56115705d6851f7fd726612e57483d608e962 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 02:45:35 +0000 Subject: subtraction on unsigned values didnt work as intended for copying ID's. --- source/blender/blenkernel/intern/library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 0b07f40cad6..76f114de97b 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -671,7 +671,7 @@ void *copy_libblock(void *rt) assert(idn != NULL); idn_len= MEM_allocN_len(idn); - if(idn_len - sizeof(ID) > 0) { + if((ssize_t)idn_len - (ssize_t)sizeof(ID) > 0) { /* signed to allow neg result */ cp= (char *)id; cpn= (char *)idn; memcpy(cpn+sizeof(ID), cp+sizeof(ID), idn_len - sizeof(ID)); -- cgit v1.2.3 From 70c955c48437b6387285e963bf8c6f7294700ca2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 02:59:43 +0000 Subject: remove deprecated & unused sequencer transform vars --- source/blender/blenkernel/intern/seqeffects.c | 5 ----- source/blender/makesdna/DNA_sequence_types.h | 5 ----- 2 files changed, 10 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 8c19b0c15c3..cf95692c8b4 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2029,16 +2029,11 @@ static void init_transform_effect(Sequence *seq) transform->ScalexIni = 1.0f; transform->ScaleyIni = 1.0f; - transform->ScalexFin = 1.0f; - transform->ScalexFin = 1.0f; transform->xIni=0.0f; - transform->xFin=0.0f; transform->yIni=0.0f; - transform->yFin=0.0f; transform->rotIni=0.0f; - transform->rotFin=0.0f; transform->interpolation=1; transform->percent=1; diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 3e7654bcf47..0dd0b9790ab 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -209,14 +209,9 @@ typedef struct GlowVars { typedef struct TransformVars { float ScalexIni; float ScaleyIni; - float ScalexFin; /* deprecated - old transform strip */ - float ScaleyFin; /* deprecated - old transform strip */ float xIni; - float xFin; /* deprecated - old transform strip */ float yIni; - float yFin; /* deprecated - old transform strip */ float rotIni; - float rotFin; /* deprecated - old transform strip */ int percent; int interpolation; int uniform_scale; /* preserve aspect/ratio when scaling */ -- cgit v1.2.3 From 94b3e83b6c564a66788624e824a2548d6c8b8650 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 03:13:54 +0000 Subject: fix for bug with all rotation modes being treated as euler by the BGE, this bug is in trunk too but fixing here because this code will replace whats in trunk. also make initializers less verbose for ipo transform assignment. --- source/gameengine/Converter/KX_IpoConvert.cpp | 30 +++++++-------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index 2793b8e9fdf..0ee99f5335b 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -91,41 +91,25 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B Object* blenderobject = gameobj->GetBlenderObject(); - ipocontr->GetIPOTransform().SetPosition( - MT_Point3( - blenderobject->loc[0]/*+blenderobject->dloc[0]*/, - blenderobject->loc[1]/*+blenderobject->dloc[1]*/, - blenderobject->loc[2]/*+blenderobject->dloc[2]*/ - ) - ); - ipocontr->GetIPOTransform().SetEulerAngles( - MT_Vector3( - blenderobject->rot[0], - blenderobject->rot[1], - blenderobject->rot[2] - ) - ); - ipocontr->GetIPOTransform().SetScaling( - MT_Vector3( - blenderobject->size[0], - blenderobject->size[1], - blenderobject->size[2] - ) - ); + ipocontr->GetIPOTransform().SetPosition(MT_Point3(blenderobject->loc)); + ipocontr->GetIPOTransform().SetEulerAngles(MT_Vector3(blenderobject->rot)); + ipocontr->GetIPOTransform().SetScaling(MT_Vector3(blenderobject->size)); const char *rotmode, *drotmode; - switch(blenderobject->rotmode) - { + switch(blenderobject->rotmode) { case ROT_MODE_AXISANGLE: rotmode = "rotation_axis_angle"; drotmode = "delta_rotation_axis_angle"; + break; case ROT_MODE_QUAT: rotmode = "rotation_quaternion"; drotmode = "delta_rotation_quaternion"; + break; default: rotmode = "rotation_euler"; drotmode = "delta_rotation_euler"; + break; } BL_InterpolatorList *adtList= GetAdtList(action, converter); -- cgit v1.2.3 From 555f6cbe08db7c44ed4c6604f256a055b465d769 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 27 Aug 2011 03:19:46 +0000 Subject: BGE: Post drawing callbacks are now done per viewport instead of per scene. This is handy for things like having a different HUD for each player in a splitscreen game. To figure out what viewport you're drawing too, check the scene's active_camera. --- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 0aa36b4cd5f..f41e0c16457 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -862,6 +862,8 @@ void KX_KetsjiEngine::Render() { if((*it)->GetViewport()) { + // Change the active camera so Python scripts can figure out what viewport they're in + scene->SetActiveCamera(*it); if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -873,6 +875,10 @@ void KX_KetsjiEngine::Render() it++; } + + // Now change the camera back + scene->SetActiveCamera(cam); + PostRenderScene(scene); } @@ -1315,6 +1321,10 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) if (scene->GetPhysicsEnvironment()) scene->GetPhysicsEnvironment()->debugDrawWorld(); + +#ifdef WITH_PYTHON + scene->RunDrawingCallbacks(scene->GetPostDrawCB()); +#endif } void KX_KetsjiEngine::RenderFonts(KX_Scene* scene) @@ -1336,9 +1346,6 @@ void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene) { m_rendertools->MotionBlur(m_rasterizer); scene->Render2DFilters(m_canvas); -#ifdef WITH_PYTHON - scene->RunDrawingCallbacks(scene->GetPostDrawCB()); -#endif m_rasterizer->FlushDebugLines(); } -- cgit v1.2.3 From 69260601851bfcf1193b95950e37abf1d662b0a4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 03:20:32 +0000 Subject: - fix for BL_Shader::SetUniform() missing out the last part of the matrix. - particle.c wasn't setting all components of the vector when reading cache and setting dummy velocity values. - some functions incorrectly took a float[3] argument when the 4th value was set. - remove a few redundant lines of code. --- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/editors/physics/physics_pointcache.c | 1 - source/blender/editors/sculpt_paint/paint_image.c | 4 ++-- source/blender/editors/space_view3d/drawarmature.c | 5 +---- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/gpu/intern/gpu_material.c | 2 +- source/gameengine/Ketsji/BL_Shader.cpp | 2 +- 8 files changed, 8 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index dff62b05bd3..5bdda8d5867 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3134,7 +3134,7 @@ int object_is_modified(Scene *scene, Object *ob) int flag= 0; if(ob_get_key(ob)) { - flag |= eModifierMode_Render | eModifierMode_Render; + flag |= eModifierMode_Render; } else { ModifierData *md; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 9aa1c6e29eb..86c646fa257 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3161,7 +3161,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf } else { ca->vel[0] = ca->vel[1] = 0.0f; - ca->vel[1] = 1.0f; + ca->vel[2] = 1.0f; } /* selection coloring in edit mode */ diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 797ead3cd90..34f4a1e472b 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -172,7 +172,6 @@ void PTCACHE_OT_free_bake_all(wmOperatorType *ot) { /* identifiers */ ot->name= "Free All Physics Bakes"; - ot->name= "Free all physics bakes"; ot->idname= "PTCACHE_OT_free_bake_all"; /* api callbacks */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 32004fd4525..d69c1d9c447 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -512,7 +512,7 @@ static float VecZDepthOrtho(float pt[2], float v1[3], float v2[3], float v3[3], return (v1[2]*w[0]) + (v2[2]*w[1]) + (v3[2]*w[2]); } -static float VecZDepthPersp(float pt[2], float v1[3], float v2[3], float v3[3], float w[3]) +static float VecZDepthPersp(float pt[2], float v1[4], float v2[4], float v3[4], float w[3]) { float wtot_inv, wtot; float w_tmp[3]; @@ -1193,7 +1193,7 @@ static void screen_px_from_ortho( * the perspective W coord for each vert */ static void screen_px_from_persp( float uv[2], - float v1co[3], float v2co[3], float v3co[3], /* screenspace coords */ + float v1co[4], float v2co[4], float v3co[4], /* screenspace coords */ float uv1co[2], float uv2co[2], float uv3co[2], float pixelScreenCo[4], float w[3]) diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index ad621257602..103a03eece2 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -316,11 +316,9 @@ static float cube[8][3] = { static void drawsolidcube_size(float xsize, float ysize, float zsize) { static GLuint displist=0; - float n[3]; + float n[3]= {0.0f}; glScalef(xsize, ysize, zsize); - - n[0]=0; n[1]=0; n[2]=0; if(displist==0) { displist= glGenLists(1); @@ -346,7 +344,6 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize) n[2]= 1.0; glNormal3fv(n); glVertex3fv(cube[1]); glVertex3fv(cube[5]); glVertex3fv(cube[6]); glVertex3fv(cube[2]); - n[2]=0; n[2]= -1.0; glNormal3fv(n); glVertex3fv(cube[7]); glVertex3fv(cube[4]); glVertex3fv(cube[0]); glVertex3fv(cube[3]); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 70659994c55..05159414975 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -833,7 +833,7 @@ static int select_edgeloop(Scene *scene, Image *ima, EditMesh *em, NearestHit *h if(extend) { tf= CustomData_em_get(&em->fdata, hit->efa->data, CD_MTFACE); - if(uvedit_uv_selected(scene, hit->efa, tf, hit->edge) && uvedit_uv_selected(scene, hit->efa, tf, hit->edge)) + if(uvedit_uv_selected(scene, hit->efa, tf, hit->edge)) select= 0; else select= 1; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 28624e9350c..15b96b6d808 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -358,7 +358,7 @@ void GPU_material_enable_alpha(GPUMaterial *material) material->alpha= 1; } -GPUBlendMode GPU_material_blend_mode(GPUMaterial *material, float obcol[3]) +GPUBlendMode GPU_material_blend_mode(GPUMaterial *material, float obcol[4]) { if(material->alpha || (material->obcolalpha && obcol[3] < 1.0f)) return GPU_BLEND_ALPHA; diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 621cabfe0cf..aea33246a3f 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -690,7 +690,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Matrix3x3& vec, bool transpose) float value[9]; value[0] = (float)vec[0][0]; value[1] = (float)vec[1][0]; value[2] = (float)vec[2][0]; value[3] = (float)vec[0][1]; value[4] = (float)vec[1][1]; value[5] = (float)vec[2][1]; - value[6] = (float)vec[0][2]; value[7] = (float)vec[1][2]; value[7] = (float)vec[2][2]; + value[6] = (float)vec[0][2]; value[7] = (float)vec[1][2]; value[8] = (float)vec[2][2]; glUniformMatrix3fvARB(uniform, 1, transpose?GL_TRUE:GL_FALSE, value); } } -- cgit v1.2.3 From c96f28a718b0c94b52781cc91d384d2aeedf8c02 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 03:25:02 +0000 Subject: - use %u rather tham %d for unsigned ints in string formatting funcs. - replace (strlen(str) == 0) with str[0]=='\0' --- source/blender/blenkernel/intern/mesh_validate.c | 52 +++++++++++----------- source/blender/blenkernel/intern/pointcache.c | 10 ++--- source/blender/blenloader/intern/readblenentry.c | 2 +- source/blender/blenloader/intern/readfile.c | 6 +-- source/blender/editors/animation/anim_markers.c | 2 +- source/blender/editors/animation/fmodifier_ui.c | 2 +- source/blender/editors/object/object_modifier.c | 2 +- source/blender/gpu/intern/gpu_codegen.c | 2 +- .../blender/imbuf/intern/dds/DirectDrawSurface.cpp | 16 +++---- source/blender/imbuf/intern/tiff.c | 2 +- source/blender/makesrna/intern/makesrna.c | 34 +++++++------- source/blender/makesrna/intern/rna_define.c | 2 +- source/gameengine/GameLogic/SCA_RandomActuator.cpp | 2 +- source/gameengine/VideoTexture/Exception.cpp | 2 +- 14 files changed, 68 insertions(+), 68 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 34618a19ae9..9c916d517c5 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -80,7 +80,7 @@ static void edge_store_from_mface_quad(EdgeUUID es[4], MFace *mf) edge_store_assign(es[3].verts, mf->v4, mf->v1); } -static void edge_store_from_mface_tri(EdgeUUID es[3], MFace *mf) +static void edge_store_from_mface_tri(EdgeUUID es[4], MFace *mf) { edge_store_assign(es[0].verts, mf->v1, mf->v2); edge_store_assign(es[1].verts, mf->v2, mf->v3); @@ -143,30 +143,30 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve BLI_assert(!(do_fixes && me == NULL)); - PRINT("ED_mesh_validate: verts(%d), edges(%d), faces(%d)\n", totvert, totedge, totface); + PRINT("ED_mesh_validate: verts(%u), edges(%u), faces(%u)\n", totvert, totedge, totface); if(totedge == 0 && totface != 0) { - PRINT(" locical error, %d faces and 0 edges\n", totface); + PRINT(" locical error, %u faces and 0 edges\n", totface); do_edge_recalc= TRUE; } for(i=0, med= medges; iv1 == med->v2) { - PRINT(" edge %d: has matching verts, both %d\n", i, med->v1); + PRINT(" edge %u: has matching verts, both %u\n", i, med->v1); remove= do_fixes; } if(med->v1 >= totvert) { - PRINT(" edge %d: v1 index out of range, %d\n", i, med->v1); + PRINT(" edge %u: v1 index out of range, %u\n", i, med->v1); remove= do_fixes; } if(med->v2 >= totvert) { - PRINT(" edge %d: v2 index out of range, %d\n", i, med->v2); + PRINT(" edge %u: v2 index out of range, %u\n", i, med->v2); remove= do_fixes; } if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) { - PRINT(" edge %d: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2))); + PRINT(" edge %u: is a duplicate of, %u\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2))); remove= do_fixes; } @@ -187,41 +187,41 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve do { fv[fidx]= *(&(mf->v1) + fidx); if(fv[fidx] >= totvert) { - PRINT(" face %d: 'v%d' index out of range, %d\n", i, fidx + 1, fv[fidx]); + PRINT(" face %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]); remove= do_fixes; } } while (fidx--); if(remove == FALSE) { if(mf->v4) { - if(mf->v1 == mf->v2) { PRINT(" face %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; } - if(mf->v1 == mf->v3) { PRINT(" face %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes; } - if(mf->v1 == mf->v4) { PRINT(" face %d: verts invalid, v1/v4 both %d\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v2) { PRINT(" face %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v3) { PRINT(" face %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v4) { PRINT(" face %u: verts invalid, v1/v4 both %u\n", i, mf->v1); remove= do_fixes; } - if(mf->v2 == mf->v3) { PRINT(" face %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes; } - if(mf->v2 == mf->v4) { PRINT(" face %d: verts invalid, v2/v4 both %d\n", i, mf->v2); remove= do_fixes; } + if(mf->v2 == mf->v3) { PRINT(" face %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; } + if(mf->v2 == mf->v4) { PRINT(" face %u: verts invalid, v2/v4 both %u\n", i, mf->v2); remove= do_fixes; } - if(mf->v3 == mf->v4) { PRINT(" face %d: verts invalid, v3/v4 both %d\n", i, mf->v3); remove= do_fixes; } + if(mf->v3 == mf->v4) { PRINT(" face %u: verts invalid, v3/v4 both %u\n", i, mf->v3); remove= do_fixes; } } else { - if(mf->v1 == mf->v2) { PRINT(" faceT %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; } - if(mf->v1 == mf->v3) { PRINT(" faceT %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v2) { PRINT(" faceT %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v3) { PRINT(" faceT %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; } - if(mf->v2 == mf->v3) { PRINT(" faceT %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes; } + if(mf->v2 == mf->v3) { PRINT(" faceT %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; } } if(remove == FALSE) { if(totedge) { if(mf->v4) { - if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; } - if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; } - if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT(" face %d: edge v3/v4 (%d,%d) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; } - if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT(" face %d: edge v4/v1 (%d,%d) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT(" face %u: edge v3/v4 (%u,%u) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT(" face %u: edge v4/v1 (%u,%u) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; } } else { - if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; } - if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; } - if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT(" face %d: edge v3/v1 (%d,%d) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT(" face %u: edge v3/v1 (%u,%u) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; } } } @@ -261,10 +261,10 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve if(do_verbose) { mf_prev= mfaces + sf_prev->index; if(mf->v4) { - PRINT(" face %d & %d: are duplicates (%d,%d,%d,%d) (%d,%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4); + PRINT(" face %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4); } else { - PRINT(" face %d & %d: are duplicates (%d,%d,%d) (%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3); + PRINT(" face %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3); } } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index b8f4b2d302f..0f0afe30392 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -967,12 +967,12 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p if(pid->cache->flag & PTCACHE_EXTERNAL) { if(pid->cache->index >= 0) - snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ + snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ else snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */ } else { - snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ + snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ } len += 16; } @@ -2002,7 +2002,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) if (dir==NULL) return; - snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index); + snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2204,7 +2204,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (dir==NULL) return; - snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index); + snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2904,7 +2904,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) return; } - snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index); + snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); /* put new name into cache */ strcpy(pid->cache->name, to); diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 4ce5685ff18..31b3724e9f6 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -115,7 +115,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) buf[2]= buf[2]?buf[2]:' '; buf[3]= buf[3]?buf[3]:' '; - fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (long int)bhead->len+sizeof(BHead)); + fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (long int)(bhead->len+sizeof(BHead))); } } fprintf(fp, "]\n"); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0e99b357054..f3b478b90f9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10063,7 +10063,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) * to have them show in RNA viewer and accessible otherwise. */ for(ma= main->mat.first; ma; ma= ma->id.next) { - if(ma->nodetree && strlen(ma->nodetree->id.name)==0) + if(ma->nodetree && ma->nodetree->id.name[0] == '\0') strcpy(ma->nodetree->id.name, "NTShader Nodetree"); /* which_output 0 is now "not specified" */ @@ -10077,7 +10077,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* and composit trees */ for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->nodetree && strlen(sce->nodetree->id.name)==0) + if(sce->nodetree && sce->nodetree->id.name[0] == '\0') strcpy(sce->nodetree->id.name, "NTCompositing Nodetree"); /* move to cameras */ @@ -10099,7 +10099,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bNode *node; if(tx->nodetree) { - if(strlen(tx->nodetree->id.name)==0) + if(tx->nodetree->id.name[0] == '\0') strcpy(tx->nodetree->id.name, "NTTexture Nodetree"); /* which_output 0 is now "not specified" */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index b3338396598..f561bdc6183 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -339,7 +339,7 @@ void debug_markers_print_list(ListBase *markers) printf("List of markers follows: -----\n"); for (marker = markers->first; marker; marker = marker->next) { - printf("\t'%s' on %d at %p with %d\n", marker->name, marker->frame, (void *)marker, marker->flag); + printf("\t'%s' on %d at %p with %u\n", marker->name, marker->frame, (void *)marker, marker->flag); } printf("End of list ------------------\n"); diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 954928fc486..718188d5800 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -162,7 +162,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s if (i == 1) strcpy(xval, "x"); else - sprintf(xval, "x^%d", i); + sprintf(xval, "x^%u", i); uiDefBut(block, LABEL, 1, xval, 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "Power of x"); } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 2ac9161ffa3..c96d7c1fd10 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1280,7 +1280,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if(mmd->bindcagecos) { - if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos); + MEM_freeN(mmd->bindcagecos); if(mmd->dyngrid) MEM_freeN(mmd->dyngrid); if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences); if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 470b99de00b..910576fa34e 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -291,7 +291,7 @@ static void gpu_parse_functions_string(GHash *hash, char *code) } } - if(strlen(function->name) == 0 || function->totparam == 0) { + if(function->name[0] == '\0' || function->totparam == 0) { fprintf(stderr, "GPU functions parse error.\n"); MEM_freeN(function); break; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 971658ff482..44e029bd7ce 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -1426,12 +1426,12 @@ void DirectDrawSurface::printInfo() const if (header.flags & DDSD_LINEARSIZE) printf("\tDDSD_LINEARSIZE\n"); if (header.flags & DDSD_MIPMAPCOUNT) printf("\tDDSD_MIPMAPCOUNT\n"); - printf("Height: %d\n", header.height); - printf("Width: %d\n", header.width); - printf("Depth: %d\n", header.depth); - if (header.flags & DDSD_PITCH) printf("Pitch: %d\n", header.pitch); - else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %d\n", header.pitch); - printf("Mipmap count: %d\n", header.mipmapcount); + printf("Height: %u\n", header.height); + printf("Width: %u\n", header.width); + printf("Depth: %u\n", header.depth); + if (header.flags & DDSD_PITCH) printf("Pitch: %u\n", header.pitch); + else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %u\n", header.pitch); + printf("Mipmap count: %u\n", header.mipmapcount); printf("Pixel Format:\n"); printf("\tFlags: 0x%.8X\n", header.pf.flags); @@ -1468,7 +1468,7 @@ void DirectDrawSurface::printInfo() const } else { - printf("\tBit count: %d\n", header.pf.bitcount); + printf("\tBit count: %u\n", header.pf.bitcount); } printf("\tRed mask: 0x%.8X\n", header.pf.rmask); @@ -1522,7 +1522,7 @@ void DirectDrawSurface::printInfo() const if (header.reserved[7] == FOURCC_UVER) { - printf("User Version: %d\n", header.reserved[8]); + printf("User Version: %u\n", header.reserved[8]); } } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 36130aa0dbf..7beb853fe62 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -646,7 +646,7 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int } } else - printf("imb_loadtiff: mipmap level %d has unexpected size %dx%d instead of %dx%d\n", ibuf->miplevel, width, height, ibuf->x, ibuf->y); + printf("imb_loadtiff: mipmap level %d has unexpected size %ux%u instead of %dx%d\n", ibuf->miplevel, width, height, ibuf->x, ibuf->y); } else printf("imb_loadtiff: could not find mipmap level %d\n", ibuf->miplevel); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 7da538e171b..d47abced85e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -569,7 +569,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(prop->flag & PROP_DYNAMIC) fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop)); else - fprintf(f, "void %s(PointerRNA *ptr, %s values[%d])\n", func, rna_type_type(prop), prop->totarraylength); + fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength); fprintf(f, "{\n"); if(manualfunc) { @@ -587,7 +587,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr } else { fprintf(f, " int i;\n\n"); - fprintf(f, " for(i=0; i<%d; i++) {\n", prop->totarraylength); + fprintf(f, " for(i=0; i<%u; i++) {\n", prop->totarraylength); } if(dp->dnaarraylength == 1) { @@ -783,7 +783,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(prop->flag & PROP_DYNAMIC) fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop)); else - fprintf(f, "void %s(PointerRNA *ptr, const %s values[%d])\n", func, rna_type_type(prop), prop->totarraylength); + fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength); fprintf(f, "{\n"); if(manualfunc) { @@ -803,7 +803,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr else { fprintf(f, " int i;\n\n"); rna_clamp_value_range(f, prop); - fprintf(f, " for(i=0; i<%d; i++) {\n", prop->totarraylength); + fprintf(f, " for(i=0; i<%u; i++) {\n", prop->totarraylength); } if(dp->dnaarraylength == 1) { @@ -1324,7 +1324,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR //fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func); } else if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "void %sget(PointerRNA *ptr, int values[%d]);\n", func, prop->totarraylength); + fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength); //fprintf(f, "void %sset(PointerRNA *ptr, const int values[%d]);\n", func, prop->arraylength); } else { @@ -1339,7 +1339,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR //fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func); } else if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "void %sget(PointerRNA *ptr, float values[%d]);\n", func, prop->totarraylength); + fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength); //fprintf(f, "void %sset(PointerRNA *ptr, const float values[%d]);\n", func, prop->arraylength); } else { @@ -1420,21 +1420,21 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property if(!prop->arraydimension) fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_ENUM: { @@ -1495,21 +1495,21 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe if(!prop->arraydimension) fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_ENUM: { @@ -2028,7 +2028,7 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier); if(!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension) - fprintf(f, "%s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength); + fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength); else fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier); @@ -2129,7 +2129,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); + fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for(i=0; itotarraylength; i++) { if(bprop->defaultarray) @@ -2149,7 +2149,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); + fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for(i=0; itotarraylength; i++) { if(iprop->defaultarray) @@ -2169,7 +2169,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "static float rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); + fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for(i=0; itotarraylength; i++) { if(fprop->defaultarray) @@ -2200,7 +2200,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_print_c_string(f, prop->name); fprintf(f, ",\n\t"); rna_print_c_string(f, prop->description); fprintf(f, ",\n\t"); fprintf(f, "%d,\n", prop->icon); - fprintf(f, "\t%s, %s|%s, %s, %d, {%d, %d, %d}, %d,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength); + fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength); fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable)); if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 8e9c7e287d6..758ddc9ac6a 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1049,7 +1049,7 @@ void RNA_def_property_array(PropertyRNA *prop, int length) } if(prop->arraydimension > 1) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array dimensions has been set to %d but would be overwritten as 1.\n", srna->identifier, prop->identifier, prop->arraydimension); + 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); DefRNA.error= 1; return; } diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 3a6b00198e1..d76f3f775a5 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -152,7 +152,7 @@ bool SCA_RandomActuator::Update() /* If x_1, x_2, ... is a sequence of random numbers with uniform */ /* distribution between zero and one, k is the first integer for */ /* which the product x_1*x_2*...*x_k < exp(-\lamba). */ - float a = 0.0, b = 0.0; + float a, b; int res = 0; /* The - sign is important here! The number to test for, a, must be */ /* between 0 and 1. */ diff --git a/source/gameengine/VideoTexture/Exception.cpp b/source/gameengine/VideoTexture/Exception.cpp index 8c8258585a5..fc316f1c3f0 100644 --- a/source/gameengine/VideoTexture/Exception.cpp +++ b/source/gameengine/VideoTexture/Exception.cpp @@ -105,7 +105,7 @@ Exception::Exception (ExceptionID & expID, RESULT rslt, const char * fil, int li : m_expID (&expID), m_hRslt (rslt) { // set file and line - if (strlen(fil) > 0 || lin > 0) + if (fil[0] != '\0' || lin > 0) setFileLine (fil, lin); } -- cgit v1.2.3 From ca1e9d2c1812ac518aac5a8ec7df4baea56918d2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 03:34:11 +0000 Subject: replace octal 0177 with 127 to be more clear, no functional change. --- source/blender/avi/intern/avi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index ff3aafbf065..8ad751a5b40 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -87,17 +87,17 @@ unsigned int GET_TCC (FILE *fp) { } char *fcc_to_char (unsigned int fcc) { - DEBUG_FCC[0]= (fcc)&0177; - DEBUG_FCC[1]= (fcc>>8)&0177; - DEBUG_FCC[2]= (fcc>>16)&0177; - DEBUG_FCC[3]= (fcc>>24)&0177; + DEBUG_FCC[0]= (fcc)&127; + DEBUG_FCC[1]= (fcc>>8)&127; + DEBUG_FCC[2]= (fcc>>16)&127; + DEBUG_FCC[3]= (fcc>>24)&127; return DEBUG_FCC; } char *tcc_to_char (unsigned int tcc) { - DEBUG_FCC[0]= (tcc)&0177; - DEBUG_FCC[1]= (tcc>>8)&0177; + DEBUG_FCC[0]= (tcc)&127; + DEBUG_FCC[1]= (tcc>>8)&127; DEBUG_FCC[2]= 0; DEBUG_FCC[3]= 0; -- cgit v1.2.3 From cd0e92c5b7b5fb12f07305101fdba45a5cd10e9c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 07:06:44 +0000 Subject: fix for building with msvc, ssize_t is more correct but in this case its not going to give issues. --- source/blender/blenkernel/intern/library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 76f114de97b..4d158a6c26c 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -671,7 +671,7 @@ void *copy_libblock(void *rt) assert(idn != NULL); idn_len= MEM_allocN_len(idn); - if((ssize_t)idn_len - (ssize_t)sizeof(ID) > 0) { /* signed to allow neg result */ + if((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */ cp= (char *)id; cpn= (char *)idn; memcpy(cpn+sizeof(ID), cp+sizeof(ID), idn_len - sizeof(ID)); -- cgit v1.2.3 From a347f0267b70c35e33d25c05df4a89fa7a95dd04 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 27 Aug 2011 11:41:48 +0000 Subject: Fix [#28341] writing }(alt+n) in text editor creates a new file Change hotkey for new textblock to Ctrl-N. --- source/blender/editors/space_text/space_text.c | 2 +- source/blender/editors/space_text/text_ops.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 550f2c937fd..c7d4d78422e 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -274,7 +274,7 @@ static void text_keymap(struct wmKeyConfig *keyconf) RNA_string_set(kmi->ptr, "data_path", "space_data.font_size"); RNA_boolean_set(kmi->ptr, "reverse", 1); - WM_keymap_add_item(keymap, "TEXT_OT_new", NKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "TEXT_OT_new", NKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "TEXT_OT_open", OKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "TEXT_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "TEXT_OT_save", SKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 13eb24ed1f2..617bbf62e92 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -192,11 +192,12 @@ static int new_exec(bContext *C, wmOperator *UNUSED(op)) void TEXT_OT_new(wmOperatorType *ot) { /* identifiers */ - ot->name= "New"; + ot->name= "Create Text Block"; ot->idname= "TEXT_OT_new"; ot->description= "Create a new text data block"; /* api callbacks */ + ot->invoke= WM_operator_confirm; ot->exec= new_exec; ot->poll= text_new_poll; -- cgit v1.2.3 From 01230b137438881d2bdd9f651143880c84b85bf1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 11:52:59 +0000 Subject: fix [#28373] "Lock camera to view" doew not work with 3D-mouse --- source/blender/editors/include/ED_view3d.h | 4 +-- source/blender/editors/space_view3d/view3d_edit.c | 35 +++++++++++++++++------ 2 files changed, 29 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index dfe0a304748..f8682d3935b 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -288,7 +288,7 @@ unsigned int ED_viewedit_datamask(struct bScreen *screen); int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the camera to the view before starting a view transformation */ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); -/* copy the view to the camera */ -void ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); +/* copy the view to the camera, return TRUE if */ +int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0e8dd38c02c..e9ed5dac3de 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -97,7 +97,8 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) } } -void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) +/* return TRUE if the camera is moved */ +int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) { if(ED_view3d_camera_lock_check(v3d, rv3d)) { Object *root_parent; @@ -132,6 +133,11 @@ void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera); } + + return TRUE; + } + else { + return FALSE; } } @@ -944,17 +950,22 @@ void ndof_to_quat(struct wmNDOFMotionData* ndof, float q[4]) axis_angle_to_quat(q, axis, angle); } +/* -- "orbit" navigation (trackball/turntable) + * -- zooming + * -- panning in rotationally-locked views + */ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) -// -- "orbit" navigation (trackball/turntable) -// -- zooming -// -- panning in rotationally-locked views { - if (event->type != NDOF_MOTION) + if (event->type != NDOF_MOTION) { return OPERATOR_CANCELLED; + } else { + View3D *v3d= CTX_wm_view3d(C); RegionView3D* rv3d = CTX_wm_region_view3d(C); wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata; + ED_view3d_camera_lock_init(v3d, rv3d); + rv3d->rot_angle = 0.f; // off by default, until changed later this function if (ndof->progress != P_FINISHING) { @@ -1064,6 +1075,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event } } + ED_view3d_camera_lock_sync(v3d, rv3d); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; @@ -1085,16 +1098,20 @@ void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot) ot->flag = 0; } +/* -- "pan" navigation + * -- zoom or dolly? + */ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) -// -- "pan" navigation -// -- zoom or dolly? { - if (event->type != NDOF_MOTION) + if (event->type != NDOF_MOTION) { return OPERATOR_CANCELLED; + } else { + View3D *v3d= CTX_wm_view3d(C); RegionView3D* rv3d = CTX_wm_region_view3d(C); wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata; + ED_view3d_camera_lock_init(v3d, rv3d); rv3d->rot_angle = 0.f; // we're panning here! so erase any leftover rotation from other operators @@ -1141,6 +1158,8 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) sub_v3_v3(rv3d->ofs, pan_vec); } + ED_view3d_camera_lock_sync(v3d, rv3d); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; -- cgit v1.2.3 From 4684df08304135fdd2cbe1dc22d2658b24f83d1f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 02:04:40 +0000 Subject: fix [#28388] Clouds at high depth give artifacts. http://projects.blender.org/tracker/download.php/9/498/28388/17476/screen_bad.png --- source/blender/blenlib/intern/noise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 5d80edebbef..40289090a28 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -920,7 +920,7 @@ static float g[512+2][3]= { t = vec[i] + 10000.; \ b0 = ((int)t) & 255; \ b1 = (b0+1) & 255; \ - r0 = t - (int)t; \ + r0 = t - floorf(t); \ r1 = r0 - 1.; -- cgit v1.2.3 From 81ea1e7fcb4a746e4ecd4349cc9fba1eb1dcec70 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 02:54:26 +0000 Subject: remove implicit casts to doubles in the noise code, also use floating point math functions rather then double since the noise functions range is already limited by casting to ints in many places. - gives a very small speedup. --- source/blender/blenlib/intern/noise.c | 132 +++++++++++++++++----------------- 1 file changed, 66 insertions(+), 66 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 40289090a28..9bc666dc971 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -251,7 +251,7 @@ static float newPerlin(float x, float y, float z) /* for use with BLI_gNoise()/BLI_gTurbulence(), returns unsigned improved perlin noise */ static float newPerlinU(float x, float y, float z) { - return (0.5+0.5*newPerlin(x, y, z)); + return (0.5f+0.5f*newPerlin(x, y, z)); } @@ -278,12 +278,12 @@ static float orgBlenderNoise(float x, float y, float z) cn1=ox*ox; cn2=oy*oy; cn3=oz*oz; cn4=jx*jx; cn5=jy*jy; cn6=jz*jz; - cn1= 1.0-3.0*cn1+2.0*cn1*ox; - cn2= 1.0-3.0*cn2+2.0*cn2*oy; - cn3= 1.0-3.0*cn3+2.0*cn3*oz; - cn4= 1.0-3.0*cn4-2.0*cn4*jx; - cn5= 1.0-3.0*cn5-2.0*cn5*jy; - cn6= 1.0-3.0*cn6-2.0*cn6*jz; + cn1= 1.0f-3.0f*cn1+2.0f*cn1*ox; + cn2= 1.0f-3.0f*cn2+2.0f*cn2*oy; + cn3= 1.0f-3.0f*cn3+2.0f*cn3*oz; + cn4= 1.0f-3.0f*cn4-2.0f*cn4*jx; + cn5= 1.0f-3.0f*cn5-2.0f*cn5*jy; + cn6= 1.0f-3.0f*cn6-2.0f*cn6*jz; b00= hash[ hash[ix & 255]+(iy & 255)]; b10= hash[ hash[(ix+1) & 255]+(iy & 255)]; @@ -325,23 +325,23 @@ static float orgBlenderNoise(float x, float y, float z) h=hashvectf+ 3*hash[b21+b11]; n+= i*(h[0]*jx+h[1]*jy+h[2]*jz); - if(n<0.0) n=0.0; else if(n>1.0) n=1.0; + if(n<0.0f) n=0.0f; else if(n>1.0f) n=1.0f; return n; } /* as orgBlenderNoise(), returning signed noise */ static float orgBlenderNoiseS(float x, float y, float z) { - return (2.0*orgBlenderNoise(x, y, z)-1.0); + return (2.0f*orgBlenderNoise(x, y, z)-1.0f); } /* separated from orgBlenderNoise above, with scaling */ float BLI_hnoise(float noisesize, float x, float y, float z) { - if(noisesize==0.0) return 0.0; - x= (1.0+x)/noisesize; - y= (1.0+y)/noisesize; - z= (1.0+z)/noisesize; + if(noisesize==0.0f) return 0.0f; + x= (1.0f+x)/noisesize; + y= (1.0f+y)/noisesize; + z= (1.0f+z)/noisesize; return orgBlenderNoise(x, y, z); } @@ -357,7 +357,7 @@ float BLI_turbulence(float noisesize, float x, float y, float z, int nr) s+= d*BLI_hnoise(noisesize*d, x, y, z); div+= d; - d*= 0.5; + d*= 0.5f; nr--; } @@ -368,13 +368,13 @@ float BLI_turbulence1(float noisesize, float x, float y, float z, int nr) { float s, d= 0.5, div=1.0; - s= fabs( (-1.0+2.0*BLI_hnoise(noisesize, x, y, z))); + s= fabsf( (-1.0f+2.0f*BLI_hnoise(noisesize, x, y, z))); while(nr>0) { - s+= fabs(d* (-1.0+2.0*BLI_hnoise(noisesize*d, x, y, z))); + s+= fabsf(d* (-1.0f+2.0f*BLI_hnoise(noisesize*d, x, y, z))); div+= d; - d*= 0.5; + d*= 0.5f; nr--; } @@ -917,11 +917,11 @@ static float g[512+2][3]= { #define DOT(a,b) (a[0] * b[0] + a[1] * b[1] + a[2] * b[2]) #define setup(i,b0,b1,r0,r1) \ - t = vec[i] + 10000.; \ + t = vec[i] + 10000.0f; \ b0 = ((int)t) & 255; \ b1 = (b0+1) & 255; \ r0 = t - floorf(t); \ - r1 = r0 - 1.; + r1 = r0 - 1.0f; static float noise3_perlin(float vec[3]) @@ -945,7 +945,7 @@ static float noise3_perlin(float vec[3]) #define at(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] ) -#define surve(t) ( t * t * (3. - 2. * t) ) +#define surve(t) ( t * t * (3.0f - 2.0f * t) ) /* lerp moved to improved perlin above */ @@ -982,7 +982,7 @@ static float noise3_perlin(float vec[3]) d = lerp(sy, a, b); /* interpolate in y at hi x */ - return 1.5 * lerp(sz, c, d); /* interpolate in z */ + return 1.5f * lerp(sz, c, d); /* interpolate in z */ } #if 0 @@ -996,7 +996,7 @@ static float turbulence_perlin(float *point, float lofreq, float hifreq) t = 0; for (freq = lofreq ; freq < hifreq ; freq *= 2.) { - t += fabs(noise3_perlin(p)) / freq; + t += fabsf(noise3_perlin(p)) / freq; p[0] *= 2.; p[1] *= 2.; p[2] *= 2.; @@ -1024,7 +1024,7 @@ static float orgPerlinNoiseU(float x, float y, float z) v[0] = x; v[1] = y; v[2] = z; - return (0.5+0.5*noise3_perlin(v)); + return (0.5f+0.5f*noise3_perlin(v)); } /* *************** CALL AS: *************** */ @@ -1061,18 +1061,18 @@ float BLI_hnoisep(float noisesize, float x, float y, float z) /* distance squared */ static float dist_Squared(float x, float y, float z, float e) { (void)e; return (x*x + y*y + z*z); } /* real distance */ -static float dist_Real(float x, float y, float z, float e) { (void)e; return sqrt(x*x + y*y + z*z); } +static float dist_Real(float x, float y, float z, float e) { (void)e; return sqrtf(x*x + y*y + z*z); } /* manhattan/taxicab/cityblock distance */ -static float dist_Manhattan(float x, float y, float z, float e) { (void)e; return (fabs(x) + fabs(y) + fabs(z)); } +static float dist_Manhattan(float x, float y, float z, float e) { (void)e; return (fabsf(x) + fabsf(y) + fabsf(z)); } /* Chebychev */ static float dist_Chebychev(float x, float y, float z, float e) { float t; (void)e; - x = fabs(x); - y = fabs(y); - z = fabs(z); + x = fabsf(x); + y = fabsf(y); + z = fabsf(z); t = (x>y)?x:y; return ((z>t)?z:t); } @@ -1080,7 +1080,7 @@ static float dist_Chebychev(float x, float y, float z, float e) /* minkovsky preset exponent 0.5 */ static float dist_MinkovskyH(float x, float y, float z, float e) { - float d = sqrt(fabs(x)) + sqrt(fabs(y)) + sqrt(fabs(z)); + float d = sqrtf(fabsf(x)) + sqrtf(fabsf(y)) + sqrtf(fabsf(z)); (void)e; return (d*d); } @@ -1092,13 +1092,13 @@ static float dist_Minkovsky4(float x, float y, float z, float e) x *= x; y *= y; z *= z; - return sqrt(sqrt(x*x + y*y + z*z)); + return sqrtf(sqrtf(x*x + y*y + z*z)); } /* Minkovsky, general case, slow, maybe too slow to be useful */ static float dist_Minkovsky(float x, float y, float z, float e) { - return pow(pow(fabs(x), e) + pow(fabs(y), e) + pow(fabs(z), e), 1.0/e); + return powf(powf(fabsf(x), e) + powf(fabsf(y), e) + powf(fabsf(z), e), 1.0f/e); } @@ -1224,35 +1224,35 @@ static float voronoi_F1S(float x, float y, float z) { float da[4], pa[12]; voronoi(x, y, z, da, pa, 1, 0); - return (2.0*da[0]-1.0); + return (2.0f*da[0]-1.0f); } static float voronoi_F2S(float x, float y, float z) { float da[4], pa[12]; voronoi(x, y, z, da, pa, 1, 0); - return (2.0*da[1]-1.0); + return (2.0f*da[1]-1.0f); } static float voronoi_F3S(float x, float y, float z) { float da[4], pa[12]; voronoi(x, y, z, da, pa, 1, 0); - return (2.0*da[2]-1.0); + return (2.0f*da[2]-1.0f); } static float voronoi_F4S(float x, float y, float z) { float da[4], pa[12]; voronoi(x, y, z, da, pa, 1, 0); - return (2.0*da[3]-1.0); + return (2.0f*da[3]-1.0f); } static float voronoi_F1F2S(float x, float y, float z) { float da[4], pa[12]; voronoi(x, y, z, da, pa, 1, 0); - return (2.0*(da[1]-da[0])-1.0); + return (2.0f*(da[1]-da[0])-1.0f); } /* Crackle type pattern, just a scale/clamp of F2-F1 */ @@ -1260,7 +1260,7 @@ static float voronoi_CrS(float x, float y, float z) { float t = 10*voronoi_F1F2(x, y, z); if (t>1.f) return 1.f; - return (2.0*t-1.0); + return (2.0f*t-1.0f); } @@ -1280,13 +1280,13 @@ static float cellNoiseU(float x, float y, float z) int zi = (int)(floor(z)); unsigned int n = xi + yi*1301 + zi*314159; n ^= (n<<13); - return ((float)(n*(n*n*15731 + 789221) + 1376312589) / 4294967296.0); + return ((float)(n*(n*n*15731 + 789221) + 1376312589) / 4294967296.0f); } /* idem, signed */ float cellNoise(float x, float y, float z) { - return (2.0*cellNoiseU(x, y, z)-1.0); + return (2.0f*cellNoiseU(x, y, z)-1.0f); } /* returns a vector/point/color in ca, using point hasharray directly */ @@ -1349,14 +1349,14 @@ float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noise } } - if (noisesize!=0.0) { - noisesize = 1.0/noisesize; + if (noisesize!=0.0f) { + noisesize = 1.0f/noisesize; x *= noisesize; y *= noisesize; z *= noisesize; } - if (hard) return fabs(2.0*noisefunc(x, y, z)-1.0); + if (hard) return fabsf(2.0f*noisefunc(x, y, z)-1.0f); return noisefunc(x, y, z); } @@ -1403,17 +1403,17 @@ float BLI_gTurbulence(float noisesize, float x, float y, float z, int oct, int h z += 1; } - if (noisesize!=0.0) { - noisesize = 1.0/noisesize; + if (noisesize!=0.0f) { + noisesize = 1.0f/noisesize; x *= noisesize; y *= noisesize; z *= noisesize; } sum = 0; - for (i=0;i<=oct;i++, amp*=0.5, fscale*=2) { + for (i=0;i<=oct;i++, amp*=0.5f, fscale*=2.0f) { t = noisefunc(fscale*x, fscale*y, fscale*z); - if (hard) t = fabs(2.0*t-1.0); + if (hard) t = fabsf(2.0f*t-1.0f); sum += t * amp; } @@ -1439,7 +1439,7 @@ float BLI_gTurbulence(float noisesize, float x, float y, float z, int oct, int h */ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis) { - float rmd, value=0.0, pwr=1.0, pwHL=pow(lacunarity, -H); + float rmd, value=0.0, pwr=1.0, pwHL=powf(lacunarity, -H); int i; float (*noisefunc)(float, float, float); @@ -1485,7 +1485,7 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves z *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if (rmd!=0.f) value += rmd * noisefunc(x, y, z) * pwr; return value; @@ -1508,9 +1508,9 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves * I modified it to something that made sense to me, so it might be wrong... */ float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis) { - float rmd, value=1.0, pwr=1.0, pwHL=pow(lacunarity, -H); + float rmd, value=1.0, pwr=1.0, pwHL=powf(lacunarity, -H); int i; - + float (*noisefunc)(float, float, float); switch (noisebasis) { case 1: @@ -1547,14 +1547,14 @@ float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, floa } for (i=0; i<(int)octaves; i++) { - value *= (pwr * noisefunc(x, y, z) + 1.0); + value *= (pwr * noisefunc(x, y, z) + 1.0f); pwr *= pwHL; x *= lacunarity; y *= lacunarity; z *= lacunarity; } - rmd = octaves - floor(octaves); - if (rmd!=0.0) value *= (rmd * noisefunc(x, y, z) * pwr + 1.0); + rmd = octaves - floorf(octaves); + if (rmd!=0.0f) value *= (rmd * noisefunc(x, y, z) * pwr + 1.0f); return value; @@ -1574,7 +1574,7 @@ float mg_HeteroTerrain(float x, float y, float z, float H, float lacunarity, flo { float value, increment, rmd; int i; - float pwHL = pow(lacunarity, -H); + float pwHL = powf(lacunarity, -H); float pwr = pwHL; /* starts with i=1 instead of 0 */ float (*noisefunc)(float, float, float); @@ -1627,8 +1627,8 @@ float mg_HeteroTerrain(float x, float y, float z, float H, float lacunarity, flo z *= lacunarity; } - rmd = octaves - floor(octaves); - if (rmd!=0.0) { + rmd = octaves - floorf(octaves); + if (rmd!=0.0f) { increment = (noisefunc(x, y, z) + offset) * pwr * value; value += rmd * increment; } @@ -1647,7 +1647,7 @@ float mg_HybridMultiFractal(float x, float y, float z, float H, float lacunarity { float result, signal, weight, rmd; int i; - float pwHL = pow(lacunarity, -H); + float pwHL = powf(lacunarity, -H); float pwr = pwHL; /* starts with i=1 instead of 0 */ float (*noisefunc)(float, float, float); @@ -1691,8 +1691,8 @@ float mg_HybridMultiFractal(float x, float y, float z, float H, float lacunarity y *= lacunarity; z *= lacunarity; - for (i=1; (weight>0.001) && (i<(int)octaves); i++) { - if (weight>1.0) weight=1.0; + for (i=1; (weight>0.001f) && (i<(int)octaves); i++) { + if (weight>1.0f) weight=1.0f; signal = (noisefunc(x, y, z) + offset) * pwr; pwr *= pwHL; result += weight * signal; @@ -1702,7 +1702,7 @@ float mg_HybridMultiFractal(float x, float y, float z, float H, float lacunarity z *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if (rmd!=0.f) result += rmd * ((noisefunc(x, y, z) + offset) * pwr); return result; @@ -1722,7 +1722,7 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity { float result, signal, weight; int i; - float pwHL = pow(lacunarity, -H); + float pwHL = powf(lacunarity, -H); float pwr = pwHL; /* starts with i=1 instead of 0 */ float (*noisefunc)(float, float, float); @@ -1760,7 +1760,7 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity } } - signal = offset - fabs(noisefunc(x, y, z)); + signal = offset - fabsf(noisefunc(x, y, z)); signal *= signal; result = signal; @@ -1770,8 +1770,8 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity y *= lacunarity; z *= lacunarity; weight = signal * gain; - if (weight>1.0) weight=1.0; else if (weight<0.0) weight=0.0; - signal = offset - fabs(noisefunc(x, y, z)); + if (weight>1.0f) weight=1.0f; else if (weight<0.0f) weight=0.0f; + signal = offset - fabsf(noisefunc(x, y, z)); signal *= signal; signal *= weight; result += signal * pwr; @@ -1859,9 +1859,9 @@ float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nba } /* get a random vector and scale the randomization */ - rv[0] = noisefunc1(x+13.5, y+13.5, z+13.5) * distortion; + rv[0] = noisefunc1(x+13.5f, y+13.5f, z+13.5f) * distortion; rv[1] = noisefunc1(x, y, z) * distortion; - rv[2] = noisefunc1(x-13.5, y-13.5, z-13.5) * distortion; + rv[2] = noisefunc1(x-13.5f, y-13.5f, z-13.5f) * distortion; return noisefunc2(x+rv[0], y+rv[1], z+rv[2]); /* distorted-domain noise */ } -- cgit v1.2.3 From c73d5b939dd9dcc68ed1d1316115c2c7cded9cab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 05:01:16 +0000 Subject: check for unlikely error when freeing a library blend file from the BGE. --- source/gameengine/Converter/KX_BlenderSceneConverter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index b04a0d24e78..dd21e7ef263 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -1083,7 +1083,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha * most are temp and NewRemoveObject frees m_map_gameobject_to_blender */ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) { - int maggie_index; + int maggie_index= -1; int i=0; if(maggie==NULL) @@ -1101,6 +1101,10 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) i++; } + /* should never happen but just to be safe */ + if(maggie_index == -1) + return false; + m_DynamicMaggie.erase(m_DynamicMaggie.begin() + maggie_index); tag_main(maggie, 1); -- cgit v1.2.3 From fa2ba5fbf5848e4d61b697c624af9b9e9456eb20 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 05:06:30 +0000 Subject: - use static vars and functions where possible. - use NULL rather than 0 when used as pointers. --- source/blender/blenkernel/intern/material.c | 4 +-- source/blender/blenkernel/intern/seqeffects.c | 4 +-- source/blender/blenlib/intern/BLI_ghash.c | 2 +- source/blender/blenlib/intern/callbacks.c | 2 +- .../blender/editors/interface/interface_layout.c | 2 +- source/blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/render/render_preview.c | 1 + source/blender/editors/screen/screen_ops.c | 2 +- .../blender/editors/space_outliner/outliner_tree.c | 2 +- .../editors/space_sequencer/sequencer_draw.c | 8 +++--- .../editors/space_sequencer/sequencer_select.c | 2 +- source/blender/gpu/intern/gpu_codegen.c | 6 ++--- source/blender/gpu/intern/gpu_draw.c | 2 +- source/blender/gpu/intern/gpu_extensions.c | 2 +- source/blender/makesdna/intern/makesdna.c | 30 +++++++++++----------- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_main_api.c | 1 + source/blender/makesrna/intern/rna_modifier.c | 1 + source/blender/makesrna/intern/rna_nodetree.c | 2 +- source/blender/makesrna/intern/rna_object_force.c | 17 ++++++------ source/blender/makesrna/intern/rna_particle.c | 17 ++++++------ source/blender/makesrna/intern/rna_texture.c | 3 ++- source/blender/python/intern/bpy_intern_string.c | 3 ++- source/blender/python/intern/bpy_props.c | 4 +-- source/blender/render/intern/source/pointdensity.c | 2 +- source/blender/windowmanager/intern/wm_init_exit.c | 2 +- source/blender/windowmanager/intern/wm_keymap.c | 2 +- 27 files changed, 67 insertions(+), 60 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 9c455e84109..29615986191 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -515,7 +515,7 @@ short *give_totcolp_id(ID *id) return NULL; } -void data_delete_material_index_id(ID *id, int index) +static void data_delete_material_index_id(ID *id, int index) { switch(GS(id->name)) { case ID_ME: @@ -1365,7 +1365,7 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col) } /* copy/paste buffer, if we had a propper py api that would be better */ -Material matcopybuf; +static Material matcopybuf; static short matcopied= 0; void clear_matcopybuf(void) diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index cf95692c8b4..8b50ad2b042 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2873,7 +2873,7 @@ static struct ImBuf * do_adjustment_impl(SeqRenderData context, Sequence * seq, { Editing * ed; ListBase * seqbasep; - struct ImBuf * i = 0; + struct ImBuf * i= NULL; ed = context.scene->ed; @@ -2908,7 +2908,7 @@ static struct ImBuf * do_adjustment( struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2), struct ImBuf *UNUSED(ibuf3)) { - struct ImBuf * i = 0; + struct ImBuf * i = NULL; struct ImBuf * out; Editing * ed; diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index bfee350037a..03e3b7ab560 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -40,7 +40,7 @@ #include "BLO_sys_types.h" // for intptr_t support /***/ -unsigned int hashsizes[]= { +static unsigned int hashsizes[]= { 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169, 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, diff --git a/source/blender/blenlib/intern/callbacks.c b/source/blender/blenlib/intern/callbacks.c index a033e01696d..d28f794440f 100644 --- a/source/blender/blenlib/intern/callbacks.c +++ b/source/blender/blenlib/intern/callbacks.c @@ -28,7 +28,7 @@ #include "MEM_guardedalloc.h" -static ListBase callback_slots[BLI_CB_EVT_TOT]= {{0}}; +static ListBase callback_slots[BLI_CB_EVT_TOT]= {{NULL}}; void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt) { diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3575a8527fc..ef88bb0bbb6 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1361,7 +1361,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) { MenuType *mt= (MenuType*)arg_mt; - Menu menu = {0}; + Menu menu = {NULL}; menu.type= mt; menu.layout= layout; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index b8cdc18e739..4b0c1cb1222 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3988,7 +3988,7 @@ static void PTCacheUndo_clear(PTCacheEdit *edit) { PTCacheUndo *undo; - if(edit==0) return; + if(edit==NULL) return; undo= edit->undo.first; while(undo) { diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 007ae96ae59..b937f9a4104 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -64,6 +64,7 @@ #include "DNA_brush_types.h" #include "DNA_screen_types.h" +#include "BKE_brush.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 0ac30853eae..ede17790318 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1702,7 +1702,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -int region_scale_cancel(bContext *UNUSED(C), wmOperator *op) +static int region_scale_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata = NULL; diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 3560bfb9896..74e9e775087 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -231,7 +231,7 @@ void outliner_free_tree(ListBase *lb) } /* Find ith item from the treestore */ -TreeElement *outliner_find_tree_element(ListBase *lb, int store_index) +static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index) { TreeElement *te= lb->first, *tes; while(te) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index dc84289a8de..9a904b1a970 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -700,7 +700,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline } } -static Sequence *special_seq_update= 0; +static Sequence *special_seq_update= NULL; static void UNUSED_FUNCTION(set_special_seq_update)(int val) { @@ -710,14 +710,14 @@ static void UNUSED_FUNCTION(set_special_seq_update)(int val) if(val) { // XXX special_seq_update= find_nearest_seq(&x); } - else special_seq_update= 0; + else special_seq_update= NULL; } void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs) { struct Main *bmain= CTX_data_main(C); - struct ImBuf *ibuf = 0; - struct ImBuf *scope = 0; + struct ImBuf *ibuf= NULL; + struct ImBuf *scope= NULL; struct View2D *v2d = &ar->v2d; int rectx, recty; float viewrectx, viewrecty; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 0ac23765167..86b28f5e89e 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -846,7 +846,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) for(seq= ed->seqbasep->first; seq; seq= seq->next) { seq_rectf(seq, &rq); - if(BLI_isect_rctf(&rq, &rectf, 0)) { + if(BLI_isect_rctf(&rq, &rectf, NULL)) { if(selecting) seq->flag |= SELECT; else seq->flag &= ~SEQ_ALLSEL; recurs_sel_seq(seq); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 910576fa34e..77498835d57 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -82,7 +82,7 @@ typedef enum GPUDataSource { } GPUDataSource; static const char* GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4", - 0, 0, 0, 0, "mat3", 0, 0, 0, 0, 0, 0, "mat4"}; + NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, "mat4"}; struct GPUNode { struct GPUNode *next, *prev; @@ -451,7 +451,7 @@ static int codegen_input_has_texture(GPUInput *input) else if(input->ima) return 1; else - return input->tex != 0; + return input->tex != NULL; } const char *GPU_builtin_name(GPUBuiltin builtin) @@ -880,7 +880,7 @@ void GPU_pass_unbind(GPUPass *pass) GPU_texture_unbind(input->tex); if (input->ima) - input->tex = 0; + input->tex = NULL; } GPU_shader_unbind(shader); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 9878d83ff5a..7af5ef6ea14 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -308,7 +308,7 @@ void GPU_set_anisotropic(float value) } } -float GPU_get_anisotropic() +float GPU_get_anisotropic(void) { return GTS.anisotropic; } diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index f6352a96878..c9f1b093b7a 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -484,7 +484,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels) //if (fpixels) // pixels = GPU_texture_convert_pixels(w*h*depth, fpixels); - glTexImage3D(tex->target, 0, internalformat, tex->w, tex->h, tex->depth, 0, format, type, 0); + glTexImage3D(tex->target, 0, internalformat, tex->w, tex->h, tex->depth, 0, format, type, NULL); GPU_print_error("3D glTexImage3D"); diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 80299d44a78..3e5e7bbdc0e 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -137,18 +137,18 @@ const char *includefiles[] = { "" }; -int maxdata= 500000, maxnr= 50000; -int nr_names=0; -int nr_types=0; -int nr_structs=0; -char **names, *namedata; /* at address names[a] is string a */ -char **types, *typedata; /* at address types[a] is string a */ -short *typelens; /* at typelens[a] is de length of type a */ -short *alphalens; /* contains sizes as they are calculated on the DEC Alpha (64 bits) */ -short **structs, *structdata; /* at sp= structs[a] is the first address of a struct definition - sp[0] is type number - sp[1] is amount of elements - sp[2] sp[3] is typenr, namenr (etc) */ +static int maxdata= 500000, maxnr= 50000; +static int nr_names=0; +static int nr_types=0; +static int nr_structs=0; +static char **names, *namedata; /* at address names[a] is string a */ +static char **types, *typedata; /* at address types[a] is string a */ +static short *typelens; /* at typelens[a] is de length of type a */ +static short *alphalens; /* contains sizes as they are calculated on the DEC Alpha (64 bits), infact any 64bit system */ +static short **structs, *structdata;/* at sp= structs[a] is the first address of a struct definition + sp[0] is type number + sp[1] is amount of elements + sp[2] sp[3] is typenr, namenr (etc) */ /** * Variable to control debug output of makesdna. * debugSDNA: @@ -157,8 +157,8 @@ short **structs, *structdata; /* at sp= structs[a] is the first address of a str * - 2 = full trace, tell which names and types were found * - 4 = full trace, plus all gritty details */ -int debugSDNA = 0; -int additional_slen_offset; +static int debugSDNA = 0; +static int additional_slen_offset; /* ************************************************************************** */ /* Functions */ @@ -889,7 +889,7 @@ void printStructLenghts(void) } -int make_structDNA(char *baseDirectory, FILE *file) +static int make_structDNA(char *baseDirectory, FILE *file) { int len, i; short *sp; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index d47abced85e..b95bd2b2087 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -66,7 +66,7 @@ static int file_older(const char *file1, const char *file2) return (st1.st_mtime < st2.st_mtime); } -const char *makesrna_path= NULL; +static const char *makesrna_path= NULL; static int replace_if_different(char *tmpfile, const char *dep_files[]) { diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 8ac620c2fcf..ea0364084f9 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -38,6 +38,7 @@ #include "RNA_define.h" #include "RNA_access.h" #include "RNA_enum_types.h" +#include "rna_internal.h" #include "BKE_utildefines.h" diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 5c5391b0bba..37a629f46d0 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -32,6 +32,7 @@ #include #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 7fd6a9dacfe..56492a52da9 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -732,7 +732,7 @@ static StructRNA* def_node(BlenderRNA *brna, int node_id) return srna; } -void alloc_node_type_items(EnumPropertyItem *items, int category) +static void alloc_node_type_items(EnumPropertyItem *items, int category) { int i; int count = 3; diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 463f65fd3d5..490d9c38840 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -43,7 +43,7 @@ #include "WM_api.h" #include "WM_types.h" -EnumPropertyItem effector_shape_items[] = { +static EnumPropertyItem effector_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", ""}, @@ -51,20 +51,23 @@ EnumPropertyItem effector_shape_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem curve_shape_items[] = { +#ifdef RNA_RUNTIME + +/* type spesific return values only used from functions */ +static EnumPropertyItem curve_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem empty_shape_items[] = { +static EnumPropertyItem empty_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem vortex_shape_items[] = { +static EnumPropertyItem vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""}, @@ -72,21 +75,19 @@ EnumPropertyItem vortex_shape_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem curve_vortex_shape_items[] = { +static EnumPropertyItem curve_vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem empty_vortex_shape_items[] = { +static EnumPropertyItem empty_vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {0, NULL, 0, NULL, NULL} }; -#ifdef RNA_RUNTIME - #include "MEM_guardedalloc.h" #include "DNA_modifier_types.h" diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 30fce5716a9..ba91fc3536b 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -33,6 +33,7 @@ #include "limits.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -50,34 +51,34 @@ #include "WM_types.h" #include "WM_api.h" -EnumPropertyItem part_from_items[] = { +static EnumPropertyItem part_from_items[] = { {PART_FROM_VERT, "VERT", 0, "Verts", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_reactor_from_items[] = { +static EnumPropertyItem part_reactor_from_items[] = { {PART_FROM_VERT, "VERT", 0, "Verts", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_dist_items[] = { +static EnumPropertyItem part_dist_items[] = { {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, {PART_DISTR_RAND, "RAND", 0, "Random", ""}, {PART_DISTR_GRID, "GRID", 0, "Grid", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_hair_dist_items[] = { +static EnumPropertyItem part_hair_dist_items[] = { {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, {PART_DISTR_RAND, "RAND", 0, "Random", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_draw_as_items[] = { +static EnumPropertyItem part_draw_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_REND, "RENDER", 0, "Rendered", ""}, {PART_DRAW_DOT, "DOT", 0, "Point", ""}, @@ -87,14 +88,14 @@ EnumPropertyItem part_draw_as_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_hair_draw_as_items[] = { +static EnumPropertyItem part_hair_draw_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_REND, "RENDER", 0, "Rendered", ""}, {PART_DRAW_PATH, "PATH", 0, "Path", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_ren_as_items[] = { +static EnumPropertyItem part_ren_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_HALO, "HALO", 0, "Halo", ""}, {PART_DRAW_LINE, "LINE", 0, "Line", ""}, @@ -105,7 +106,7 @@ EnumPropertyItem part_ren_as_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem part_hair_ren_as_items[] = { +static EnumPropertyItem part_hair_ren_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_PATH, "PATH", 0, "Path", ""}, {PART_DRAW_OB, "OBJECT", 0, "Object", ""}, diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index f459563f49e..0ecc41d80d8 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -32,6 +32,7 @@ #include #include "RNA_define.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -47,7 +48,7 @@ #include "BKE_node.h" -EnumPropertyItem texture_filter_items[] = { +static EnumPropertyItem texture_filter_items[] = { {TXF_BOX, "BOX", 0, "Box", ""}, {TXF_EWA, "EWA", 0, "EWA", ""}, {TXF_FELINE, "FELINE", 0, "FELINE", ""}, diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c index c6629007532..6fc861b2a0d 100644 --- a/source/blender/python/intern/bpy_intern_string.c +++ b/source/blender/python/intern/bpy_intern_string.c @@ -28,13 +28,14 @@ #include +#include "bpy_intern_string.h" + PyObject *bpy_intern_str_register; PyObject *bpy_intern_str_unregister; PyObject *bpy_intern_str_bl_rna; PyObject *bpy_intern_str_order; PyObject *bpy_intern_str_attr; PyObject *bpy_intern_str___slots__; -PyObject *bpy_intern_str___bases__; void bpy_intern_string_init(void) { diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index a0ad1ff7850..5da142aeea7 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -117,7 +117,7 @@ static PyObject *pymeth_PointerProperty= NULL; static PyObject *pymeth_CollectionProperty= NULL; static PyObject *pymeth_RemoveProperty= NULL; -PyObject *pyrna_struct_as_instance(PointerRNA *ptr) +static PyObject *pyrna_struct_as_instance(PointerRNA *ptr) { PyObject *self= NULL; /* first get self */ @@ -177,7 +177,7 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw) } /* callbacks */ -void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop) +static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop) { PyGILState_STATE gilstate; PyObject **py_data= (PyObject **)RNA_property_py_data_get(prop); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index b45528b96d9..980f6b6af1e 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -104,7 +104,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa { DerivedMesh* dm; ParticleKey state; - ParticleSimulationData sim= {0}; + ParticleSimulationData sim= {NULL}; ParticleData *pa=NULL; float cfra = BKE_curframe(re->scene); int i, childexists; diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index cf91e219593..850de9029c9 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -116,7 +116,7 @@ static void wm_free_reports(bContext *C) BKE_reports_clear(CTX_wm_reports(C)); } -int wm_start_with_console = 0; +int wm_start_with_console = 0; /* used in creator.c */ /* only called once, for startup */ void WM_init(bContext *C, int argc, const char **argv) diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 6887aa4c717..0e94ad72d35 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -225,7 +225,7 @@ static wmKeyConfig *wm_keyconfig_list_find(ListBase *lb, char *idname) return NULL; } -wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm) +static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm) { wmKeyConfig *keyconf; -- cgit v1.2.3 From 852a03a6af6d67da58154b848b45a118eb38cdc0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 09:28:41 +0000 Subject: RNA_property_as_string now escapes the string (so operator redo can include strings with ", \n etc), also fixed a bug in string escape length limit. --- source/blender/blenlib/intern/string.c | 4 ++-- source/blender/makesrna/intern/rna_access.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 2f1ddf294ce..c4ed44f0cdb 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -129,7 +129,6 @@ size_t BLI_strescape(char *dst, const char *src, const size_t maxlen) while(len < maxlen) { switch(*src) { case '\0': - *dst= '\0'; break; case '\\': case '"': @@ -144,7 +143,6 @@ size_t BLI_strescape(char *dst, const char *src, const size_t maxlen) } else { /* not enough space to escape */ - *dst= '\0'; break; } /* intentionally pass through */ @@ -156,6 +154,8 @@ size_t BLI_strescape(char *dst, const char *src, const size_t maxlen) len++; } + *dst= '\0'; + return len; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 88447f6dd77..bc6e17a689d 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2106,7 +2106,7 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fi if(length+1 < fixedlen) buf= fixedbuf; else - buf= MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc"); + buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc"); RNA_property_string_get(ptr, prop, buf); @@ -4271,11 +4271,18 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop) break; case PROP_STRING: { - /* string arrays dont exist */ + char *buf_esc; char *buf; - buf = RNA_property_string_get_alloc(ptr, prop, NULL, -1); - BLI_dynstr_appendf(dynstr, "\"%s\"", buf); + int length; + + length= RNA_property_string_length(ptr, prop); + buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_property_as_string"); + buf_esc= MEM_mallocN(sizeof(char)*(length*2+1), "RNA_property_as_string esc"); + RNA_property_string_get(ptr, prop, buf); + BLI_strescape(buf_esc, buf, length*2); MEM_freeN(buf); + BLI_dynstr_appendf(dynstr, "\"%s\"", buf_esc); + MEM_freeN(buf_esc); break; } case PROP_ENUM: -- cgit v1.2.3 From 8e12b7b054c3c4e95a23f26db232d99ff18e2b90 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 28 Aug 2011 11:39:18 +0000 Subject: Assorted comment clarification in response to code review notes --- source/blender/blenkernel/intern/anim_sys.c | 2 +- source/blender/blenkernel/intern/depsgraph.c | 13 ++++++++++++- source/blender/editors/animation/drivers.c | 1 - source/blender/editors/space_nla/nla_draw.c | 5 +---- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 3c6daf8b39d..b690c9b4a91 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1168,7 +1168,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i * for we know that which the updates in RNA were really just for * flushing property editing via UI/Py */ - if (RNA_struct_is_a(new_ptr.type, &RNA_PoseBone)) { + if (new_ptr.type == &RNA_PoseBone) { /* bone transforms - update pose (i.e. tag depsgraph) */ skip_updates_hack = 1; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 4802601307a..6f27a104144 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2062,8 +2062,19 @@ static short animdata_use_time(AnimData *adt) return 1; } - /* experimental check: if we have drivers, more likely than not, on a frame change + /* If we have drivers, more likely than not, on a frame change * they'll need updating because their owner changed + * + * This is kindof a hack to get around a whole host of problems + * involving drivers using non-object datablock data (which the + * depsgraph currently has no way of representing let alone correctly + * dependency sort+tagging). By doing this, at least we ensure that + * some commonly attempted drivers (such as scene -> current frame; + * see "Driver updates fail" thread on Bf-committers dated July 2) + * will work correctly, and that other non-object datablocks will have + * their drivers update at least on frame change. + * + * -- Aligorith, July 4 2011 */ if (adt->drivers.first) return 1; diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 28195be943c..6ebe488d2c8 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -383,7 +383,6 @@ short ANIM_paste_driver (ReportList *reports, ID *id, const char rna_path[], int /* modifiers */ copy_fmodifiers(&fcu->modifiers, &channeldriver_copypaste_buf->modifiers); - /* flags - on a per-relevant-flag basis */ /* extrapolation mode */ fcu->extend= channeldriver_copypaste_buf->extend; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 9ce5aafd48a..0583f328371 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -471,10 +471,7 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, sprintf(str, "%d) Temp-Meta", index); } else { - if (strip->flag & NLASTRIP_FLAG_REVERSE) - sprintf(str, "%s", strip->name); - else - sprintf(str, "%s", strip->name); + sprintf(str, strip->name); } /* set text color - if colors (see above) are light, draw black text, otherwise draw white */ -- cgit v1.2.3 From b4b046995b21d59e315eb71ed08fc1ae066c891b Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sun, 28 Aug 2011 14:21:44 +0000 Subject: * Removing mocap GSoC (is an addon already). * Fixing ffmpeg-0.8 errors. * Fixing Ketsji paths. * Removing DoSound from BGE. * Fixing audio scene update to use only current scene objects. --- source/blender/blenkernel/BKE_sound.h | 2 +- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenkernel/intern/sequencer.c | 15 ++++-------- source/blender/blenkernel/intern/sound.c | 7 ++++-- source/gameengine/Ketsji/CMakeLists.txt | 25 +------------------- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 34 ---------------------------- source/gameengine/Ketsji/KX_KetsjiEngine.h | 2 -- 7 files changed, 13 insertions(+), 74 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index ecf0d7e459a..e1b6ff02bc4 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -136,7 +136,7 @@ void sound_read_waveform(struct bSound* sound); int sound_get_channels(struct bSound* sound); -void sound_update_scene(struct Main* bmain, struct Scene* scene); +void sound_update_scene(struct Scene* scene); void* sound_get_factory(void* sound); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 12e81e8296e..d6003a44a7d 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -968,7 +968,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen scene_update_drivers(bmain, scene); /* update sound system animation */ - sound_update_scene(bmain, scene); + sound_update_scene(scene); } /* this is called in main loop, doing tagged updates before redraw */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 4cec086aad4..bfbaa223a99 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3150,18 +3150,14 @@ void seq_update_sound_bounds_all(Scene *scene) { Editing *ed = scene->ed; - if(ed) - { + if(ed) { Sequence *seq; - for(seq = ed->seqbase.first; seq; seq = seq->next) - { - if(seq->type == SEQ_META) - { + for(seq = ed->seqbase.first; seq; seq = seq->next) { + if(seq->type == SEQ_META) { seq_update_sound_bounds_recursive(scene, seq); } - else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) - { + else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) { seq_update_sound_bounds(scene, seq); } } @@ -3170,8 +3166,7 @@ void seq_update_sound_bounds_all(Scene *scene) void seq_update_sound_bounds(Scene* scene, Sequence *seq) { - if(seq->scene_sound) - { + if(seq->scene_sound) { sound_move_scene_sound(scene, seq->scene_sound, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); /* mute is set in seq_update_muting_recursive */ } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index a364f860255..842923e63d0 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -24,6 +24,7 @@ #include "DNA_sound_types.h" #include "DNA_speaker_types.h" +#define WITH_AUDASPACE #ifdef WITH_AUDASPACE # include "AUD_C-API.h" #endif @@ -649,9 +650,10 @@ int sound_get_channels(struct bSound* sound) return info.specs.channels; } -void sound_update_scene(struct Main* bmain, struct Scene* scene) +void sound_update_scene(struct Scene* scene) { Object* ob; + Base* base; NlaTrack* track; NlaStrip* strip; Speaker* speaker; @@ -660,8 +662,9 @@ void sound_update_scene(struct Main* bmain, struct Scene* scene) void* handle; float quat[4]; - for(ob = bmain->object.first; ob; ob = ob->id.next) + for(base = FIRSTBASE; base; base=base->next) { + ob = base->object; if(ob->type == OB_SPEAKER) { if(ob->adt) diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 73365860fce..99c9fb25a65 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -45,37 +45,14 @@ set(INC ../../blender/gpu ../../blender/imbuf ../../blender/makesdna + ../../blender/makesrna ../../blender/python ../../blender/python/generic ../../blender/python/mathutils ../../../intern/container ../../../intern/guardedalloc - ../../../intern/container - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/gameengine/BlenderRoutines - ../../../source/blender/imbuf ../../../intern/moto/include ../../../intern/string - ../../../source/gameengine/Ketsji - ../../../source/blender/blenlib - ../../../source/blender/blenfont - ../../../source/blender/blenkernel - ../../../source/blender/python - ../../../source/blender/python/generic - ../../../source/blender - ../../../source/blender/makesdna - ../../../source/blender/makesrna - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/GameLogic - ../../../source/gameengine/Expressions - ../../../source/gameengine/Ketsji/KXNetwork - ../../../source/gameengine/Network - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Physics/common - ../../../source/gameengine/Network/LoopBackNetwork - ../../../source/blender/blenloader - ../../../source/blender/gpu ) set(INC_SYS diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index dd1cc09cdc6..620f46e743e 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -96,7 +96,6 @@ const char KX_KetsjiEngine::m_profileLabels[tc_numCategories][15] = { "Animations:", // tc_animations "Network:", // tc_network "Scenegraph:", // tc_scenegraph - "Sound:", // tc_sound "Rasterizer:", // tc_rasterizer "Services:", // tc_services "Overhead:", // tc_overhead @@ -692,8 +691,6 @@ else else if(scene->getSuspendedTime()==0.0) scene->setSuspendedTime(m_clockTime); - - DoSound(scene); m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); } @@ -769,8 +766,6 @@ else if(scene->getSuspendedTime()==0.0) scene->setSuspendedTime(m_clockTime); - DoSound(scene); - m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); } } @@ -1003,35 +998,6 @@ const STR_String& KX_KetsjiEngine::GetExitString() } - -void KX_KetsjiEngine::DoSound(KX_Scene* scene) -{ - m_logger->StartLog(tc_sound, m_kxsystem->GetTimeInSeconds(), true); - - // nothing to do here, everything relative now... - /*KX_Camera* cam = scene->GetActiveCamera(); - if (!cam) - return; - - AUD_I3DDevice* dev = AUD_get3DDevice(); - if(dev) - { - AUD_Vector3 v; - //float q[4]; - //cam->NodeGetWorldPosition().getValue(v.get()); - dev->setListenerLocation(v); - - //cam->GetLinearVelocity().getValue(v.get()); - dev->setListenerVelocity(v); - - //cam->NodeGetWorldOrientation().getRotation().getValue(q); - //dev->setListenerOrientation(AUD_Quaternion(q[3], q[0], q[1], q[2])); - dev->setListenerOrientation(AUD_Quaternion()); - }*/ -} - - - void KX_KetsjiEngine::SetBackGround(KX_WorldInfo* wi) { if (wi->hasWorld()) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 95a6b3401a7..b1009c7d8f0 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -153,7 +153,6 @@ private: tc_animations, tc_network, tc_scenegraph, - tc_sound, tc_rasterizer, tc_services, // time spend in miscelaneous activities tc_overhead, // profile info drawing overhead @@ -199,7 +198,6 @@ private: void RenderDebugProperties(); void RenderShadowBuffers(KX_Scene *scene); void SetBackGround(KX_WorldInfo* worldinfo); - void DoSound(KX_Scene* scene); void RenderFonts(KX_Scene* scene); public: -- cgit v1.2.3 From c07bd1439a3f026b8603c52662c3e7ccc364321a Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 28 Aug 2011 14:46:03 +0000 Subject: == Sequencer == This patch adds: * support for proxy building again (missing feature from Blender 2.49) additionally to the way, Blender 2.49 worked, you can select several strips at once and make Blender build proxies in the background (using the job system) Also a new thing: movie proxies are now build into AVI files, and the proxy system is moved into ImBuf-library, so that other parts of blender can also benefit from it. * Timecode support: to fix seeking issues with files, that have a) varying frame rates b) very large GOP lengths c) are broken inbetween d) use different time code tracks the proxy builder can now also build timecode indices, which are used (optionally) for seeking. For the first time, it is possible, to do frame exact seeking on all file types. * Support for different video-streams in one video file (can be selected in sequencer, other parts of blender can also use it, but UI has to be added accordingly) * IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since older versions don't support the pkt_pts field, that is essential for building timecode indices. Windows and Mac libs are already updated, Linux-users have to build their own ffmpeg verions until distros keep up. --- source/blender/blenkernel/BKE_image.h | 2 +- source/blender/blenkernel/BKE_sequencer.h | 6 + source/blender/blenkernel/intern/image.c | 20 +- source/blender/blenkernel/intern/sequencer.c | 316 +++--- source/blender/blenloader/intern/readfile.c | 6 - .../editors/interface/interface_templates.c | 11 +- source/blender/editors/space_image/image_buttons.c | 4 +- source/blender/editors/space_sequencer/SConscript | 3 + .../editors/space_sequencer/sequencer_edit.c | 137 +++ .../editors/space_sequencer/sequencer_intern.h | 2 + .../editors/space_sequencer/sequencer_ops.c | 1 + source/blender/imbuf/CMakeLists.txt | 1 + source/blender/imbuf/IMB_imbuf.h | 69 +- source/blender/imbuf/intern/IMB_anim.h | 24 +- source/blender/imbuf/intern/IMB_indexer.h | 135 +++ source/blender/imbuf/intern/allocimbuf.c | 13 + source/blender/imbuf/intern/anim_movie.c | 566 +++++++--- source/blender/imbuf/intern/filter.c | 2 + source/blender/imbuf/intern/indexer.c | 1135 ++++++++++++++++++++ source/blender/imbuf/intern/indexer_dv.c | 391 +++++++ source/blender/imbuf/intern/thumbs.c | 4 +- source/blender/imbuf/intern/util.c | 7 +- source/blender/makesdna/DNA_sequence_types.h | 35 +- source/blender/makesdna/DNA_space_types.h | 1 + source/blender/makesrna/intern/rna_sequencer.c | 93 +- source/blender/makesrna/intern/rna_space.c | 1 + source/blender/windowmanager/WM_api.h | 2 + source/blender/windowmanager/intern/wm_jobs.c | 14 + 28 files changed, 2693 insertions(+), 308 deletions(-) create mode 100644 source/blender/imbuf/intern/IMB_indexer.h create mode 100644 source/blender/imbuf/intern/indexer.c create mode 100644 source/blender/imbuf/intern/indexer_dv.c (limited to 'source') diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 10910493ec9..0c31083a266 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -60,7 +60,7 @@ int BKE_ftype_to_imtype(int ftype); int BKE_imtype_to_ftype(int imtype); int BKE_imtype_is_movie(int imtype); -struct anim *openanim(char * name, int flags); +struct anim *openanim(char * name, int flags, int streamindex); void image_de_interlace(struct Image *ima, int odd); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index bedd58876bc..b20811724f4 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -177,6 +177,7 @@ int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence /* maintainance functions, mostly for RNA */ // extern void seq_free_sequence(struct Scene *scene, struct Sequence *seq); +void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq); void seq_free_strip(struct Strip *strip); void seq_free_editing(struct Scene *scene); void seq_free_clipboard(void); @@ -199,6 +200,11 @@ void update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_s int input_have_to_preprocess( SeqRenderData context, struct Sequence * seq, float cfra); +void seq_proxy_rebuild(struct Main * bmain, + struct Scene *scene, struct Sequence * seq, + short *stop, short *do_update, float *progress); + + /* ********************************************************************** seqcache.c diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ab67d7e3f25..4ce5de78895 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1371,15 +1371,15 @@ void BKE_makepicstring(char *string, const char *base, int frame, int imtype, co } /* used by sequencer too */ -struct anim *openanim(char *name, int flags) +struct anim *openanim(char *name, int flags, int streamindex) { struct anim *anim; struct ImBuf *ibuf; - anim = IMB_open_anim(name, flags); + anim = IMB_open_anim(name, flags, streamindex); if (anim == NULL) return NULL; - ibuf = IMB_anim_absolute(anim, 0); + ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE); if (ibuf == NULL) { if(BLI_exists(name)) printf("not an anim: %s\n", name); @@ -1773,20 +1773,26 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame) else BLI_path_abs(str, G.main->name); - ima->anim = openanim(str, IB_rect); + /* FIXME: make several stream accessible in image editor, too*/ + ima->anim = openanim(str, IB_rect, 0); /* let's initialize this user */ if(ima->anim && iuser && iuser->frames==0) - iuser->frames= IMB_anim_get_duration(ima->anim); + iuser->frames= IMB_anim_get_duration(ima->anim, + IMB_TC_RECORD_RUN); } if(ima->anim) { - int dur = IMB_anim_get_duration(ima->anim); + int dur = IMB_anim_get_duration(ima->anim, + IMB_TC_RECORD_RUN); int fra= frame-1; if(fra<0) fra = 0; if(fra>(dur-1)) fra= dur-1; - ibuf = IMB_anim_absolute(ima->anim, fra); + ibuf = IMB_makeSingleUser( + IMB_anim_absolute(ima->anim, fra, + IMB_TC_RECORD_RUN, + IMB_PROXY_NONE)); if(ibuf) { image_initialize_after_load(ima, ibuf); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 3aebbea789f..60479da64a9 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -218,6 +218,18 @@ void seq_free_sequence(Scene *scene, Sequence *seq) MEM_freeN(seq); } +void seq_free_sequence_recurse(Scene *scene, Sequence *seq) +{ + Sequence *iseq; + + for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) { + seq_free_sequence_recurse(scene, iseq); + } + + seq_free_sequence(scene, seq); +} + + Editing *seq_give_editing(Scene *scene, int alloc) { if (scene->ed == NULL && alloc) { @@ -683,13 +695,16 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) } case SEQ_MOVIE: if(seq->anim) IMB_free_anim(seq->anim); - seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0)); + seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex); if (!seq->anim) { return; } - seq->len = IMB_anim_get_duration(seq->anim); + seq->len = IMB_anim_get_duration(seq->anim, + seq->strip->proxy ? + seq->strip->proxy->tc : + IMB_TC_RECORD_RUN); seq->anim_preseek = IMB_anim_get_preseek(seq->anim); @@ -1117,7 +1132,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se return cnt; } - + /* ********************************************************************** proxy management @@ -1125,48 +1140,105 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se #define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE) +static IMB_Proxy_Size seq_rendersize_to_proxysize(int size) +{ + if (size >= 100) { + return IMB_PROXY_NONE; + } + if (size >= 99) { + return IMB_PROXY_100; + } + if (size >= 75) { + return IMB_PROXY_75; + } + if (size >= 50) { + return IMB_PROXY_50; + } + return IMB_PROXY_25; +} + +static void seq_open_anim_file(Sequence * seq) +{ + char name[FILE_MAXDIR+FILE_MAXFILE]; + StripProxy * proxy; + + if(seq->anim != NULL) { + return; + } + + BLI_join_dirfile(name, sizeof(name), + seq->strip->dir, seq->strip->stripdata->name); + BLI_path_abs(name, G.main->name); + + seq->anim = openanim(name, IB_rect | + ((seq->flag & SEQ_FILTERY) ? + IB_animdeinterlace : 0), seq->streamindex); + + if (seq->anim == NULL) { + return; + } + + proxy = seq->strip->proxy; + + if (proxy == NULL) { + return; + } + + if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) { + IMB_anim_set_index_dir(seq->anim, seq->strip->proxy->dir); + } +} + + static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name) { int frameno; char dir[FILE_MAXDIR]; + int render_size = context.preview_render_size; if (!seq->strip->proxy) { return FALSE; } + /* MOVIE tracks (only exception: custom files) are now handled + internally by ImBuf module for various reasons: proper time code + support, quicker index build, using one file instead + of a full directory of jpeg files, etc. Trying to support old + and new method at once could lead to funny effects, if people + have both, a directory full of jpeg files and proxy avis, so + sorry folks, please rebuild your proxies... */ + if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { strcpy(dir, seq->strip->proxy->dir); + } else if (seq->type == SEQ_IMAGE) { + snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); } else { - if (ELEM(seq->type, SEQ_IMAGE, SEQ_MOVIE)) { - snprintf(dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir); - } else { - return FALSE; - } + return FALSE; } if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { - BLI_join_dirfile(name, FILE_MAX, dir, seq->strip->proxy->file); /* XXX, not real length */ + BLI_join_dirfile(name, PROXY_MAXFILE, + dir, seq->strip->proxy->file); BLI_path_abs(name, G.main->name); return TRUE; } + /* dirty hack to distinguish 100% render size from PROXY_100 */ + if (render_size == 99) { + render_size = 100; + } + /* generate a separate proxy directory for each preview size */ - switch(seq->type) { - case SEQ_IMAGE: + if (seq->type == SEQ_IMAGE) { snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, context.preview_render_size, give_stripelem(seq, cfra)->name); frameno = 1; - break; - case SEQ_MOVIE: - frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; - snprintf(name, PROXY_MAXFILE, "%s/%s/%d/####", dir, - seq->strip->stripdata->name, context.preview_render_size); - break; - default: - frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; + } else { + frameno = (int) give_stripelem_index(seq, cfra) + + seq->anim_startofs; snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, context.preview_render_size); } @@ -1182,13 +1254,18 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int cfra) { char name[PROXY_MAXFILE]; + IMB_Proxy_Size psize = seq_rendersize_to_proxysize( + context.preview_render_size); + int size_flags; if (!(seq->flag & SEQ_USE_PROXY)) { return NULL; } - /* rendering at 100% ? No real sense in proxy-ing, right? */ - if (context.preview_render_size == 100) { + size_flags = seq->strip->proxy->build_size_flags; + + /* only use proxies, if they are enabled (even if present!) */ + if (psize != IMB_PROXY_NONE && ((size_flags & psize) != psize)) { return NULL; } @@ -1199,13 +1276,19 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int return NULL; } - seq->strip->proxy->anim = openanim(name, IB_rect); + seq->strip->proxy->anim = openanim(name, IB_rect, 0); } if (seq->strip->proxy->anim==NULL) { return NULL; } - return IMB_anim_absolute(seq->strip->proxy->anim, frameno); + seq_open_anim_file(seq); + + frameno = IMB_anim_index_get_frame_index( + seq->anim, seq->strip->proxy->tc, frameno); + + return IMB_anim_absolute(seq->strip->proxy->anim, frameno, + IMB_TC_NONE, IMB_PROXY_NONE); } if (seq_proxy_get_fname(context, seq, cfra, name) == 0) { @@ -1219,67 +1302,30 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int } } -#if 0 -static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int cfra, - int build_proxy_run, int preview_render_size); - -static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int preview_render_size, int seqrectx, int seqrecty) +static void seq_proxy_build_frame(SeqRenderData context, + Sequence* seq, int cfra, + int proxy_render_size) { char name[PROXY_MAXFILE]; int quality; - TStripElem * se; - int ok; int rectx, recty; + int ok; struct ImBuf * ibuf; - if (!(seq->flag & SEQ_USE_PROXY)) { - return; - } - - /* rendering at 100% ? No real sense in proxy-ing, right? */ - if (preview_render_size == 100) { + if (!seq_proxy_get_fname(context, seq, cfra, name)) { return; } - /* that's why it is called custom... */ - if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { - return; - } + ibuf = seq_render_strip(context, seq, cfra); - if (!seq_proxy_get_fname(scene, seq, cfra, name, preview_render_size)) { - return; - } - - se = give_tstripelem(seq, cfra); - if (!se) { - return; - } - - if(se->ibuf) { - IMB_freeImBuf(se->ibuf); - se->ibuf = 0; - } - - do_build_seq_ibuf(scene, seq, se, cfra, TRUE, preview_render_size, - seqrectx, seqrecty); - - if (!se->ibuf) { - return; - } - - rectx= (preview_render_size*scene->r.xsch)/100; - recty= (preview_render_size*scene->r.ysch)/100; - - ibuf = se->ibuf; + rectx = (proxy_render_size * context.scene->r.xsch) / 100; + recty = (proxy_render_size * context.scene->r.ysch) / 100; if (ibuf->x != rectx || ibuf->y != recty) { IMB_scalefastImBuf(ibuf, (short)rectx, (short)recty); } - /* quality is fixed, otherwise one has to generate separate - directories for every quality... - - depth = 32 is intentionally left in, otherwise ALPHA channels + /* depth = 32 is intentionally left in, otherwise ALPHA channels won't work... */ quality = seq->strip->proxy->quality; ibuf->ftype= JPG | quality; @@ -1292,69 +1338,80 @@ static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int pr } IMB_freeImBuf(ibuf); - se->ibuf = 0; } -static void seq_proxy_rebuild(Scene *scene, Sequence * seq, int seqrectx, - int seqrecty) +void seq_proxy_rebuild(struct Main * bmain, Scene *scene, Sequence * seq, + short *stop, short *do_update, float *progress) { + SeqRenderData context; int cfra; - float rsize = seq->strip->proxy->size; + int tc_flags; + int size_flags; + int quality; + + if (!seq->strip || !seq->strip->proxy) { + return; + } + + if (!(seq->flag & SEQ_USE_PROXY)) { + return; + } - waitcursor(1); + tc_flags = seq->strip->proxy->build_tc_flags; + size_flags = seq->strip->proxy->build_size_flags; + quality = seq->strip->proxy->quality; - G.afbreek = 0; + if (seq->type == SEQ_MOVIE) { + seq_open_anim_file(seq); - /* flag management tries to account for strobe and - other "non-linearities", that might come in the future... - better way would be to "touch" the files, so that _really_ - no one is rebuild twice. - */ + if (seq->anim) { + IMB_anim_index_rebuild( + seq->anim, tc_flags, size_flags, quality, + stop, do_update, progress); + } + return; + } - for (cfra = seq->startdisp; cfra < seq->enddisp; cfra++) { - TStripElem * tse = give_tstripelem(seq, cfra); + if (!(seq->flag & SEQ_USE_PROXY)) { + return; + } - tse->flag &= ~STRIPELEM_PREVIEW_DONE; + /* that's why it is called custom... */ + if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + return; } - + /* fail safe code */ - /* a _lot_ faster for movie files, if we read frames in - sequential order */ - if (seq->flag & SEQ_REVERSE_FRAMES) { - for (cfra = seq->enddisp-seq->endstill-1; - cfra >= seq->startdisp + seq->startstill; cfra--) { - TStripElem * tse = give_tstripelem(seq, cfra); - - if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) { -//XXX set_timecursor(cfra); - seq_proxy_build_frame(scene, seq, cfra, rsize, - seqrectx, seqrecty); - tse->flag |= STRIPELEM_PREVIEW_DONE; - } - if (blender_test_break()) { - break; - } + context = seq_new_render_data( + bmain, scene, + (scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f, + (scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f, + 100); + + for (cfra = seq->startdisp + seq->startstill; + cfra < seq->enddisp - seq->endstill; cfra++) { + if (size_flags & IMB_PROXY_25) { + seq_proxy_build_frame(context, seq, cfra, 25); } - } else { - for (cfra = seq->startdisp + seq->startstill; - cfra < seq->enddisp - seq->endstill; cfra++) { - TStripElem * tse = give_tstripelem(seq, cfra); - - if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) { -//XXX set_timecursor(cfra); - seq_proxy_build_frame(scene, seq, cfra, rsize, - seqrectx, seqrecty); - tse->flag |= STRIPELEM_PREVIEW_DONE; - } - if (blender_test_break()) { - break; - } + if (size_flags & IMB_PROXY_50) { + seq_proxy_build_frame(context, seq, cfra, 50); + } + if (size_flags & IMB_PROXY_75) { + seq_proxy_build_frame(context, seq, cfra, 75); } + if (size_flags & IMB_PROXY_100) { + seq_proxy_build_frame(context, seq, cfra, 100); + } + + *progress= (float)cfra/(seq->enddisp - seq->endstill + - seq->startdisp + seq->startstill); + *do_update= 1; + + if(*stop || G.afbreek) + break; } - waitcursor(0); } -#endif /* ********************************************************************** @@ -1571,6 +1628,8 @@ static ImBuf * input_preprocess( { float mul; + ibuf = IMB_makeSingleUser(ibuf); + if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) { IMB_filtery(ibuf); } @@ -2096,17 +2155,20 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr } case SEQ_MOVIE: { - if(seq->anim==NULL) { - BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(name, G.main->name); - - seq->anim = openanim(name, IB_rect | - ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0)); - } + seq_open_anim_file(seq); if(seq->anim) { - IMB_anim_set_preseek(seq->anim, seq->anim_preseek); - ibuf = IMB_anim_absolute(seq->anim, nr + seq->anim_startofs); + IMB_anim_set_preseek(seq->anim, + seq->anim_preseek); + + ibuf = IMB_anim_absolute( + seq->anim, nr + seq->anim_startofs, + seq->strip->proxy ? + seq->strip->proxy->tc + : IMB_TC_RECORD_RUN, + seq_rendersize_to_proxysize( + context.preview_render_size)); + /* we don't need both (speed reasons)! */ if (ibuf && ibuf->rect_float && ibuf->rect) imb_freerectImBuf(ibuf); @@ -3584,7 +3646,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo BLI_strncpy(path, seq_load->path, sizeof(path)); BLI_path_abs(path, G.main->name); - an = openanim(path, IB_rect); + an = openanim(path, IB_rect, 0); if(an==NULL) return NULL; @@ -3600,7 +3662,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo /* basic defaults */ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); - strip->len = seq->len = IMB_anim_get_duration( an ); + strip->len = seq->len = IMB_anim_get_duration( an, IMB_TC_RECORD_RUN ); strip->us= 1; /* we only need 1 element for MOVIE strips */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f3b478b90f9..df7e1f80cbd 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9951,12 +9951,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(ed) { SEQP_BEGIN(ed, seq) { if (seq->strip && seq->strip->proxy){ - if (sce->r.size != 100.0) { - seq->strip->proxy->size - = sce->r.size; - } else { - seq->strip->proxy->size = 25; - } seq->strip->proxy->quality =90; } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 2faac24fd78..67123476f06 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2369,6 +2369,7 @@ void uiTemplateOperatorSearch(uiLayout *layout) #define B_STOPCAST 2 #define B_STOPANIM 3 #define B_STOPCOMPO 4 +#define B_STOPSEQ 5 static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) { @@ -2385,6 +2386,9 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) case B_STOPCOMPO: WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL); break; + case B_STOPSEQ: + WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL); + break; } } @@ -2406,8 +2410,11 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) if(WM_jobs_test(wm, sa)) owner = sa; handle_event= B_STOPCOMPO; - } - else { + } else if (sa->spacetype==SPACE_SEQ) { + if(WM_jobs_test(wm, sa)) + owner = sa; + handle_event = B_STOPSEQ; + } else { Scene *scene; /* another scene can be rendering too, for example via compositor */ for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next) diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 66e844e67a8..4011f038be8 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -113,7 +113,7 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, if(ima->source==IMA_SRC_MOVIE) { ofs+= sprintf(str, "Movie"); if(ima->anim) - ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim)); + ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN)); } else ofs+= sprintf(str, "Image"); @@ -428,7 +428,7 @@ static void set_frames_cb(bContext *C, void *ima_v, void *iuser_v) ImageUser *iuser= iuser_v; if(ima->anim) { - iuser->frames = IMB_anim_get_duration(ima->anim); + iuser->frames = IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN); BKE_image_user_calc_frame(iuser, scene->r.cfra, 0); } } diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript index 65bbf900556..3430c10b766 100644 --- a/source/blender/editors/space_sequencer/SConscript +++ b/source/blender/editors/space_sequencer/SConscript @@ -8,4 +8,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna ../../blenloader' incs += ' #/intern/audaspace/intern' +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): + incs += ' ' + env['BF_PTHREADS_INC'] + env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), [], libtype=['core'], priority=[100] ) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e876da41bd9..18ff33fd8a9 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -47,6 +47,7 @@ #include "BLI_math.h" #include "BLI_storage_types.h" #include "BLI_utildefines.h" +#include "BLI_threads.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" @@ -125,6 +126,111 @@ typedef struct TransSeq { int len; } TransSeq; +/* ********************************************************************** */ + +/* ***************** proxy job manager ********************** */ + +typedef struct ProxyBuildJob { + Scene *scene; + struct Main * main; + ListBase queue; + ThreadMutex queue_lock; +} ProxyJob; + +static void proxy_freejob(void *pjv) +{ + ProxyJob *pj= pjv; + Sequence * seq; + + for (seq = pj->queue.first; seq; seq = seq->next) { + BLI_remlink(&pj->queue, seq); + seq_free_sequence_recurse(pj->scene, seq); + } + + BLI_mutex_end(&pj->queue_lock); + + MEM_freeN(pj); +} + +/* only this runs inside thread */ +static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress) +{ + ProxyJob *pj = pjv; + + while (!*stop) { + Sequence * seq; + + BLI_mutex_lock(&pj->queue_lock); + + if (!pj->queue.first) { + BLI_mutex_unlock(&pj->queue_lock); + break; + } + + seq = pj->queue.first; + + BLI_remlink(&pj->queue, seq); + BLI_mutex_unlock(&pj->queue_lock); + + seq_proxy_rebuild(pj->main, pj->scene, seq, + stop, do_update, progress); + seq_free_sequence_recurse(pj->scene, seq); + } + + if (*stop) { + fprintf(stderr, + "Canceling proxy rebuild on users request...\n"); + } +} + +static void proxy_endjob(void *UNUSED(customdata)) +{ + +} + +void seq_proxy_build_job(const bContext *C, Sequence * seq) +{ + wmJob * steve; + ProxyJob *pj; + Scene *scene= CTX_data_scene(C); + ScrArea * sa= CTX_wm_area(C); + + seq = seq_dupli_recursive(scene, scene, seq, 0); + + steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), + sa, "Building Proxies", WM_JOB_PROGRESS); + + pj = WM_jobs_get_customdata(steve); + + if (!pj) { + pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job"); + + pj->scene= scene; + pj->main = CTX_data_main(C); + + BLI_mutex_init(&pj->queue_lock); + + WM_jobs_customdata(steve, pj, proxy_freejob); + WM_jobs_timer(steve, 0.1, NC_SCENE|ND_SEQUENCER, + NC_SCENE|ND_SEQUENCER); + WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, + proxy_endjob); + } + + BLI_mutex_lock(&pj->queue_lock); + BLI_addtail(&pj->queue, seq); + BLI_mutex_unlock(&pj->queue_lock); + + if (!WM_jobs_is_running(steve)) { + G.afbreek = 0; + WM_jobs_start(CTX_wm_manager(C), steve); + } + + ED_area_tag_redraw(CTX_wm_area(C)); +} + +/* ********************************************************************** */ + void seq_rectf(Sequence *seq, rctf *rectf) { if(seq->startstill) rectf->xmin= seq->start; @@ -2690,6 +2796,37 @@ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot) WM_operator_properties_gesture_border(ot, FALSE); } +/* rebuild_proxy operator */ +static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); + Sequence * seq; + + SEQP_BEGIN(ed, seq) { + if ((seq->flag & SELECT)) { + seq_proxy_build_job(C, seq); + } + } + SEQ_END + + return OPERATOR_FINISHED; +} + +void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Rebuild Proxy and Timecode Indices"; + ot->idname= "SEQUENCER_OT_rebuild_proxy"; + ot->description="Rebuild all selected proxies and timecode indeces using the job system"; + + /* api callbacks */ + ot->exec= sequencer_rebuild_proxy_exec; + ot->poll= ED_operator_sequencer_active; + + /* flags */ + ot->flag= OPTYPE_REGISTER; +} /* change ops */ diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 7ab76f9b6d7..89e9a22c9a1 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -118,6 +118,8 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot); void SEQUENCER_OT_copy(struct wmOperatorType *ot); void SEQUENCER_OT_paste(struct wmOperatorType *ot); +void SEQUENCER_OT_rebuild_proxy(struct wmOperatorType *ot); + /* preview specific operators */ void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index df33ce73b9c..5c13b57cca8 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -87,6 +87,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_view_zoom_ratio); WM_operatortype_append(SEQUENCER_OT_view_ghost_border); + WM_operatortype_append(SEQUENCER_OT_rebuild_proxy); WM_operatortype_append(SEQUENCER_OT_change_effect_input); WM_operatortype_append(SEQUENCER_OT_change_effect_type); WM_operatortype_append(SEQUENCER_OT_change_path); diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 18b5eff5c73..ff13be20d4e 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -73,6 +73,7 @@ set(SRC intern/tiff.c intern/util.c intern/writeimage.c + intern/indexer.c IMB_imbuf.h IMB_imbuf_types.h diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 36123592c54..1fbe8e01fd4 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -133,6 +133,7 @@ struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, */ void IMB_refImBuf(struct ImBuf *ibuf); +struct ImBuf * IMB_makeSingleUser(struct ImBuf *ibuf); /** * @@ -192,18 +193,71 @@ void IMB_rectcpy(struct ImBuf *drect, struct ImBuf *srect, int destx, void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx, int desty, int srcx, int srcy, int width, int height, IMB_BlendMode mode); +/** + * + * @attention Defined in indexer.c + */ + +typedef enum IMB_Timecode_Type { + IMB_TC_NONE = 0, /* don't use timecode files at all */ + IMB_TC_RECORD_RUN = 1, /* use images in the order as they are recorded + (currently, this is the only one implemented + and is a sane default) + */ + IMB_TC_FREE_RUN = 2, /* use global timestamp written by recording + device (prosumer camcorders e.g. can do + that) */ + IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN = 4, + /* interpolate a global timestamp using the + record date and time written by recording + device (*every* consumer camcorder can do + that :) )*/ + IMB_TC_MAX_SLOT = 3 +} IMB_Timecode_Type; + +typedef enum IMB_Proxy_Size { + IMB_PROXY_NONE = 0, + IMB_PROXY_25 = 1, + IMB_PROXY_50 = 2, + IMB_PROXY_75 = 4, + IMB_PROXY_100 = 8, + IMB_PROXY_MAX_SLOT = 4 +} IMB_Proxy_Size; + +/* defaults to BL_proxy within the directory of the animation */ +void IMB_anim_set_index_dir(struct anim * anim, const char * dir); + +int IMB_anim_index_get_frame_index(struct anim * anim, IMB_Timecode_Type tc, + int position); + +/* will rebuild all used indices and proxies at once */ +void IMB_anim_index_rebuild(struct anim * anim, + IMB_Timecode_Type build_tcs, + IMB_Proxy_Size build_preview_sizes, + int build_quality, + short *stop, short *do_update, float *progress); + /** * Return the length (in frames) of the given @a anim. */ -int IMB_anim_get_duration(struct anim *anim); +int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc); + + +/** + * Return the fps contained in movie files (function rval is FALSE, + * and frs_sec and frs_sec_base untouched if none available!) + */ +int IMB_anim_get_fps(struct anim * anim, + short * frs_sec, float * frs_sec_base); /** * * @attention Defined in anim.c */ -struct anim *IMB_open_anim(const char *name, int ib_flags); +struct anim *IMB_open_anim(const char *name, int ib_flags, int streamindex); void IMB_close_anim(struct anim *anim); + /** * * @attention Defined in anim.c @@ -218,7 +272,10 @@ int IMB_anim_get_preseek(struct anim *anim); * @attention Defined in anim.c */ -struct ImBuf *IMB_anim_absolute(struct anim *anim, int position); +struct ImBuf *IMB_anim_absolute( + struct anim *anim, int position, + IMB_Timecode_Type tc /* = 1 = IMB_TC_RECORD_RUN */, + IMB_Proxy_Size preview_size /* = 0 = IMB_PROXY_NONE */); /** * @@ -227,12 +284,6 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim, int position); */ struct ImBuf *IMB_anim_previewframe(struct anim *anim); -/** - * - * @attention Defined in anim.c - */ -void IMB_free_anim_ibuf(struct anim *anim); - /** * * @attention Defined in anim.c diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index fba0772dd93..8436846bf2e 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -127,19 +127,22 @@ #define MAXNUMSTREAMS 50 struct _AviMovie; +struct anim_index; struct anim { int ib_flags; int curtype; int curposition; /* index 0 = 1e, 1 = 2e, enz. */ int duration; + short frs_sec; + float frs_sec_base; int x, y; /* voor op nummer */ char name[256]; /* voor sequence */ char first[256]; - + /* movie */ void *movie; void *track; @@ -148,9 +151,7 @@ struct anim { size_t framesize; int interlacing; int preseek; - - /* data */ - struct ImBuf * ibuf1, * ibuf2; + int streamindex; /* avi */ struct _AviMovie *avi; @@ -179,11 +180,26 @@ struct anim { AVFrame *pFrameDeinterlaced; struct SwsContext *img_convert_ctx; int videoStream; + + struct ImBuf * last_frame; + int64_t last_pts; + int64_t next_pts; + int64_t next_undecoded_pts; + AVPacket next_packet; #endif #ifdef WITH_REDCODE struct redcode_handle * redcodeCtx; #endif + + char index_dir[256]; + + int proxies_tried; + int indices_tried; + + struct anim * proxy_anim[IMB_PROXY_MAX_SLOT]; + struct anim_index * curr_idx[IMB_TC_MAX_SLOT]; + }; #endif diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h new file mode 100644 index 00000000000..ae3b48f76c7 --- /dev/null +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -0,0 +1,135 @@ +/** + * IMB_indexer.h + * + * $Id: IMB_indexer.h + * + * ***** 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): Peter Schlaile + * + * ***** END GPL LICENSE BLOCK ***** + */ + + +#ifndef IMB_INDEXER_H +#define IMB_INDEXER_H + +#ifdef WIN32 +#include +#endif + +#include +#include +#include "BKE_utildefines.h" +#include "IMB_anim.h" + +/* + seperate animation index files to solve the following problems: + + a) different timecodes within one file (like DTS/PTS, Timecode-Track, + "implicit" timecodes within DV-files and HDV-files etc.) + b) seeking difficulties within ffmpeg for files with timestamp holes + c) broken files that miss several frames / have varying framerates + d) use proxies accordingly + + ... we need index files, that provide us with + + the binary(!) position, where we have to seek into the file *and* + the continuous frame number (ignoring the holes) starting from the + beginning of the file, so that we know, which proxy frame to serve. + + This index has to be only built once for a file and is written into + the BL_proxy directory structure for later reuse in different blender files. + +*/ + +typedef struct anim_index_entry { + int frameno; + unsigned long long seek_pos; + unsigned long long seek_pos_dts; + unsigned long long pts; +} anim_index_entry; + +struct anim_index { + char name[256]; + + int num_entries; + struct anim_index_entry * entries; +}; + +struct anim_index_builder; + +typedef struct anim_index_builder { + FILE * fp; + char name[FILE_MAXDIR + FILE_MAXFILE]; + char temp_name[FILE_MAXDIR + FILE_MAXFILE]; + + void * private_data; + + void (*delete_priv_data)(struct anim_index_builder * idx); + void (*proc_frame)(struct anim_index_builder * idx, + unsigned char * buffer, + int data_size, + struct anim_index_entry * entry); +} anim_index_builder; + +anim_index_builder * IMB_index_builder_create(const char * name); +void IMB_index_builder_add_entry(anim_index_builder * fp, + int frameno, unsigned long long seek_pos, + unsigned long long seek_pos_dts, + unsigned long long pts); + +void IMB_index_builder_proc_frame(anim_index_builder * fp, + unsigned char * buffer, + int data_size, + int frameno, unsigned long long seek_pos, + unsigned long long seek_pos_dts, + unsigned long long pts); + +void IMB_index_builder_finish(anim_index_builder * fp, int rollback); + +struct anim_index * IMB_indexer_open(const char * name); +unsigned long long IMB_indexer_get_seek_pos( + struct anim_index * idx, int frameno_index); +unsigned long long IMB_indexer_get_seek_pos_dts( + struct anim_index * idx, int frameno_index); + +int IMB_indexer_get_frame_index(struct anim_index * idx, int frameno); +unsigned long long IMB_indexer_get_pts(struct anim_index * idx, + int frame_index); +int IMB_indexer_get_duration(struct anim_index * idx); + +int IMB_indexer_can_scan(struct anim_index * idx, + int old_frame_index, int new_frame_index); + +void IMB_indexer_close(struct anim_index * idx); + +void IMB_free_indices(struct anim * anim); + +int IMB_anim_index_get_frame_index( + struct anim * anim, IMB_Timecode_Type tc, int position); + +struct anim * IMB_anim_open_proxy( + struct anim * anim, IMB_Proxy_Size preview_size); +struct anim_index * IMB_anim_open_index( + struct anim * anim, IMB_Timecode_Type tc); + +int IMB_proxy_size_to_array_index(IMB_Proxy_Size pr_size); +int IMB_timecode_to_array_index(IMB_Timecode_Type tc); + +#endif diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 59772771f3b..6ce6c9409d1 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -177,6 +177,19 @@ void IMB_refImBuf(ImBuf *ibuf) ibuf->refcounter++; } +ImBuf * IMB_makeSingleUser(ImBuf *ibuf) +{ + ImBuf * rval; + + if (!ibuf || ibuf->refcounter == 0) { return ibuf; } + + rval = IMB_dupImBuf(ibuf); + + IMB_freeImBuf(ibuf); + + return rval; +} + short addzbufImBuf(ImBuf *ibuf) { int size; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 8b0104fcdca..7b172008bee 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -57,6 +57,7 @@ #include #include #include +#include #ifndef _WIN32 #include #else @@ -66,6 +67,7 @@ #include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail BLI_countlist BLI_stringdec */ #include "BLI_utildefines.h" +#include "BLI_math_base.h" #include "MEM_guardedalloc.h" @@ -90,6 +92,7 @@ #include "IMB_allocimbuf.h" #include "IMB_anim.h" +#include "IMB_indexer.h" #ifdef WITH_FFMPEG #include @@ -304,15 +307,6 @@ static void free_anim_avi (struct anim *anim) { anim->duration = 0; } -void IMB_free_anim_ibuf(struct anim * anim) { - if (anim == NULL) return; - - if (anim->ibuf1) IMB_freeImBuf(anim->ibuf1); - if (anim->ibuf2) IMB_freeImBuf(anim->ibuf2); - - anim->ibuf1 = anim->ibuf2 = NULL; -} - #ifdef WITH_FFMPEG static void free_anim_ffmpeg(struct anim * anim); #endif @@ -326,7 +320,6 @@ void IMB_free_anim(struct anim * anim) { return; } - IMB_free_anim_ibuf(anim); free_anim_movie(anim); free_anim_avi(anim); @@ -339,6 +332,7 @@ void IMB_free_anim(struct anim * anim) { #ifdef WITH_REDCODE free_anim_redcode(anim); #endif + IMB_free_indices(anim); MEM_freeN(anim); } @@ -350,13 +344,14 @@ void IMB_close_anim(struct anim * anim) { } -struct anim * IMB_open_anim( const char * name, int ib_flags) { +struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) { struct anim * anim; anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct"); if (anim != NULL) { BLI_strncpy(anim->name, name, sizeof(anim->name)); anim->ib_flags = ib_flags; + anim->streamindex = streamindex; } return(anim); } @@ -368,10 +363,13 @@ static int startavi (struct anim *anim) { #if defined(_WIN32) && !defined(FREE_WINDOWS) HRESULT hr; int i, firstvideo = -1; + int streamcount; BYTE abFormat[1024]; LONG l; LPBITMAPINFOHEADER lpbi; AVISTREAMINFO avis; + + streamcount = anim->streamindex; #endif anim->avi = MEM_callocN (sizeof(AviMovie),"animavi"); @@ -396,6 +394,10 @@ static int startavi (struct anim *anim) { AVIStreamInfo(anim->pavi[i], &avis, sizeof(avis)); if ((avis.fccType == streamtypeVIDEO) && (firstvideo == -1)) { + if (streamcount > 0) { + streamcount--; + continue; + } anim->pgf = AVIStreamGetFrameOpen(anim->pavi[i], NULL); if (anim->pgf) { firstvideo = i; @@ -496,14 +498,14 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) { for (y=0; y < anim->y; y++) { memcpy (&(ibuf->rect)[((anim->y-y)-1)*anim->x], &tmp[y*anim->x], - anim->x * 4); + anim->x * 4); } MEM_freeN (tmp); } - + ibuf->profile = IB_PROFILE_SRGB; - + return ibuf; } @@ -517,6 +519,9 @@ static int startffmpeg(struct anim * anim) { AVCodec *pCodec; AVFormatContext *pFormatCtx; AVCodecContext *pCodecCtx; + int frs_num; + double frs_den; + int streamcount; #ifdef FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT /* The following for color space determination */ @@ -527,6 +532,8 @@ static int startffmpeg(struct anim * anim) { if (anim == 0) return(-1); + streamcount = anim->streamindex; + do_init_ffmpeg(); if(av_open_input_file(&pFormatCtx, anim->name, NULL, 0, NULL)!=0) { @@ -541,12 +548,17 @@ static int startffmpeg(struct anim * anim) { av_dump_format(pFormatCtx, 0, anim->name, 0); - /* Find the first video stream */ - videoStream=-1; - for(i=0; inb_streams; i++) - if(pFormatCtx->streams[i]->codec->codec_type + /* Find the video stream */ + videoStream = -1; + + for(i = 0; i < pFormatCtx->nb_streams; i++) + if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - videoStream=i; + if (streamcount > 0) { + streamcount--; + continue; + } + videoStream = i; break; } @@ -557,16 +569,16 @@ static int startffmpeg(struct anim * anim) { pCodecCtx = pFormatCtx->streams[videoStream]->codec; - /* Find the decoder for the video stream */ - pCodec=avcodec_find_decoder(pCodecCtx->codec_id); - if(pCodec==NULL) { + /* Find the decoder for the video stream */ + pCodec = avcodec_find_decoder(pCodecCtx->codec_id); + if(pCodec == NULL) { av_close_input_file(pFormatCtx); return -1; } pCodecCtx->workaround_bugs = 1; - if(avcodec_open(pCodecCtx, pCodec)<0) { + if(avcodec_open(pCodecCtx, pCodec) < 0) { av_close_input_file(pFormatCtx); return -1; } @@ -575,6 +587,19 @@ static int startffmpeg(struct anim * anim) { * av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate) / AV_TIME_BASE); + frs_num = pFormatCtx->streams[videoStream]->r_frame_rate.num; + frs_den = pFormatCtx->streams[videoStream]->r_frame_rate.den; + + frs_den *= AV_TIME_BASE; + + while (frs_num % 10 == 0 && frs_den >= 2.0 && frs_num > 10) { + frs_num /= 10; + frs_den /= 10; + } + + anim->frs_sec = frs_num; + anim->frs_sec_base = frs_den; + anim->params = 0; anim->x = pCodecCtx->width; @@ -584,6 +609,11 @@ static int startffmpeg(struct anim * anim) { anim->framesize = anim->x * anim->y * 4; anim->curposition = -1; + anim->last_frame = 0; + anim->last_pts = -1; + anim->next_pts = -1; + anim->next_undecoded_pts = -1; + anim->next_packet.stream_index = -1; anim->pFormatCtx = pFormatCtx; anim->pCodecCtx = pCodecCtx; @@ -666,10 +696,19 @@ static int startffmpeg(struct anim * anim) { return (0); } -static void ffmpeg_postprocess(struct anim * anim, ImBuf * ibuf, - int * filter_y) +/* postprocess the image in anim->pFrame and do color conversion + and deinterlacing stuff. + + Output is anim->last_frame +*/ + +static void ffmpeg_postprocess(struct anim * anim) { AVFrame * input = anim->pFrame; + ImBuf * ibuf = anim->last_frame; + int filter_y = 0; + + ibuf->profile = IB_PROFILE_SRGB; /* This means the data wasnt read properly, this check stops crashing */ @@ -690,12 +729,16 @@ static void ffmpeg_postprocess(struct anim * anim, ImBuf * ibuf, anim->pCodecCtx->width, anim->pCodecCtx->height) < 0) { - *filter_y = 1; + filter_y = TRUE; } else { input = anim->pFrameDeinterlaced; } } + avpicture_fill((AVPicture*) anim->pFrameRGB, + (unsigned char*) ibuf->rect, + PIX_FMT_RGBA, anim->x, anim->y); + if (ENDIAN_ORDER == B_ENDIAN) { int * dstStride = anim->pFrameRGB->linesize; uint8_t** dst = anim->pFrameRGB->data; @@ -774,150 +817,359 @@ static void ffmpeg_postprocess(struct anim * anim, ImBuf * ibuf, } } } + + if (filter_y) { + IMB_filtery(ibuf); + } } -static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { - ImBuf * ibuf; - int frameFinished; - AVPacket packet; +/* decode one video frame and load the next packet into anim->packet, + so that we can obtain next_pts and next undecoded pts */ + +static int ffmpeg_decode_video_frame(struct anim * anim) +{ + int frameFinished = 0; + int rval = 0; + + av_log(anim->pFormatCtx, AV_LOG_DEBUG, " DECODE VIDEO FRAME\n"); + + anim->next_undecoded_pts = -1; + + if (anim->next_packet.stream_index == anim->videoStream) { + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + " DECODE: cached next packet\n"); + + avcodec_decode_video2(anim->pCodecCtx, + anim->pFrame, &frameFinished, + &anim->next_packet); + + if (frameFinished) { + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + " FRAME DONE: " + "next_pts=%lld pkt_pts=%lld\n", + (anim->pFrame->pts == AV_NOPTS_VALUE) ? + -1 : anim->pFrame->pts, + (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ? + -1 : anim->pFrame->pkt_pts); + anim->next_pts = + av_get_pts_from_frame(anim->pFormatCtx, + anim->pFrame); + } + + av_free_packet(&anim->next_packet); + anim->next_packet.stream_index = -1; + } + + while((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) { + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + "%sREAD: strID=%d (VID: %d) dts=%lld pts=%lld " + "%s\n", + (anim->next_packet.stream_index == anim->videoStream) + ? "->" : " ", + anim->next_packet.stream_index, + anim->videoStream, + (anim->next_packet.dts == AV_NOPTS_VALUE) ? -1: + anim->next_packet.dts, + (anim->next_packet.pts == AV_NOPTS_VALUE) ? -1: + anim->next_packet.pts, + (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? + " KEY" : ""); + if (anim->next_packet.stream_index == anim->videoStream) { + if (frameFinished) { + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + " FRAME finished, we leave\n"); + anim->next_undecoded_pts + = anim->next_packet.dts; + break; + } + + avcodec_decode_video2( + anim->pCodecCtx, + anim->pFrame, &frameFinished, + &anim->next_packet); + + if (frameFinished) { + anim->next_pts = av_get_pts_from_frame( + anim->pFormatCtx, anim->pFrame); + + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + " FRAME DONE: next_pts=%lld " + "pkt_pts=%lld, guessed_pts=%lld\n", + (anim->pFrame->pts == AV_NOPTS_VALUE) ? + -1 : anim->pFrame->pts, + (anim->pFrame->pkt_pts + == AV_NOPTS_VALUE) ? + -1 : anim->pFrame->pkt_pts, + anim->next_pts); + } + } + av_free_packet(&anim->next_packet); + anim->next_packet.stream_index = -1; + } + + if (rval < 0) { + av_log(anim->pFormatCtx, + AV_LOG_ERROR, " DECODE READ FAILED: av_read_frame() " + "returned error: %d\n", rval); + } + return (rval >= 0); +} + +static void ffmpeg_decode_video_frame_scan( + struct anim * anim, int64_t pts_to_search) +{ + /* there seem to exist *very* silly GOP lengths out in the wild... */ + int count = 1000; + + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + "SCAN start: considering pts=%lld in search of %lld\n", + anim->next_pts, pts_to_search); + + while (count > 0 && anim->next_pts < pts_to_search) { + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + " WHILE: pts=%lld in search of %lld\n", + anim->next_pts, pts_to_search); + if (!ffmpeg_decode_video_frame(anim)) { + break; + } + count--; + } + if (count == 0) { + av_log(anim->pFormatCtx, + AV_LOG_ERROR, + "SCAN failed: completely lost in stream, " + "bailing out at PTS=%lld, searching for PTS=%lld\n", + anim->next_pts, pts_to_search); + } + if (anim->next_pts == pts_to_search) { + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, "SCAN HAPPY: we found our PTS!\n"); + } else { + av_log(anim->pFormatCtx, + AV_LOG_ERROR, "SCAN UNHAPPY: PTS not matched!\n"); + } +} + +static int match_format(const char *name, AVFormatContext * pFormatCtx) +{ + const char *p; + int len, namelen; + + const char *names = pFormatCtx->iformat->name; + + if (!name || !names) + return 0; + + namelen = strlen(name); + while ((p = strchr(names, ','))) { + len = MAX2(p - names, namelen); + if (!BLI_strncasecmp(name, names, len)) + return 1; + names = p+1; + } + return !BLI_strcasecmp(name, names); +} + +static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx) +{ + static const char * byte_seek_list [] = { "dv", "mpegts", 0 }; + const char ** p; + + if (pFormatCtx->iformat->flags & AVFMT_TS_DISCONT) { + return TRUE; + } + + p = byte_seek_list; + + while (*p) { + if (match_format(*p++, pFormatCtx)) { + return TRUE; + } + } + + return FALSE; +} + +static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, + IMB_Timecode_Type tc) { int64_t pts_to_search = 0; - int pos_found = 1; - int filter_y = 0; - int seek_by_bytes= 0; - int preseek_count = 0; + double frame_rate; + double pts_time_base; + long long st_time; + struct anim_index * tc_index = 0; + AVStream * v_st; + int new_frame_index; + int old_frame_index; if (anim == 0) return (0); - ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: pos=%d\n", position); - avpicture_fill((AVPicture*) anim->pFrameRGB, - (unsigned char*) ibuf->rect, - PIX_FMT_RGBA, anim->x, anim->y); - - if (position != anim->curposition + 1) { - if (position > anim->curposition + 1 - && anim->preseek - && position - (anim->curposition + 1) < anim->preseek) { - while(av_read_frame(anim->pFormatCtx, &packet)>=0) { - if (packet.stream_index == anim->videoStream) { - avcodec_decode_video2( - anim->pCodecCtx, - anim->pFrame, &frameFinished, - &packet); - - if (frameFinished) { - anim->curposition++; - } - } - av_free_packet(&packet); - if (position == anim->curposition+1) { - break; - } - } + if (tc != IMB_TC_NONE) { + tc_index = IMB_anim_open_index(anim, tc); + } + + v_st = anim->pFormatCtx->streams[anim->videoStream]; + + frame_rate = av_q2d(v_st->r_frame_rate); + + st_time = anim->pFormatCtx->start_time; + pts_time_base = av_q2d(v_st->time_base); + + if (tc_index) { + new_frame_index = IMB_indexer_get_frame_index( + tc_index, position); + old_frame_index = IMB_indexer_get_frame_index( + tc_index, anim->curposition); + pts_to_search = IMB_indexer_get_pts( + tc_index, new_frame_index); + } else { + pts_to_search = (long long) + floor(((double) position) / pts_time_base / frame_rate + 0.5); + + if (st_time != AV_NOPTS_VALUE) { + pts_to_search += st_time / pts_time_base + / AV_TIME_BASE; } } -/* disable seek_by_bytes for now, since bitrates are guessed wrong! - also: MPEG2TS-seeking was fixed in later versions of ffmpeg, so problem - is somewhat fixed by now (until we add correct timecode management code...) -*/ -#if 0 - seek_by_bytes = !!(anim->pFormatCtx->iformat->flags & AVFMT_TS_DISCONT); -#else - seek_by_bytes = FALSE; -#endif + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "FETCH: looking for PTS=%lld " + "(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n", + pts_to_search, pts_time_base, frame_rate, st_time); + + if (anim->last_frame && + anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search){ + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "FETCH: frame repeat: last: %lld next: %lld\n", + anim->last_pts, anim->next_pts); + IMB_refImBuf(anim->last_frame); + anim->curposition = position; + return anim->last_frame; + } + + IMB_freeImBuf(anim->last_frame); + + if (anim->next_pts <= pts_to_search && + anim->next_undecoded_pts > pts_to_search) { + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "FETCH: no seek necessary: " + "next: %lld next undecoded: %lld\n", + anim->next_pts, anim->next_undecoded_pts); + + /* we are already done :) */ + + } else if (position > anim->curposition + 1 + && anim->preseek + && !tc_index + && position - (anim->curposition + 1) < anim->preseek) { + + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "FETCH: within preseek interval (no index)\n"); + + ffmpeg_decode_video_frame_scan(anim, pts_to_search); + } else if (tc_index && + IMB_indexer_can_scan(tc_index, old_frame_index, + new_frame_index)) { + + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "FETCH: within preseek interval " + "(index tells us)\n"); - if (position != anim->curposition + 1) { - double frame_rate = - av_q2d(anim->pFormatCtx->streams[anim->videoStream] - ->r_frame_rate); - double pts_time_base = av_q2d(anim->pFormatCtx->streams[anim->videoStream]->time_base); + ffmpeg_decode_video_frame_scan(anim, pts_to_search); + } else if (position != anim->curposition + 1) { long long pos; - long long st_time = anim->pFormatCtx->start_time; int ret; - if (seek_by_bytes) { - pos = position - anim->preseek; - if (pos < 0) { - pos = 0; - } - preseek_count = position - pos; + if (tc_index) { + unsigned long long dts; + + pos = IMB_indexer_get_seek_pos( + tc_index, new_frame_index); + dts = IMB_indexer_get_seek_pos_dts( + tc_index, new_frame_index); + + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "TC INDEX seek pos = %lld\n", pos); + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "TC INDEX seek dts = %lld\n", dts); - pos *= anim->pFormatCtx->bit_rate / frame_rate; - pos /= 8; + if (ffmpeg_seek_by_byte(anim->pFormatCtx)) { + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "... using BYTE pos\n"); + + ret = av_seek_frame(anim->pFormatCtx, + -1, + pos, AVSEEK_FLAG_BYTE); + av_update_cur_dts(anim->pFormatCtx, v_st, dts); + } else { + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "... using DTS pos\n"); + ret = av_seek_frame(anim->pFormatCtx, + anim->videoStream, + dts, AVSEEK_FLAG_BACKWARD); + } } else { pos = (long long) (position - anim->preseek) * AV_TIME_BASE / frame_rate; if (pos < 0) { pos = 0; } - + if (st_time != AV_NOPTS_VALUE) { pos += st_time; } - } - ret = av_seek_frame(anim->pFormatCtx, -1, - pos, - AVSEEK_FLAG_BACKWARD | ( - seek_by_bytes - ? AVSEEK_FLAG_ANY - | AVSEEK_FLAG_BYTE : 0)); - if (ret < 0) { - fprintf(stderr, "error while seeking: %d\n", ret); + ret = av_seek_frame(anim->pFormatCtx, -1, + pos, AVSEEK_FLAG_BACKWARD); } - pts_to_search = (long long) - (((double) position) / pts_time_base / frame_rate); - if (st_time != AV_NOPTS_VALUE) { - pts_to_search += st_time / pts_time_base/ AV_TIME_BASE; + if (ret < 0) { + av_log(anim->pFormatCtx, AV_LOG_ERROR, + "FETCH: " + "error while seeking to DTS = %lld " + "(frameno = %d, PTS = %lld): errcode = %d\n", + pos, position, pts_to_search, ret); } - pos_found = 0; avcodec_flush_buffers(anim->pCodecCtx); - } - while(av_read_frame(anim->pFormatCtx, &packet)>=0) { - if(packet.stream_index == anim->videoStream) { - avcodec_decode_video2(anim->pCodecCtx, - anim->pFrame, &frameFinished, - &packet); + anim->next_pts = -1; - if (seek_by_bytes && preseek_count > 0) { - preseek_count--; - } + if (anim->next_packet.stream_index == anim->videoStream) { + av_free_packet(&anim->next_packet); + anim->next_packet.stream_index = -1; + } - if (frameFinished && !pos_found) { - if (seek_by_bytes) { - if (!preseek_count) { - pos_found = 1; - anim->curposition = position; - } - } else { - if (packet.dts >= pts_to_search) { - pos_found = 1; - anim->curposition = position; - } - } - } + /* memset(anim->pFrame,...) ?? */ - if(frameFinished && pos_found == 1) { - ffmpeg_postprocess(anim, ibuf, &filter_y); - av_free_packet(&packet); - break; - } + if (ret >= 0) { + ffmpeg_decode_video_frame_scan(anim, pts_to_search); } - - av_free_packet(&packet); + } else if (position == 0 && anim->curposition == -1) { + /* first frame without seeking special case... */ + ffmpeg_decode_video_frame(anim); } - if (filter_y && ibuf) { - IMB_filtery(ibuf); - } + anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); - ibuf->profile = IB_PROFILE_SRGB; + ffmpeg_postprocess(anim); - return(ibuf); + anim->last_pts = anim->next_pts; + + ffmpeg_decode_video_frame(anim); + + anim->curposition = position; + + IMB_refImBuf(anim->last_frame); + + return anim->last_frame; } static void free_anim_ffmpeg(struct anim * anim) { @@ -934,6 +1186,10 @@ static void free_anim_ffmpeg(struct anim * anim) { } av_free(anim->pFrameDeinterlaced); sws_freeContext(anim->img_convert_ctx); + IMB_freeImBuf(anim->last_frame); + if (anim->next_packet.stream_index != -1) { + av_free_packet(&anim->next_packet); + } } anim->duration = 0; } @@ -1063,16 +1319,19 @@ struct ImBuf * IMB_anim_previewframe(struct anim * anim) { struct ImBuf * ibuf = NULL; int position = 0; - ibuf = IMB_anim_absolute(anim, 0); + ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE); if (ibuf) { IMB_freeImBuf(ibuf); position = anim->duration / 2; - ibuf = IMB_anim_absolute(anim, position); + ibuf = IMB_anim_absolute(anim, position, IMB_TC_NONE, + IMB_PROXY_NONE); } return ibuf; } -struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { +struct ImBuf * IMB_anim_absolute(struct anim * anim, int position, + IMB_Timecode_Type tc, + IMB_Proxy_Size preview_size) { struct ImBuf * ibuf = NULL; char head[256], tail[256]; unsigned short digits; @@ -1095,6 +1354,18 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { if (position < 0) return(NULL); if (position >= anim->duration) return(NULL); + if (preview_size != IMB_PROXY_NONE) { + struct anim * proxy = IMB_anim_open_proxy(anim, preview_size); + + if (proxy) { + position = IMB_anim_index_get_frame_index( + anim, tc, position); + return IMB_anim_absolute( + proxy, position, + IMB_TC_NONE, IMB_PROXY_NONE); + } + } + switch(anim->curtype) { case ANIM_SEQUENCE: pic = an_stringdec(anim->first, head, tail, &digits); @@ -1127,7 +1398,7 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { #endif #ifdef WITH_FFMPEG case ANIM_FFMPEG: - ibuf = ffmpeg_fetchibuf(anim, position); + ibuf = ffmpeg_fetchibuf(anim, position, tc); if (ibuf) anim->curposition = position; filter_y = 0; /* done internally */ @@ -1151,8 +1422,29 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { /***/ -int IMB_anim_get_duration(struct anim *anim) { - return anim->duration; +int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc) { + struct anim_index * idx; + if (tc == IMB_TC_NONE) { + return anim->duration; + } + + idx = IMB_anim_open_index(anim, tc); + if (!idx) { + return anim->duration; + } + + return IMB_indexer_get_duration(idx); +} + +int IMB_anim_get_fps(struct anim * anim, + short * frs_sec, float * frs_sec_base) +{ + if (anim->frs_sec) { + *frs_sec = anim->frs_sec; + *frs_sec_base = anim->frs_sec_base; + return TRUE; + } + return FALSE; } void IMB_anim_set_preseek(struct anim * anim, int preseek) diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 7f1eef80318..2677913caed 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -1,4 +1,6 @@ /* + * + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c new file mode 100644 index 00000000000..f624694b324 --- /dev/null +++ b/source/blender/imbuf/intern/indexer.c @@ -0,0 +1,1135 @@ +/* + * $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. + * + * Peter Schlaile 2011 + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** +*/ + +#include "IMB_indexer.h" +#include "IMB_anim.h" +#include "AVI_avi.h" +#include "imbuf.h" +#include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" +#include "BLI_blenlib.h" +#include "BLI_math_base.h" +#include "BLI_string.h" +#include "MEM_guardedalloc.h" +#include "DNA_userdef_types.h" +#include "BKE_global.h" +#include + +#ifdef WITH_FFMPEG + +#include "ffmpeg_compat.h" + +#endif //WITH_FFMPEG + + +static char magic[] = "BlenMIdx"; +static char temp_ext [] = "_part"; + +static int proxy_sizes[] = { IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75, + IMB_PROXY_100 }; +static float proxy_fac[] = { 0.25, 0.50, 0.75, 1.00 }; +static int tc_types[] = { IMB_TC_RECORD_RUN, IMB_TC_FREE_RUN, + IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN }; + +#define INDEX_FILE_VERSION 1 + +/* ---------------------------------------------------------------------- + - special indexers + ---------------------------------------------------------------------- + */ + +extern void IMB_indexer_dv_new(anim_index_builder * idx); + + +/* ---------------------------------------------------------------------- + - time code index functions + ---------------------------------------------------------------------- */ + +anim_index_builder * IMB_index_builder_create(const char * name) +{ + + anim_index_builder * rv + = MEM_callocN( sizeof(struct anim_index_builder), + "index builder"); + + fprintf(stderr, "Starting work on index: %s\n", name); + + BLI_strncpy(rv->name, name, sizeof(rv->name)); + BLI_strncpy(rv->temp_name, name, sizeof(rv->temp_name)); + + strcat(rv->temp_name, temp_ext); + + BLI_make_existing_file(rv->temp_name); + + rv->fp = fopen(rv->temp_name, "w"); + + if (!rv->fp) { + fprintf(stderr, "Couldn't open index target: %s! " + "Index build broken!\n", rv->temp_name); + MEM_freeN(rv); + return NULL; + } + + fprintf(rv->fp, "%s%c%.3d", magic, (ENDIAN_ORDER==B_ENDIAN)?'V':'v', + INDEX_FILE_VERSION); + + return rv; +} + +void IMB_index_builder_add_entry(anim_index_builder * fp, + int frameno,unsigned long long seek_pos, + unsigned long long seek_pos_dts, + unsigned long long pts) +{ + fwrite(&frameno, sizeof(int), 1, fp->fp); + fwrite(&seek_pos, sizeof(unsigned long long), 1, fp->fp); + fwrite(&seek_pos_dts, sizeof(unsigned long long), 1, fp->fp); + fwrite(&pts, sizeof(unsigned long long), 1, fp->fp); +} + +void IMB_index_builder_proc_frame(anim_index_builder * fp, + unsigned char * buffer, + int data_size, + int frameno, unsigned long long seek_pos, + unsigned long long seek_pos_dts, + unsigned long long pts) +{ + if (fp->proc_frame) { + anim_index_entry e; + e.frameno = frameno; + e.seek_pos = seek_pos; + e.seek_pos_dts = seek_pos_dts; + e.pts = pts; + + fp->proc_frame(fp, buffer, data_size, &e); + } else { + IMB_index_builder_add_entry(fp, frameno, seek_pos, + seek_pos_dts, pts); + } +} + +void IMB_index_builder_finish(anim_index_builder * fp, int rollback) +{ + if (fp->delete_priv_data) { + fp->delete_priv_data(fp); + } + + fclose(fp->fp); + + if (rollback) { + unlink(fp->temp_name); + } else { + rename(fp->temp_name, fp->name); + } + + MEM_freeN(fp); +} + +struct anim_index * IMB_indexer_open(const char * name) +{ + char header[13]; + struct anim_index * idx; + FILE * fp = fopen(name, "rb"); + int i; + + if (!fp) { + return 0; + } + + if (fread(header, 12, 1, fp) != 1) { + fclose(fp); + return 0; + } + + header[12] = 0; + + if (memcmp(header, magic, 8) != 0) { + fclose(fp); + return 0; + } + + if (atoi(header+9) != INDEX_FILE_VERSION) { + fclose(fp); + return 0; + } + + idx = MEM_callocN( sizeof(struct anim_index), "anim_index"); + + BLI_strncpy(idx->name, name, sizeof(idx->name)); + + fseek(fp, 0, SEEK_END); + + idx->num_entries = (ftell(fp) - 12) + / (sizeof(int) // framepos + + sizeof(unsigned long long) // seek_pos + + sizeof(unsigned long long) // seek_pos_dts + + sizeof(unsigned long long) // pts + ); + + fseek(fp, 12, SEEK_SET); + + idx->entries = MEM_callocN( sizeof(struct anim_index_entry) + * idx->num_entries, "anim_index_entries"); + + for (i = 0; i < idx->num_entries; i++) { + fread(&idx->entries[i].frameno, + sizeof(int), 1, fp); + fread(&idx->entries[i].seek_pos, + sizeof(unsigned long long), 1, fp); + fread(&idx->entries[i].seek_pos_dts, + sizeof(unsigned long long), 1, fp); + fread(&idx->entries[i].pts, + sizeof(unsigned long long), 1, fp); + } + + if (((ENDIAN_ORDER == B_ENDIAN) != (header[8] == 'V'))) { + for (i = 0; i < idx->num_entries; i++) { + SWITCH_INT(idx->entries[i].frameno); + SWITCH_INT64(idx->entries[i].seek_pos); + SWITCH_INT64(idx->entries[i].seek_pos_dts); + SWITCH_INT64(idx->entries[i].pts); + } + } + + fclose(fp); + + return idx; +} + +unsigned long long IMB_indexer_get_seek_pos( + struct anim_index * idx, int frame_index) +{ + if (frame_index < 0) { + frame_index = 0; + } + if (frame_index >= idx->num_entries) { + frame_index = idx->num_entries - 1; + } + return idx->entries[frame_index].seek_pos; +} + +unsigned long long IMB_indexer_get_seek_pos_dts( + struct anim_index * idx, int frame_index) +{ + if (frame_index < 0) { + frame_index = 0; + } + if (frame_index >= idx->num_entries) { + frame_index = idx->num_entries - 1; + } + return idx->entries[frame_index].seek_pos_dts; +} + +int IMB_indexer_get_frame_index(struct anim_index * idx, int frameno) +{ + int len = idx->num_entries; + int half; + int middle; + int first = 0; + + /* bsearch (lower bound) the right index */ + + while (len > 0) { + half = len >> 1; + middle = first; + + middle += half; + + if (idx->entries[middle].frameno < frameno) { + first = middle; + ++first; + len = len - half - 1; + } else { + len = half; + } + } + + if (first == idx->num_entries) { + return idx->num_entries - 1; + } else { + return first; + } +} + +unsigned long long IMB_indexer_get_pts(struct anim_index * idx, + int frame_index) +{ + if (frame_index < 0) { + frame_index = 0; + } + if (frame_index >= idx->num_entries) { + frame_index = idx->num_entries - 1; + } + return idx->entries[frame_index].pts; +} + +int IMB_indexer_get_duration(struct anim_index * idx) +{ + if (idx->num_entries == 0) { + return 0; + } + return idx->entries[idx->num_entries-1].frameno + 1; +} + +int IMB_indexer_can_scan(struct anim_index * idx, + int old_frame_index, int new_frame_index) +{ + /* makes only sense, if it is the same I-Frame and we are not + trying to run backwards in time... */ + return (IMB_indexer_get_seek_pos(idx, old_frame_index) + == IMB_indexer_get_seek_pos(idx, new_frame_index) && + old_frame_index < new_frame_index); +} + +void IMB_indexer_close(struct anim_index * idx) +{ + MEM_freeN(idx->entries); + MEM_freeN(idx); +} + +int IMB_proxy_size_to_array_index(IMB_Proxy_Size pr_size) +{ + switch (pr_size) { + case IMB_PROXY_NONE: /* if we got here, something is broken anyways, + so sane defaults... */ + return 0; + case IMB_PROXY_25: + return 0; + case IMB_PROXY_50: + return 1; + case IMB_PROXY_75: + return 2; + case IMB_PROXY_100: + return 3; + default: + return 0; + }; + return 0; +} + +int IMB_timecode_to_array_index(IMB_Timecode_Type tc) +{ + switch (tc) { + case IMB_TC_NONE: /* if we got here, something is broken anyways, + so sane defaults... */ + return 0; + case IMB_TC_RECORD_RUN: + return 0; + case IMB_TC_FREE_RUN: + return 1; + case IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN: + return 2; + default: + return 0; + }; + return 0; +} + + +/* ---------------------------------------------------------------------- + - rebuild helper functions + ---------------------------------------------------------------------- */ + +static void get_index_dir(struct anim * anim, char * index_dir) +{ + if (!anim->index_dir[0]) { + char fname[FILE_MAXFILE]; + BLI_strncpy(index_dir, anim->name, FILE_MAXDIR); + BLI_splitdirstring(index_dir, fname); + BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, "BL_proxy"); + BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, fname); + } else { + BLI_strncpy(index_dir, anim->index_dir, FILE_MAXDIR); + } +} + +static void get_proxy_filename(struct anim * anim, IMB_Proxy_Size preview_size, + char * fname, int temp) +{ + char index_dir[FILE_MAXDIR]; + int i = IMB_proxy_size_to_array_index(preview_size); + + char proxy_name[256]; + char proxy_temp_name[256]; + char stream_suffix[20]; + + stream_suffix[0] = 0; + + if (anim->streamindex > 0) { + BLI_snprintf(stream_suffix, 20, "_st%d", anim->streamindex); + } + + BLI_snprintf(proxy_name, 256, "proxy_%d%s.avi", + (int) (proxy_fac[i] * 100), stream_suffix); + BLI_snprintf(proxy_temp_name, 256, "proxy_%d%s_part.avi", + (int) (proxy_fac[i] * 100), stream_suffix); + + get_index_dir(anim, index_dir); + + BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, + temp ? proxy_temp_name : proxy_name); +} + +static void get_tc_filename(struct anim * anim, IMB_Timecode_Type tc, + char * fname) +{ + char index_dir[FILE_MAXDIR]; + int i = IMB_timecode_to_array_index(tc); + char * index_names[] = { + "record_run%s.blen_tc", "free_run%s.blen_tc", + "interp_free_run%s.blen_tc" }; + + char stream_suffix[20]; + char index_name[256]; + + stream_suffix[0] = 0; + + if (anim->streamindex > 0) { + BLI_snprintf(stream_suffix, 20, "_st%d", anim->streamindex); + } + + BLI_snprintf(index_name, 256, index_names[i], stream_suffix); + + get_index_dir(anim, index_dir); + + BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, + index_dir, index_name); +} + +/* ---------------------------------------------------------------------- + - ffmpeg rebuilder + ---------------------------------------------------------------------- */ + +#ifdef WITH_FFMPEG + +struct proxy_output_ctx { + AVFormatContext* of; + AVStream* st; + AVCodecContext* c; + AVCodec* codec; + struct SwsContext * sws_ctx; + AVFrame* frame; + uint8_t* video_buffer; + int video_buffersize; + int cfra; + int proxy_size; + int orig_height; + struct anim * anim; +}; + +// work around stupid swscaler 16 bytes alignment bug... + +static int round_up(int x, int mod) +{ + return x + ((mod - (x % mod)) % mod); +} + +static struct proxy_output_ctx * alloc_proxy_output_ffmpeg( + struct anim * anim, + AVStream * st, int proxy_size, int width, int height, + int quality) +{ + struct proxy_output_ctx * rv = MEM_callocN( + sizeof(struct proxy_output_ctx), "alloc_proxy_output"); + + char fname[FILE_MAXDIR+FILE_MAXFILE]; + + // JPEG requires this + width = round_up(width, 8); + height = round_up(height, 8); + + rv->proxy_size = proxy_size; + rv->anim = anim; + + get_proxy_filename(rv->anim, rv->proxy_size, fname, TRUE); + BLI_make_existing_file(fname); + + rv->of = avformat_alloc_context(); + rv->of->oformat = av_guess_format("avi", NULL, NULL); + + BLI_snprintf(rv->of->filename, sizeof(rv->of->filename), "%s", fname); + + fprintf(stderr, "Starting work on proxy: %s\n", rv->of->filename); + + rv->st = av_new_stream(rv->of, 0); + rv->c = rv->st->codec; + rv->c->codec_type = AVMEDIA_TYPE_VIDEO; + rv->c->codec_id = CODEC_ID_MJPEG; + rv->c->width = width; + rv->c->height = height; + + rv->of->oformat->video_codec = rv->c->codec_id; + rv->codec = avcodec_find_encoder(rv->c->codec_id); + + if (!rv->codec) { + fprintf(stderr, "No ffmpeg MJPEG encoder available? " + "Proxy not built!\n"); + av_free(rv->of); + return NULL; + } + + if (rv->codec->pix_fmts) { + rv->c->pix_fmt = rv->codec->pix_fmts[0]; + } else { + rv->c->pix_fmt = PIX_FMT_YUVJ420P; + } + + rv->c->sample_aspect_ratio + = rv->st->sample_aspect_ratio + = st->codec->sample_aspect_ratio; + + rv->c->time_base.den = 25; + rv->c->time_base.num = 1; + rv->st->time_base = rv->c->time_base; + + if (rv->of->flags & AVFMT_GLOBALHEADER) { + rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER; + } + + if (av_set_parameters(rv->of, NULL) < 0) { + fprintf(stderr, "Couldn't set output parameters? " + "Proxy not built!\n"); + av_free(rv->of); + return 0; + } + + if (avio_open(&rv->of->pb, fname, AVIO_FLAG_WRITE) < 0) { + fprintf(stderr, "Couldn't open outputfile! " + "Proxy not built!\n"); + av_free(rv->of); + return 0; + } + + avcodec_open(rv->c, rv->codec); + + rv->video_buffersize = 2000000; + rv->video_buffer = (uint8_t*)MEM_mallocN( + rv->video_buffersize, "FFMPEG video buffer"); + + rv->orig_height = st->codec->height; + + if (st->codec->width != width || st->codec->height != height + || st->codec->pix_fmt != rv->c->pix_fmt) { + rv->frame = avcodec_alloc_frame(); + avpicture_fill((AVPicture*) rv->frame, + MEM_mallocN(avpicture_get_size( + rv->c->pix_fmt, + round_up(width, 16), height), + "alloc proxy output frame"), + rv->c->pix_fmt, round_up(width, 16), height); + + rv->sws_ctx = sws_getContext( + st->codec->width, + st->codec->height, + st->codec->pix_fmt, + width, height, + rv->c->pix_fmt, + SWS_FAST_BILINEAR | SWS_PRINT_INFO, + NULL, NULL, NULL); + } + + av_write_header(rv->of); + + return rv; +} + +static int add_to_proxy_output_ffmpeg( + struct proxy_output_ctx * ctx, AVFrame * frame) +{ + int outsize = 0; + + if (!ctx) { + return 0; + } + + if (ctx->sws_ctx && frame && + (frame->data[0] || frame->data[1] || + frame->data[2] || frame->data[3])) { + sws_scale(ctx->sws_ctx, (const uint8_t * const*) frame->data, + frame->linesize, 0, ctx->orig_height, + ctx->frame->data, ctx->frame->linesize); + } + + ctx->frame->pts = ctx->cfra++; + + outsize = avcodec_encode_video( + ctx->c, ctx->video_buffer, ctx->video_buffersize, + ctx->sws_ctx ? (frame ? ctx->frame : 0) : frame); + + if (outsize < 0) { + fprintf(stderr, "Error encoding proxy frame %d for '%s'\n", + ctx->cfra - 1, ctx->of->filename); + return 0; + } + + if (outsize != 0) { + AVPacket packet; + av_init_packet(&packet); + + if (ctx->c->coded_frame->pts != AV_NOPTS_VALUE) { + packet.pts = av_rescale_q(ctx->c->coded_frame->pts, + ctx->c->time_base, + ctx->st->time_base); + } + if (ctx->c->coded_frame->key_frame) + packet.flags |= AV_PKT_FLAG_KEY; + + packet.stream_index = ctx->st->index; + packet.data = ctx->video_buffer; + packet.size = outsize; + + if (av_interleaved_write_frame(ctx->of, &packet) != 0) { + fprintf(stderr, "Error writing proxy frame %d " + "into '%s'\n", ctx->cfra - 1, + ctx->of->filename); + return 0; + } + + return 1; + } else { + return 0; + } +} + +static void free_proxy_output_ffmpeg(struct proxy_output_ctx * ctx, + int rollback) +{ + int i; + char fname[FILE_MAXDIR+FILE_MAXFILE]; + char fname_tmp[FILE_MAXDIR+FILE_MAXFILE]; + + if (!ctx) { + return; + } + + if (!rollback) { + while (add_to_proxy_output_ffmpeg(ctx, NULL)) ; + } + + avcodec_flush_buffers(ctx->c); + + av_write_trailer(ctx->of); + + avcodec_close(ctx->c); + + for (i = 0; i < ctx->of->nb_streams; i++) { + if (&ctx->of->streams[i]) { + av_freep(&ctx->of->streams[i]); + } + } + + if (ctx->of->oformat) { + if (!(ctx->of->oformat->flags & AVFMT_NOFILE)) { + avio_close(ctx->of->pb); + } + } + av_free(ctx->of); + + MEM_freeN(ctx->video_buffer); + + if (ctx->sws_ctx) { + sws_freeContext(ctx->sws_ctx); + + MEM_freeN(ctx->frame->data[0]); + av_free(ctx->frame); + } + + get_proxy_filename(ctx->anim, ctx->proxy_size, + fname_tmp, TRUE); + + if (rollback) { + unlink(fname_tmp); + } else { + get_proxy_filename(ctx->anim, ctx->proxy_size, + fname, FALSE); + rename(fname_tmp, fname); + } + + MEM_freeN(ctx); +} + + +static int index_rebuild_ffmpeg(struct anim * anim, + IMB_Timecode_Type tcs_in_use, + IMB_Proxy_Size proxy_sizes_in_use, + int quality, + short *stop, short *do_update, + float *progress) +{ + int i, videoStream; + unsigned long long seek_pos = 0; + unsigned long long last_seek_pos = 0; + unsigned long long seek_pos_dts = 0; + unsigned long long seek_pos_pts = 0; + unsigned long long last_seek_pos_dts = 0; + unsigned long long start_pts = 0; + double frame_rate; + double pts_time_base; + int frameno = 0; + int start_pts_set = FALSE; + + AVFormatContext *iFormatCtx; + AVCodecContext *iCodecCtx; + AVCodec *iCodec; + AVStream *iStream; + AVFrame* in_frame = 0; + AVPacket next_packet; + int streamcount; + + struct proxy_output_ctx * proxy_ctx[IMB_PROXY_MAX_SLOT]; + anim_index_builder * indexer [IMB_TC_MAX_SLOT]; + + int num_proxy_sizes = IMB_PROXY_MAX_SLOT; + int num_indexers = IMB_TC_MAX_SLOT; + uint64_t stream_size; + + memset(proxy_ctx, 0, sizeof(proxy_ctx)); + memset(indexer, 0, sizeof(indexer)); + + if(av_open_input_file(&iFormatCtx, anim->name, NULL, 0, NULL) != 0) { + return 0; + } + + if (av_find_stream_info(iFormatCtx) < 0) { + av_close_input_file(iFormatCtx); + return 0; + } + + streamcount = anim->streamindex; + + /* Find the video stream */ + videoStream = -1; + for (i = 0; i < iFormatCtx->nb_streams; i++) + if(iFormatCtx->streams[i]->codec->codec_type + == AVMEDIA_TYPE_VIDEO) { + if (streamcount > 0) { + streamcount--; + continue; + } + videoStream = i; + break; + } + + if (videoStream == -1) { + av_close_input_file(iFormatCtx); + return 0; + } + + iStream = iFormatCtx->streams[videoStream]; + iCodecCtx = iStream->codec; + + iCodec = avcodec_find_decoder(iCodecCtx->codec_id); + + if (iCodec == NULL) { + av_close_input_file(iFormatCtx); + return 0; + } + + iCodecCtx->workaround_bugs = 1; + + if (avcodec_open(iCodecCtx, iCodec) < 0) { + av_close_input_file(iFormatCtx); + return 0; + } + + in_frame = avcodec_alloc_frame(); + + stream_size = avio_size(iFormatCtx->pb); + + for (i = 0; i < num_proxy_sizes; i++) { + if (proxy_sizes_in_use & proxy_sizes[i]) { + proxy_ctx[i] = alloc_proxy_output_ffmpeg( + anim, iStream, proxy_sizes[i], + iCodecCtx->width * proxy_fac[i], + iCodecCtx->height * proxy_fac[i], + quality); + if (!proxy_ctx[i]) { + proxy_sizes_in_use &= ~proxy_sizes[i]; + } + } + } + + for (i = 0; i < num_indexers; i++) { + if (tcs_in_use & tc_types[i]) { + char fname[FILE_MAXDIR+FILE_MAXFILE]; + + get_tc_filename(anim, tc_types[i], fname); + + indexer[i] = IMB_index_builder_create(fname); + if (!indexer[i]) { + tcs_in_use &= ~tc_types[i]; + } + } + } + + frame_rate = av_q2d(iStream->r_frame_rate); + pts_time_base = av_q2d(iStream->time_base); + + while(av_read_frame(iFormatCtx, &next_packet) >= 0) { + int frame_finished = 0; + float next_progress = ((int)floor(((double) next_packet.pos) * 100 / + ((double) stream_size)+0.5)) / 100; + + if (*progress != next_progress) { + *progress = next_progress; + *do_update = 1; + } + + if (*stop) { + av_free_packet(&next_packet); + break; + } + + if (next_packet.stream_index == videoStream) { + if (next_packet.flags & AV_PKT_FLAG_KEY) { + last_seek_pos = seek_pos; + last_seek_pos_dts = seek_pos_dts; + seek_pos = next_packet.pos; + seek_pos_dts = next_packet.dts; + seek_pos_pts = next_packet.pts; + } + + avcodec_decode_video2( + iCodecCtx, in_frame, &frame_finished, + &next_packet); + } + + if (frame_finished) { + unsigned long long s_pos = seek_pos; + unsigned long long s_dts = seek_pos_dts; + unsigned long long pts + = av_get_pts_from_frame(iFormatCtx, in_frame); + + for (i = 0; i < num_proxy_sizes; i++) { + add_to_proxy_output_ffmpeg( + proxy_ctx[i], in_frame); + } + + if (!start_pts_set) { + start_pts = pts; + start_pts_set = TRUE; + } + + frameno = (pts - start_pts) + * pts_time_base * frame_rate; + + /* decoding starts *always* on I-Frames, + so: P-Frames won't work, even if all the + information is in place, when we seek + to the I-Frame presented *after* the P-Frame, + but located before the P-Frame within + the stream */ + + if (pts < seek_pos_pts) { + s_pos = last_seek_pos; + s_dts = last_seek_pos_dts; + } + + for (i = 0; i < num_indexers; i++) { + if (tcs_in_use & tc_types[i]) { + IMB_index_builder_proc_frame( + indexer[i], + next_packet.data, + next_packet.size, + frameno, s_pos, s_dts, pts); + } + } + } + av_free_packet(&next_packet); + } + + for (i = 0; i < num_indexers; i++) { + if (tcs_in_use & tc_types[i]) { + IMB_index_builder_finish(indexer[i], *stop); + } + } + + for (i = 0; i < num_proxy_sizes; i++) { + if (proxy_sizes_in_use & proxy_sizes[i]) { + free_proxy_output_ffmpeg(proxy_ctx[i], *stop); + } + } + + av_free(in_frame); + + return 1; +} + +#endif + +/* ---------------------------------------------------------------------- + - internal AVI (fallback) rebuilder + ---------------------------------------------------------------------- */ + +static AviMovie * alloc_proxy_output_avi( + struct anim * anim, char * filename, int width, int height, + int quality) +{ + int x, y; + AviFormat format; + double framerate; + AviMovie * avi; + short frs_sec = 25; /* it doesn't really matter for proxies, + but sane defaults help anyways...*/ + float frs_sec_base = 1.0; + + IMB_anim_get_fps(anim, &frs_sec, &frs_sec_base); + + x = width; + y = height; + + framerate= (double) frs_sec / (double) frs_sec_base; + + avi = MEM_mallocN (sizeof(AviMovie), "avimovie"); + + format = AVI_FORMAT_MJPEG; + + if (AVI_open_compress (filename, avi, 1, format) != AVI_ERROR_NONE) { + MEM_freeN(avi); + return 0; + } + + AVI_set_compress_option (avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x); + AVI_set_compress_option (avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_HEIGHT, &y); + AVI_set_compress_option (avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_QUALITY, &quality); + AVI_set_compress_option (avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_FRAMERATE, &framerate); + + avi->interlace= 0; + avi->odd_fields= 0; + + return avi; +} + +static void index_rebuild_fallback(struct anim * anim, + IMB_Timecode_Type tcs_in_use, + IMB_Proxy_Size proxy_sizes_in_use, + int quality, + short *stop, short *do_update, + float *progress) +{ + int cnt = IMB_anim_get_duration(anim, IMB_TC_NONE); + int i, pos; + AviMovie * proxy_ctx[IMB_PROXY_MAX_SLOT]; + char fname[FILE_MAXDIR+FILE_MAXFILE]; + char fname_tmp[FILE_MAXDIR+FILE_MAXFILE]; + + memset(proxy_ctx, 0, sizeof(proxy_ctx)); + + /* since timecode indices only work with ffmpeg right now, + don't know a sensible fallback here... + + so no proxies, no game to play... + */ + if (proxy_sizes_in_use == IMB_PROXY_NONE) { + return; + } + + for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { + if (proxy_sizes_in_use & proxy_sizes[i]) { + char fname[FILE_MAXDIR+FILE_MAXFILE]; + + get_proxy_filename(anim, proxy_sizes[i], fname, TRUE); + BLI_make_existing_file(fname); + + proxy_ctx[i] = alloc_proxy_output_avi( + anim, fname, + anim->x * proxy_fac[i], + anim->y * proxy_fac[i], + quality); + } + } + + for (pos = 0; pos < cnt; pos++) { + struct ImBuf * ibuf = IMB_anim_absolute( + anim, pos, IMB_TC_NONE, IMB_PROXY_NONE); + int next_progress = (int) ((double) pos / (double) cnt); + + if (*progress != next_progress) { + *progress = next_progress; + *do_update = 1; + } + + if (*stop) { + break; + } + + IMB_flipy(ibuf); + + for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { + if (proxy_sizes_in_use & proxy_sizes[i]) { + int x = anim->x * proxy_fac[i]; + int y = anim->y * proxy_fac[i]; + + struct ImBuf * s_ibuf = IMB_scalefastImBuf( + ibuf, x, y); + + IMB_convert_rgba_to_abgr(s_ibuf); + + AVI_write_frame (proxy_ctx[i], pos, + AVI_FORMAT_RGB32, + s_ibuf->rect, x * y * 4); + + /* note that libavi free's the buffer... */ + s_ibuf->rect = 0; + + IMB_freeImBuf(s_ibuf); + } + } + } + + for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { + if (proxy_sizes_in_use & proxy_sizes[i]) { + AVI_close_compress (proxy_ctx[i]); + MEM_freeN (proxy_ctx[i]); + + get_proxy_filename(anim, proxy_sizes[i], + fname_tmp, TRUE); + get_proxy_filename(anim, proxy_sizes[i], + fname, FALSE); + + if (*stop) { + unlink(fname_tmp); + } else { + rename(fname_tmp, fname); + } + } + } +} + +/* ---------------------------------------------------------------------- + - public API + ---------------------------------------------------------------------- */ + +void IMB_anim_index_rebuild(struct anim * anim, IMB_Timecode_Type tcs_in_use, + IMB_Proxy_Size proxy_sizes_in_use, + int quality, + short *stop, short *do_update, float *progress) +{ + switch (anim->curtype) { +#ifdef WITH_FFMPEG + case ANIM_FFMPEG: + index_rebuild_ffmpeg(anim, tcs_in_use, proxy_sizes_in_use, + quality, stop, do_update, progress); + break; +#endif + default: + index_rebuild_fallback(anim, tcs_in_use, proxy_sizes_in_use, + quality, stop, do_update, progress); + break; + } +} + +void IMB_free_indices(struct anim * anim) +{ + int i; + + for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { + if (anim->proxy_anim[i]) { + IMB_close_anim(anim->proxy_anim[i]); + anim->proxy_anim[i] = 0; + } + } + + for (i = 0; i < IMB_TC_MAX_SLOT; i++) { + if (anim->curr_idx[i]) { + IMB_indexer_close(anim->curr_idx[i]); + anim->curr_idx[i] = 0; + } + } + + + anim->proxies_tried = 0; + anim->indices_tried = 0; +} + +void IMB_anim_set_index_dir(struct anim * anim, const char * dir) +{ + if (strcmp(anim->index_dir, dir) == 0) { + return; + } + BLI_strncpy(anim->index_dir, dir, sizeof(anim->index_dir)); + + IMB_free_indices(anim); +} + +struct anim * IMB_anim_open_proxy( + struct anim * anim, IMB_Proxy_Size preview_size) +{ + char fname[FILE_MAXDIR+FILE_MAXFILE]; + int i = IMB_proxy_size_to_array_index(preview_size); + + if (anim->proxy_anim[i]) { + return anim->proxy_anim[i]; + } + + if (anim->proxies_tried & preview_size) { + return NULL; + } + + get_proxy_filename(anim, preview_size, fname, FALSE); + + anim->proxy_anim[i] = IMB_open_anim(fname, 0, 0); + + anim->proxies_tried |= preview_size; + + return anim->proxy_anim[i]; +} + +struct anim_index * IMB_anim_open_index( + struct anim * anim, IMB_Timecode_Type tc) +{ + char fname[FILE_MAXDIR+FILE_MAXFILE]; + int i = IMB_timecode_to_array_index(tc); + + if (anim->curr_idx[i]) { + return anim->curr_idx[i]; + } + + if (anim->indices_tried & tc) { + return 0; + } + + get_tc_filename(anim, tc, fname); + + anim->curr_idx[i] = IMB_indexer_open(fname); + + anim->indices_tried |= tc; + + return anim->curr_idx[i]; +} + +int IMB_anim_index_get_frame_index(struct anim * anim, IMB_Timecode_Type tc, + int position) +{ + struct anim_index * idx = IMB_anim_open_index(anim, tc); + + if (!idx) { + return position; + } + + return IMB_indexer_get_frame_index(idx, position); +} + diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c new file mode 100644 index 00000000000..0961af10f69 --- /dev/null +++ b/source/blender/imbuf/intern/indexer_dv.c @@ -0,0 +1,391 @@ +/* + * $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. + * + * Peter Schlaile 2011 + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** +*/ + +#include "IMB_indexer.h" +#include "MEM_guardedalloc.h" +#include + +typedef struct indexer_dv_bitstream { + unsigned char* buffer; + int bit_pos; +} indexer_dv_bitstream; + +static indexer_dv_bitstream bitstream_new(unsigned char* buffer_) +{ + indexer_dv_bitstream rv; + + rv.buffer = buffer_; + rv.bit_pos = 0; + + return rv; +} + +static unsigned long bitstream_get_bits(indexer_dv_bitstream * This, int num) +{ + int byte_pos = This->bit_pos >> 3; + unsigned long i = + This->buffer[byte_pos] | (This->buffer[byte_pos + 1] << 8) | + (This->buffer[byte_pos + 2] << 16) | + (This->buffer[byte_pos + 3] << 24); + int rval = (i >> (This->bit_pos & 0x7)) & ((1 << num) - 1); + This->bit_pos += num; + return rval; +} + +static int parse_num(indexer_dv_bitstream * b, int numbits) { + return bitstream_get_bits(b, numbits); +} + +static int parse_bcd(indexer_dv_bitstream * b, int n) +{ + char s[256]; + char * p = s + (n+3)/4; + + *p-- = 0; + + while (n > 4) { + char a; + int v = bitstream_get_bits(b, 4); + + n -= 4; + a = '0' + v; + + if (a > '9') { + bitstream_get_bits(b, n); + return -1; + } + + *p-- = a; + } + if (n) { + char a; + int v = bitstream_get_bits(b, n); + a = '0' + v; + if (a > '9') { + return -1; + } + *p-- = a; + } + + return atol(s); +} + +typedef struct indexer_dv_context +{ + int rec_curr_frame; + int rec_curr_second; + int rec_curr_minute; + int rec_curr_hour; + + int rec_curr_day; + int rec_curr_month; + int rec_curr_year; + + char got_record_date; + char got_record_time; + + time_t ref_time_read; + time_t ref_time_read_new; + int curr_frame; + + time_t gap_start; + int gap_frame; + + int frameno_offset; + + anim_index_entry backbuffer[31]; + int fsize; + + anim_index_builder * idx; +} indexer_dv_context; + +static void parse_packet(indexer_dv_context * This, unsigned char * p) +{ + indexer_dv_bitstream b; + int type = p[0]; + + b = bitstream_new(p + 1); + + switch (type) { + case 0x62: // Record date + parse_num(&b, 8); + This->rec_curr_day = parse_bcd(&b, 6); + parse_num(&b, 2); + This->rec_curr_month = parse_bcd(&b, 5); + parse_num(&b, 3); + This->rec_curr_year = parse_bcd(&b, 8); + if (This->rec_curr_year < 25) { + This->rec_curr_year += 2000; + } else { + This->rec_curr_year += 1900; + } + This->got_record_date = 1; + break; + case 0x63: // Record time + This->rec_curr_frame = parse_bcd(&b, 6); + parse_num(&b, 2); + This->rec_curr_second = parse_bcd(&b, 7); + parse_num(&b, 1); + This->rec_curr_minute = parse_bcd(&b, 7); + parse_num(&b, 1); + This->rec_curr_hour = parse_bcd(&b, 6); + This->got_record_time = 1; + break; + } +} + +static void parse_header_block(indexer_dv_context * This, unsigned char* target) +{ + int i; + for (i = 3; i < 80; i += 5) { + if (target[i] != 0xff) { + parse_packet(This, target + i); + } + } +} + +static void parse_subcode_blocks( + indexer_dv_context * This, unsigned char* target) +{ + int i,j; + + for (j = 0; j < 2; j++) { + for (i = 3; i < 80; i += 5) { + if (target[i] != 0xff) { + parse_packet(This, target + i); + } + } + } +} + +static void parse_vaux_blocks( + indexer_dv_context * This, unsigned char* target) +{ + int i,j; + + for (j = 0; j < 3; j++) { + for (i = 3; i < 80; i += 5) { + if (target[i] != 0xff) { + parse_packet(This, target + i); + } + } + target += 80; + } +} + +static void parse_audio_headers( + indexer_dv_context * This, unsigned char* target) +{ + int i; + + for(i = 0; i < 9; i++) { + if (target[3] != 0xff) { + parse_packet(This, target + 3); + } + target += 16 * 80; + } +} + +static void parse_frame(indexer_dv_context * This, + unsigned char * framebuffer, int isPAL) +{ + int numDIFseq = isPAL ? 12 : 10; + unsigned char* target = framebuffer; + int ds; + + for (ds = 0; ds < numDIFseq; ds++) { + parse_header_block(This, target); + target += 1 * 80; + parse_subcode_blocks(This, target); + target += 2 * 80; + parse_vaux_blocks(This, target); + target += 3 * 80; + parse_audio_headers(This, target); + target += 144 * 80; + } +} + +static void inc_frame(int * frame, time_t * t, int isPAL) +{ + if ((isPAL && *frame >= 25) || (!isPAL && *frame >= 30)) { + fprintf(stderr, "Ouchie: inc_frame: invalid_frameno: %d\n", + *frame); + } + (*frame)++; + if (isPAL && *frame >= 25) { + (*t)++; + *frame = 0; + } else if (!isPAL && *frame >= 30) { + (*t)++; + *frame = 0; + } +} + +static void write_index(indexer_dv_context * This, anim_index_entry * entry) +{ + IMB_index_builder_add_entry( + This->idx, entry->frameno + This->frameno_offset, + entry->seek_pos, entry->seek_pos_dts, entry->pts); +} + +static void fill_gap(indexer_dv_context * This, int isPAL) +{ + int i; + + for (i = 0; i < This->fsize; i++) { + if (This->gap_start == This->ref_time_read && + This->gap_frame == This->curr_frame) { + fprintf(stderr, + "indexer_dv::fill_gap: " + "can't seek backwards !\n"); + break; + } + inc_frame(&This->gap_frame, &This->gap_start, isPAL); + } + + while (This->gap_start != This->ref_time_read || + This->gap_frame != This->curr_frame) { + inc_frame(&This->gap_frame, &This->gap_start, isPAL); + This->frameno_offset++; + } + + for (i = 0; i < This->fsize; i++) { + write_index(This, This->backbuffer + i); + } + This->fsize = 0; +} + +static void proc_frame(indexer_dv_context * This, + unsigned char* framebuffer, int isPAL) +{ + struct tm recDate; + time_t t; + + if (!This->got_record_date || !This->got_record_time) { + return; + } + + recDate.tm_sec = This->rec_curr_second; + recDate.tm_min = This->rec_curr_minute; + recDate.tm_hour = This->rec_curr_hour; + recDate.tm_mday = This->rec_curr_day; + recDate.tm_mon = This->rec_curr_month - 1; + recDate.tm_year = This->rec_curr_year - 1900; + recDate.tm_wday = -1; + recDate.tm_yday = -1; + recDate.tm_isdst = -1; + + t = mktime(&recDate); + if (t == -1) { + return; + } + + This->ref_time_read_new = t; + + if (This->ref_time_read < 0) { + This->ref_time_read = This->ref_time_read_new; + This->curr_frame = 0; + } else { + if (This->ref_time_read_new - This->ref_time_read == 1) { + This->curr_frame = 0; + This->ref_time_read = This->ref_time_read_new; + if (This->gap_frame >= 0) { + fill_gap(This, isPAL); + This->gap_frame = -1; + } + } else if (This->ref_time_read_new == This->ref_time_read) { + // do nothing + } else { + This->gap_start = This->ref_time_read; + This->gap_frame = This->curr_frame; + This->ref_time_read = This->ref_time_read_new; + This->curr_frame = -1; + } + } +} + +static void indexer_dv_proc_frame(anim_index_builder * idx, + unsigned char * buffer, + int data_size, + struct anim_index_entry * entry) +{ + int isPAL; + + indexer_dv_context * This = (indexer_dv_context *) idx->private_data; + + isPAL = (buffer[3] & 0x80); + + This->got_record_date = FALSE; + This->got_record_time = FALSE; + + parse_frame(This, buffer, isPAL); + proc_frame(This, buffer, isPAL); + + if (This->curr_frame >= 0) { + write_index(This, entry); + inc_frame(&This->curr_frame, &This->ref_time_read, isPAL); + } else { + This->backbuffer[This->fsize++] = *entry; + if (This->fsize >= 31) { + int i; + + fprintf(stderr, "indexer_dv::indexer_dv_proc_frame: " + "backbuffer overrun, emergency flush"); + + for (i = 0; i < This->fsize; i++) { + write_index(This, This->backbuffer+i); + } + This->fsize = 0; + } + } +} + +static void indexer_dv_delete(anim_index_builder * idx) +{ + int i = 0; + indexer_dv_context * This = (indexer_dv_context *) idx->private_data; + + for (i = 0; i < This->fsize; i++) { + write_index(This, This->backbuffer+i); + } + + MEM_freeN(This); +} + +void IMB_indexer_dv_new(anim_index_builder * idx) +{ + indexer_dv_context * rv = MEM_callocN( + sizeof(indexer_dv_context), "index_dv builder context"); + + rv->ref_time_read = -1; + rv->curr_frame = -1; + rv->gap_frame = -1; + rv->idx = idx; + + idx->private_data = rv; + idx->proc_frame = indexer_dv_proc_frame; + idx->delete_priv_data = indexer_dv_delete; +} diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 1d91f34f4fa..2ab7e55d1f8 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -317,9 +317,9 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im } } else if (THB_SOURCE_MOVIE == source) { struct anim * anim = NULL; - anim = IMB_open_anim(path, IB_rect | IB_metadata); + anim = IMB_open_anim(path, IB_rect | IB_metadata, 0); if (anim != NULL) { - img = IMB_anim_absolute(anim, 0); + img = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE); if (img == NULL) { printf("not an anim; %s\n", path); } else { diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 6db8dcc06cf..85d31f18a03 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -221,7 +221,7 @@ void silence_log_ffmpeg(int quiet) } else { - av_log_set_level(AV_LOG_INFO); + av_log_set_level(AV_LOG_DEBUG); } } @@ -234,9 +234,10 @@ void do_init_ffmpeg(void) av_register_all(); avdevice_register_all(); - if ((G.f & G_DEBUG) == 0) - { + if ((G.f & G_DEBUG) == 0) { silence_log_ffmpeg(1); + } else { + silence_log_ffmpeg(0); } } } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 0dd0b9790ab..cd3afbf3553 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -71,12 +71,19 @@ typedef struct StripColorBalance { } StripColorBalance; typedef struct StripProxy { - char dir[160]; - char file[80]; - struct anim *anim; - short size; - short quality; - int pad; + char dir[160]; // custom directory for index and proxy files + // (defaults to BL_proxy) + + char file[80]; // custom file + struct anim *anim; // custom proxy anim file + + short tc; // time code in use + + short quality; // proxy build quality + short build_size_flags;// size flags (see below) of all proxies + // to build + short build_tc_flags; // time code flags (see below) of all tc indices + // to build } StripProxy; typedef struct Strip { @@ -128,11 +135,12 @@ typedef struct Sequence { int startstill, endstill; int machine, depth; /*machine - the strip channel, depth - the depth in the sequence when dealing with metastrips */ int startdisp, enddisp; /*starting and ending points in the sequence*/ - float sat, pad; + float sat; float mul, handsize; /* is sfra needed anymore? - it looks like its only used in one place */ int sfra; /* starting frame according to the timeline of the scene. */ int anim_preseek; + int streamindex; /* streamindex for movie or sound files with several streams */ Strip *strip; @@ -283,6 +291,19 @@ typedef struct SpeedControlVars { #define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2 #define SEQ_COLOR_BALANCE_INVERSE_LIFT 4 +/* !!! has to be same as IMB_imbuf.h IMB_PROXY_... and IMB_TC_... */ + +#define SEQ_PROXY_IMAGE_SIZE_25 1 +#define SEQ_PROXY_IMAGE_SIZE_50 2 +#define SEQ_PROXY_IMAGE_SIZE_75 4 +#define SEQ_PROXY_IMAGE_SIZE_100 8 + +#define SEQ_PROXY_TC_NONE 0 +#define SEQ_PROXY_TC_RECORD_RUN 1 +#define SEQ_PROXY_TC_FREE_RUN 2 +#define SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN 4 +#define SEQ_PROXY_TC_ALL 7 + /* seq->type WATCH IT: SEQ_EFFECT BIT is used to determine if this is an effect strip!!! */ #define SEQ_IMAGE 0 #define SEQ_META 1 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 67899db5538..66b10bcbf21 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -930,6 +930,7 @@ enum { #define SEQ_PROXY_RENDER_SIZE_25 25 #define SEQ_PROXY_RENDER_SIZE_50 50 #define SEQ_PROXY_RENDER_SIZE_75 75 +#define SEQ_PROXY_RENDER_SIZE_100 99 #define SEQ_PROXY_RENDER_SIZE_FULL 100 diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 476ac325848..b6e2117956d 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -245,6 +245,10 @@ static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value) seq->flag |= SEQ_USE_PROXY; if(seq->strip->proxy == NULL) { seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy"); + seq->strip->proxy->quality = 90; + seq->strip->proxy->build_tc_flags = SEQ_PROXY_TC_ALL; + seq->strip->proxy->build_size_flags + = SEQ_PROXY_IMAGE_SIZE_25; } } else { seq->flag ^= SEQ_USE_PROXY; @@ -587,6 +591,34 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA * rna_Sequence_update(bmain, scene, ptr); } +static int seqproxy_seq_cmp_cb(Sequence *seq, void *arg_pt) +{ + struct { Sequence *seq; void *seq_proxy; } *data= arg_pt; + + if(seq->strip && seq->strip->proxy == data->seq_proxy) { + data->seq= seq; + return -1; /* done so bail out */ + } + return 1; +} + +static void rna_Sequence_tcindex_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Editing *ed= seq_give_editing(scene, FALSE); + Sequence *seq; + + struct { Sequence *seq; void *seq_proxy; } data; + + data.seq= NULL; + data.seq_proxy = ptr->data; + + seqbase_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_cb, &data); + seq= data.seq; + + reload_sequence_new_file(scene, seq, FALSE); + rna_Sequence_frame_change_update(scene, seq); +} + /* do_versions? */ static float rna_Sequence_opacity_get(PointerRNA *ptr) { @@ -789,6 +821,19 @@ static void rna_def_strip_proxy(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + + static const EnumPropertyItem seq_tc_items[]= { + {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"}, + {0, NULL, 0, NULL, NULL}}; srna = RNA_def_struct(brna, "SequenceProxy", NULL); RNA_def_struct_ui_text(srna, "Sequence Proxy", "Proxy parameters for a sequence strip"); @@ -804,6 +849,46 @@ static void rna_def_strip_proxy(BlenderRNA *brna) RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length", "rna_Sequence_proxy_filepath_set"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); + + prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_25); + RNA_def_property_ui_text(prop, "25%", "Build 25% proxy resolution"); + + prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_50); + RNA_def_property_ui_text(prop, "50%", "Build 50% proxy resolution"); + + prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_75); + RNA_def_property_ui_text(prop, "75%", "Build 75% proxy resolution"); + + prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_100); + RNA_def_property_ui_text(prop, "100%", "Build 100% proxy resolution"); + + prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_RECORD_RUN); + RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index"); + + prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_FREE_RUN); + RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index"); + + prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN); + RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time"); + + prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "quality"); + RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build"); + RNA_def_property_ui_range(prop, 1, 100, 1, 0); + + prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "tc"); + RNA_def_property_enum_items(prop, seq_tc_items); + RNA_def_property_ui_text(prop, "Timecode", ""); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_tcindex_update"); + } static void rna_def_strip_color_balance(BlenderRNA *brna) @@ -1208,7 +1293,7 @@ static void rna_def_proxy(StructRNA *srna) prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY); - RNA_def_property_ui_text(prop, "Use Proxy", "Use a preview proxy for this strip"); + RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this strip"); RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set"); prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); @@ -1330,6 +1415,12 @@ 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); + 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"); + RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update_reopen_files"); + prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL); RNA_def_property_struct_type(prop, "SequenceElement"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index b79d5395eec..0166baa8443 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1674,6 +1674,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""}, {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""}, {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""}, + {SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""}, {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index e1b8cefca4b..5bdf1ec2787 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -300,6 +300,8 @@ int WM_jobs_test(struct wmWindowManager *wm, void *owner); float WM_jobs_progress(struct wmWindowManager *wm, void *owner); char *WM_jobs_name(struct wmWindowManager *wm, void *owner); +int WM_jobs_is_running(struct wmJob *); +void* WM_jobs_get_customdata(struct wmJob *); void WM_jobs_customdata(struct wmJob *, void *customdata, void (*free)(void *)); void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned int endnote); void WM_jobs_callbacks(struct wmJob *, diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 4ab4eebdfe1..f4e0b4ef06c 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -202,6 +202,20 @@ char *WM_jobs_name(wmWindowManager *wm, void *owner) return NULL; } +int WM_jobs_is_running(wmJob *steve) +{ + return steve->running; +} + +void* WM_jobs_get_customdata(wmJob * steve) +{ + if (!steve->customdata) { + return steve->run_customdata; + } else { + return steve->customdata; + } +} + void WM_jobs_customdata(wmJob *steve, void *customdata, void (*free)(void *)) { /* pending job? just free */ -- cgit v1.2.3 From ca79dee61f11227be0ed4cc5b1241fa748124da0 Mon Sep 17 00:00:00 2001 From: Sukhitha Prabhath Jayathilake Date: Sun, 28 Aug 2011 18:30:18 +0000 Subject: armature object animation bug fix. --- source/blender/collada/AnimationExporter.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index bbd6fef803f..c6f108306be 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -71,14 +71,15 @@ void AnimationExporter::operator() (Object *ob) bArmature *arm = (bArmature*)ob->data; for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) write_bone_animation_matrix(ob, bone); - - transformName = fcu->rna_path; } - else - transformName = extract_transform_name( fcu->rna_path ); while (fcu) { - transformName = extract_transform_name( fcu->rna_path ); + //for armature animations as objects + if ( ob->type == OB_ARMATURE ) + transformName = fcu->rna_path; + else + transformName = extract_transform_name( fcu->rna_path ); + if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) || (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)|| (!strcmp(transformName, "rotation_quaternion"))) -- cgit v1.2.3 From 28feca36d7e0a5f15d9c03f3781ba34cca8c4670 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 28 Aug 2011 18:54:02 +0000 Subject: Missed notifier was found when looking at #28393 --- source/blender/editors/space_buttons/space_buttons.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index e2d80e9e775..ef927fd69fc 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -269,6 +269,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */ break; case ND_POSE: + buttons_area_redraw(sa, BCONTEXT_DATA); case ND_BONE_ACTIVE: case ND_BONE_SELECT: buttons_area_redraw(sa, BCONTEXT_BONE); -- cgit v1.2.3 From 80459d97c7b50cfe8f630e2e20f5ccc55f854c23 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 28 Aug 2011 19:58:33 +0000 Subject: == Sequencer / proxies == fixed crash pointed out by blendervse: 100%-proxy could lead to a segfault under certain conditions. --- source/blender/imbuf/intern/indexer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index f624694b324..5a819cef652 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -573,11 +573,15 @@ static int add_to_proxy_output_ffmpeg( ctx->frame->data, ctx->frame->linesize); } - ctx->frame->pts = ctx->cfra++; + frame = ctx->sws_ctx ? (frame ? ctx->frame : 0) : frame; + + if (frame) { + frame->pts = ctx->cfra++; + } outsize = avcodec_encode_video( ctx->c, ctx->video_buffer, ctx->video_buffersize, - ctx->sws_ctx ? (frame ? ctx->frame : 0) : frame); + frame); if (outsize < 0) { fprintf(stderr, "Error encoding proxy frame %d for '%s'\n", -- cgit v1.2.3 From 3dc817840b21a06f161b8c672e61e0a0000adc8f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 21:13:03 +0000 Subject: fix [#28401] OpenGL render option disables border clipping --- source/blender/editors/space_view3d/view3d_draw.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source') diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 80da75bc603..98768e369cb 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2272,6 +2272,7 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar, void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[][4], float winmat[][4]) { + RegionView3D *rv3d= ar->regiondata; Base *base; float backcol[3]; int bwinx, bwiny; @@ -2320,6 +2321,9 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* setup view matrices */ view3d_main_area_setup_view(scene, v3d, ar, viewmat, winmat); + if(rv3d->rflag & RV3D_CLIPPING) + view3d_draw_clipping(rv3d); + /* set zbuffer */ if(v3d->drawtype > OB_WIRE) { v3d->zbuf= TRUE; @@ -2328,6 +2332,9 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, else v3d->zbuf= FALSE; + if(rv3d->rflag & RV3D_CLIPPING) + view3d_set_clipping(rv3d); + /* draw set first */ if(scene->set) { Scene *sce_iter; @@ -2363,6 +2370,9 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1); + if(rv3d->rflag & RV3D_CLIPPING) + view3d_clr_clipping(); + /* cleanup */ if(v3d->zbuf) { v3d->zbuf= FALSE; -- cgit v1.2.3 From c31b776dc9a914f0fcf1b988edb448f12ed4eb64 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Sun, 28 Aug 2011 21:48:52 +0000 Subject: SVN maintenance. --- source/blender/imbuf/intern/IMB_indexer.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index ae3b48f76c7..f55420fd106 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -1,7 +1,5 @@ /** - * IMB_indexer.h - * - * $Id: IMB_indexer.h + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3 From 0e01fa4863a301f9776b8a6b5459493fc8830008 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Aug 2011 23:24:34 +0000 Subject: patch [#28355] Better Environment Map scripting from Tom Edwards (artfunkel), with minor edits. This patch makes the following improvements to environment map scripting: * Adds a "is_valid" RNA property to envmaps. True if the map is ready for use, False if it needs rendering. * Adds a "clear" RNA function to envmaps. Deletes any envmap image data. * Adds a "save" RNA function to envmaps. Writes the envmap to disc with a configurable layout. (Defaults to the current hard-coded layout.) * Updates bpy.ops.texture.envmap_save with configurable layout support as above. These changes, particularly configurable layouts, make exporting envmaps to other software much easier. --- source/blender/editors/render/render_shading.c | 69 ++++------------ source/blender/makesrna/intern/CMakeLists.txt | 1 + source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_internal.h | 1 + source/blender/makesrna/intern/rna_texture.c | 7 ++ source/blender/makesrna/intern/rna_texture_api.c | 95 ++++++++++++++++++++++ source/blender/render/extern/include/RE_pipeline.h | 4 + source/blender/render/intern/source/pipeline.c | 57 +++++++++++++ 8 files changed, 183 insertions(+), 53 deletions(-) create mode 100644 source/blender/makesrna/intern/rna_texture_api.c (limited to 'source') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index fbdcf7ba9b3..1b24d660411 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -85,6 +85,8 @@ #include "UI_interface.h" +#include "RE_pipeline.h" + #include "render_intern.h" // own include /********************** material slot operators *********************/ @@ -661,60 +663,21 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot) /********************** environment map operators *********************/ -static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int imtype) +static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, int imtype) { - ImBuf *ibuf=NULL; - int dx; - int retval; - int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); - - if(env->cube[1]==NULL) { - BKE_report(op->reports, RPT_ERROR, "There is no generated environment map available to save"); - return OPERATOR_CANCELLED; - } - - dx= env->cube[1]->x; - - if (env->type == ENV_CUBE) { - ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat); - - IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[2], 2*dx, 0, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[3], 0, dx, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[4], dx, dx, 0, 0, dx, dx); - IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx); - } - else if (env->type == ENV_PLANE) { - ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat); - IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx); + float layout[12]; + if ( RNA_struct_find_property(op->ptr, "layout") ) + RNA_float_get_array(op->ptr, "layout",layout); + else + memcpy(layout, default_envmap_layout, sizeof(layout)); + + if (RE_WriteEnvmapResult(op->reports, scene, env, path, imtype, layout)) { + return OPERATOR_FINISHED; } else { - BKE_report(op->reports, RPT_ERROR, "Invalid environment map type"); return OPERATOR_CANCELLED; } - - if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) - ibuf->profile = IB_PROFILE_LINEAR_RGB; - - /* to save, we first get absolute path */ - BLI_path_abs(str, G.main->name); - - if (BKE_write_ibuf(ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) { - retval = OPERATOR_FINISHED; - } - else { - BKE_reportf(op->reports, RPT_ERROR, "Error saving environment map to %s.", str); - retval = OPERATOR_CANCELLED; - } - /* in case we were saving with relative paths, change back again */ - if(relative) - BLI_path_rel(str, G.main->name); - - IMB_freeImBuf(ibuf); - ibuf = NULL; - - return retval; + } static int envmap_save_exec(bContext *C, wmOperator *op) @@ -753,7 +716,6 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event return envmap_save_exec(C, op); //RNA_enum_set(op->ptr, "file_type", scene->r.imtype); - RNA_string_set(op->ptr, "filepath", G.main->name); WM_event_add_fileselect(C, op); @@ -776,6 +738,7 @@ static int envmap_save_poll(bContext *C) void TEXTURE_OT_envmap_save(wmOperatorType *ot) { + PropertyRNA *prop; /* identifiers */ ot->name= "Save Environment Map"; ot->idname= "TEXTURE_OT_envmap_save"; @@ -790,8 +753,10 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */ /* properties */ - //RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); - WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); + prop= RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f, "File layout", "Flat array describing the X,Y position of each cube face in the output image, where 1 is the size of a face. Order is [+Z -Z +Y -X -Y +X]. Use -1 to skip a face.", 0.0f, 0.0f); + RNA_def_property_flag(prop, PROP_HIDDEN); + + WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH); } static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index cc7bcf04716..6b042a987e3 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -100,6 +100,7 @@ set(APISRC rna_main_api.c rna_material_api.c rna_mesh_api.c + rna_texture_api.c rna_object_api.c rna_pose_api.c rna_scene_api.c diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b95bd2b2087..d0dea41b384 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2417,7 +2417,7 @@ typedef struct RNAProcessItem { static RNAProcessItem PROCESS_ITEMS[]= { {"rna_rna.c", NULL, RNA_def_rna}, {"rna_ID.c", NULL, RNA_def_ID}, - {"rna_texture.c", NULL, RNA_def_texture}, + {"rna_texture.c", "rna_texture_api.c", RNA_def_texture}, {"rna_action.c", "rna_action_api.c", RNA_def_action}, {"rna_animation.c", "rna_animation_api.c", RNA_def_animation}, {"rna_animviz.c", NULL, RNA_def_animviz}, diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index c0ae7b02b1a..955e56193c6 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -260,6 +260,7 @@ void RNA_api_wm(struct StructRNA *srna); void RNA_api_sensor(struct StructRNA *srna); void RNA_api_controller(struct StructRNA *srna); void RNA_api_actuator(struct StructRNA *srna); +void RNA_api_environment_map(struct StructRNA *srna); /* main collection functions */ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 0ecc41d80d8..a1ce77b061d 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -664,6 +664,13 @@ static void rna_def_environment_map(BlenderRNA *brna) 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_update(prop, 0, "rna_Texture_update"); + + prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, 0); + RNA_def_property_boolean_sdna(prop, NULL, "ok", 2); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Validity", "True if this map is ready for use, False if it needs rendering."); + + RNA_api_environment_map(srna); } static EnumPropertyItem prop_noise_basis_items[] = { diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c new file mode 100644 index 00000000000..f83caca3944 --- /dev/null +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -0,0 +1,95 @@ +/* + * + * ***** 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): Tom Edwards + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_texture_api.c + * \ingroup RNA + */ + + +#include +#include +#include + + +#include "RNA_define.h" +#include "BKE_utildefines.h" + +#ifdef RNA_RUNTIME + +#include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" +#include "DNA_scene_types.h" +#include "BKE_context.h" +#include "BKE_global.h" +#include "RE_pipeline.h" + +void save_envmap(struct EnvMap *env, bContext *C, ReportList *reports, const char* filepath, struct Scene *scene, float layout[12]) +{ + if (scene == NULL) { + scene = CTX_data_scene(C); + } + + RE_WriteEnvmapResult(reports, scene, env, filepath, scene->r.imtype, layout); +} + +void clear_envmap(struct EnvMap *env, bContext *C) +{ + Main *bmain = CTX_data_main(C); + Tex *tex; + + BKE_free_envmapdata(env); + + for (tex=bmain->tex.first; tex; tex=tex->id.next) + if (tex->env == env) { + WM_event_add_notifier(C, NC_TEXTURE|NA_EDITED, tex); + break; + } +} + +#else + +void RNA_api_environment_map(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + static const float default_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 }; + + func= RNA_def_function(srna, "clear", "clear_envmap"); + RNA_def_function_ui_description(func, "Discard the environment map and free it from memory."); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + + + func= RNA_def_function(srna,"save", "save_envmap"); + RNA_def_function_ui_description(func, "Save the environment map to disc using the scene render settings."); + RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); + + parm= RNA_def_string_file_name(func,"filepath","",FILE_MAX,"File path","Location of the output file"); + RNA_def_property_flag(parm, PROP_REQUIRED); + + RNA_def_pointer(func, "scene", "Scene", "", "Overrides the scene from which image parameters are taken."); + + parm = RNA_def_float_array(func, "layout", 12, default_layout, 0.0f, 0.0f, "File layout", "Flat array describing the X,Y position of each cube face in the output image, where 1 is the size of a face. Order is [+Z -Z +Y -X -Y +X]. Use -1 to skip a face.", 0.0f, 0.0f); +} + +#endif diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index d9ed83a00b2..0736bed4faf 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -51,6 +51,7 @@ struct ReportList; struct ReportList; struct Scene; struct SceneRenderLayer; +struct EnvMap; /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* this include is what is exposed of render to outside world */ @@ -230,6 +231,9 @@ void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress); struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty); +extern const float default_envmap_layout[]; +int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct EnvMap *env, const char *relpath, int imtype, float layout[12]); + /* do a full sample buffer compo */ void RE_MergeFullSample(struct Render *re, struct Main *bmain, struct Scene *sce, struct bNodeTree *ntree); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index b9006b390ab..eff8402d8b5 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -3463,3 +3463,60 @@ static int external_render_3d(Render *re, int do_all) return 1; } +const float default_envmap_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 }; + +int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, const char *relpath, int imtype, float layout[12]) +{ + ImBuf *ibuf=NULL; + int ok; + int dx; + int maxX=0,maxY=0,i=0; + char filepath[FILE_MAX]; + + if(env->cube[1]==NULL) { + BKE_report(reports, RPT_ERROR, "There is no generated environment map available to save"); + return 0; + } + + dx= env->cube[1]->x; + + if (env->type == ENV_CUBE) { + for (i=0; i < 12; i+=2) { + maxX = MAX2(maxX,layout[i] + 1); + maxY = MAX2(maxY,layout[i+1] + 1); + } + + ibuf = IMB_allocImBuf(maxX*dx, maxY*dx, 24, IB_rectfloat); + + for (i=0; i < 12; i+=2) + if (layout[i] > -1 && layout[i+1] > -1) + IMB_rectcpy(ibuf, env->cube[i/2], layout[i]*dx, layout[i+1]*dx, 0, 0, dx, dx); + } + else if (env->type == ENV_PLANE) { + ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat); + IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx); + } + else { + BKE_report(reports, RPT_ERROR, "Invalid environment map type"); + return 0; + } + + if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + ibuf->profile = IB_PROFILE_LINEAR_RGB; + + /* to save, we first get absolute path */ + BLI_strncpy(filepath, relpath, sizeof(filepath)); + BLI_path_abs(filepath, G.main->name); + + ok= BKE_write_ibuf(ibuf, filepath, imtype, scene->r.subimtype, scene->r.quality); + + IMB_freeImBuf(ibuf); + + if(ok) { + return TRUE; + } + else { + BKE_report(reports, RPT_ERROR, "Error writing environment map."); + return FALSE; + } +} -- cgit v1.2.3 From f71223400929b55720251eabd46732397f34a7b1 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Sun, 28 Aug 2011 23:44:43 +0000 Subject: SVN maintenance. --- source/blender/makesrna/intern/rna_texture_api.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index f83caca3944..8d4b73f1f0c 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -1,4 +1,5 @@ /* + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * -- cgit v1.2.3 From c1eb0c3783a8a58b8b8f0e380cd931ef02cb69da Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 29 Aug 2011 01:00:14 +0000 Subject: clear some warnings with new proxy code. --- source/blender/imbuf/intern/indexer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 5a819cef652..3528318ba81 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -51,8 +51,11 @@ static char temp_ext [] = "_part"; static int proxy_sizes[] = { IMB_PROXY_25, IMB_PROXY_50, IMB_PROXY_75, IMB_PROXY_100 }; static float proxy_fac[] = { 0.25, 0.50, 0.75, 1.00 }; + +#ifdef WITH_FFMPEG static int tc_types[] = { IMB_TC_RECORD_RUN, IMB_TC_FREE_RUN, IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN }; +#endif #define INDEX_FILE_VERSION 1 @@ -398,7 +401,7 @@ static void get_tc_filename(struct anim * anim, IMB_Timecode_Type tc, { char index_dir[FILE_MAXDIR]; int i = IMB_timecode_to_array_index(tc); - char * index_names[] = { + const char * index_names[] = { "record_run%s.blen_tc", "free_run%s.blen_tc", "interp_free_run%s.blen_tc" }; @@ -928,7 +931,7 @@ static AviMovie * alloc_proxy_output_avi( } static void index_rebuild_fallback(struct anim * anim, - IMB_Timecode_Type tcs_in_use, + IMB_Timecode_Type UNUSED(tcs_in_use), IMB_Proxy_Size proxy_sizes_in_use, int quality, short *stop, short *do_update, -- cgit v1.2.3 From ea07e367c5e803a40ff4f0f50d28f88d9104434c Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 29 Aug 2011 03:20:15 +0000 Subject: bge bugfix: [#28362] Controllers names appear incorrectly with a python query the uniquename was never fully implemented for sensors and actuators, only for controllers. at some point we either get rid of all of them, or bring them all on. For now removing the "unique name" of controllers --- source/gameengine/Converter/KX_ConvertControllers.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp index 98afc3a690a..fafaaf5cef6 100644 --- a/source/gameengine/Converter/KX_ConvertControllers.cpp +++ b/source/gameengine/Converter/KX_ConvertControllers.cpp @@ -210,7 +210,11 @@ void BL_ConvertControllers( CIntValue* uniqueval = new CIntValue(uniqueint); uniquename += uniqueval->GetText(); uniqueval->Release(); - gamecontroller->SetName(uniquename); + //unique name was never implemented for sensors and actuators, only for controllers + //and it's producing difference in the keys for the lists: obj.controllers/sensors/actuators + //at some point it should either be implemented globally (and saved as a separate var) or removed. + //gamecontroller->SetName(uniquename); + gamecontroller->SetName(bcontr->name); gameobj->AddController(gamecontroller); converter->RegisterGameController(gamecontroller, bcontr); -- cgit v1.2.3 From 296cc41b03b18fbe65357aa0cfdf43f43c881922 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 29 Aug 2011 06:19:55 +0000 Subject: BGE Animations: Various changes to make code reviewers happy: * Naming/style changes * Taking advantage of switch statements * Removing unneeded NULL checks * etc --- source/gameengine/Converter/BL_ActionActuator.cpp | 105 +++++++++++---------- source/gameengine/Converter/BL_ActionActuator.h | 2 +- source/gameengine/Converter/BL_ArmatureObject.cpp | 7 +- .../Converter/BL_DeformableGameObject.cpp | 5 +- source/gameengine/Ketsji/BL_ActionManager.cpp | 21 ++--- 5 files changed, 71 insertions(+), 69 deletions(-) (limited to 'source') diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index ec5ab423f60..50afac6992e 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -139,46 +139,51 @@ bool BL_ActionActuator::Update(double curtime, bool frame) { bool bNegativeEvent = false; bool bPositiveEvent = false; - bool use_continue = false; + bool bUseContinue = false; KX_GameObject *obj = (KX_GameObject*)GetParent(); - short play_mode = BL_Action::ACT_MODE_PLAY; - float start = m_startframe, end = m_endframe; + short playtype = BL_Action::ACT_MODE_PLAY; + float start = m_startframe; + float end = m_endframe; // If we don't have an action, we can't do anything if (!m_action) return false; - // Convert playmode - if (m_playtype == ACT_ACTION_LOOP_END) - play_mode = BL_Action::ACT_MODE_LOOP; - else if (m_playtype == ACT_ACTION_LOOP_STOP) - play_mode = BL_Action::ACT_MODE_LOOP; - else if (m_playtype == ACT_ACTION_PINGPONG) + // Convert our playtype to one that BL_Action likes + switch(m_playtype) { - // We handle ping pong ourselves to increase compabitility with the pre-Pepper actuator - play_mode = BL_Action::ACT_MODE_PLAY; + case ACT_ACTION_LOOP_END: + case ACT_ACTION_LOOP_STOP: + playtype = BL_Action::ACT_MODE_LOOP; + break; + + case ACT_ACTION_PINGPONG: + // We handle ping pong ourselves to increase compabitility + // with files made prior to animation changes from GSoC 2011. + playtype = BL_Action::ACT_MODE_PLAY; - if (m_flag & ACT_FLAG_REVERSE) - { - float tmp = start; - start = end; - end = tmp; - m_localtime = end; - } - } - else if (m_playtype == ACT_ACTION_FROM_PROP) - { - CValue* prop = GetParent()->GetProperty(m_propname); + if (m_flag & ACT_FLAG_REVERSE) + { + m_localtime = start; + start = end; + end = m_localtime; + } + + break; + case ACT_ACTION_FROM_PROP: + CValue* prop = GetParent()->GetProperty(m_propname); - play_mode = BL_Action::ACT_MODE_PLAY; - start = end = prop->GetNumber(); + playtype = BL_Action::ACT_MODE_PLAY; + start = end = prop->GetNumber(); + + 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)) - use_continue = true; + bUseContinue = true; // Handle events @@ -189,15 +194,15 @@ bool BL_ActionActuator::Update(double curtime, bool frame) RemoveAllEvents(); } - if (use_continue && m_flag & ACT_FLAG_ACTIVE) + if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) m_localtime = obj->GetActionFrame(m_layer); if (bPositiveEvent) { - if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, m_layer_weight, m_ipo_flags)) + if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags)) { m_flag |= ACT_FLAG_ACTIVE; - if (use_continue) + if (bUseContinue) obj->SetActionFrame(m_layer, m_localtime); if (m_playtype == ACT_ACTION_PLAY) @@ -225,32 +230,32 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) m_localtime = m_startframe; - if (m_playtype == ACT_ACTION_LOOP_STOP) - { - obj->StopAction(m_layer); // Stop the action after getting the frame - - // We're done - m_flag &= ~ACT_FLAG_ACTIVE; - return false; - } - else if (m_playtype == ACT_ACTION_LOOP_END || m_playtype == ACT_ACTION_PINGPONG) + switch(m_playtype) { - // Convert into a play and let it finish - obj->SetPlayMode(m_layer, BL_Action::ACT_MODE_PLAY); - - m_flag |= ACT_FLAG_PLAY_END; + case ACT_ACTION_LOOP_STOP: + obj->StopAction(m_layer); // Stop the action after getting the frame - if (m_playtype == ACT_ACTION_PINGPONG) + // We're done + m_flag &= ~ACT_FLAG_ACTIVE; + return false; + case ACT_ACTION_PINGPONG: m_flag ^= ACT_FLAG_REVERSE; - } - else if (m_playtype == ACT_ACTION_FLIPPER) - { - // Convert into a play action and play back to the beginning - end = start; - start = obj->GetActionFrame(m_layer); - obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags); + // Now fallthrough to LOOP_END code + case ACT_ACTION_LOOP_END: + // Convert into a play and let it finish + obj->SetPlayMode(m_layer, BL_Action::ACT_MODE_PLAY); - m_flag |= ACT_FLAG_PLAY_END; + m_flag |= ACT_FLAG_PLAY_END; + break; + + case ACT_ACTION_FLIPPER: + // Convert into a play action and play back to the beginning + end = start; + start = obj->GetActionFrame(m_layer); + obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags); + + m_flag |= ACT_FLAG_PLAY_END; + break; } } diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h index 126f2f29136..5324cb10885 100644 --- a/source/gameengine/Converter/BL_ActionActuator.h +++ b/source/gameengine/Converter/BL_ActionActuator.h @@ -149,7 +149,7 @@ enum { ACT_FLAG_KEYUP = 1<<2, ACT_FLAG_ACTIVE = 1<<3, ACT_FLAG_CONTINUE = 1<<4, - ACT_FLAG_PLAY_END = 1<<5 + ACT_FLAG_PLAY_END = 1<<5, }; diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 72a31566e7c..395cae4ba87 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -138,19 +138,22 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) /* Only allowed for Poses with identical channels */ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/) -{ +{ + short mode= ACTSTRIPMODE_BLEND; + bPoseChannel *dchan; const bPoseChannel *schan; bConstraint *dcon, *scon; float dstweight; int i; - short mode = ACTSTRIPMODE_BLEND; switch (mode){ case ACTSTRIPMODE_BLEND: dstweight = 1.0F - srcweight; break; case ACTSTRIPMODE_ADD: + dstweight = 1.0F; + break; default : dstweight = 1.0F; } diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp index 58294f2940e..48392ee8dda 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.cpp +++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp @@ -92,10 +92,11 @@ bool BL_DeformableGameObject::GetShape(vector &shape) { // this check is normally superfluous: a shape deformer can only be created if the mesh // has relative keys - if (shape_deformer->GetKey() && shape_deformer->GetKey()->type==KEY_RELATIVE) + Key* key = shape_deformer->GetKey(); + if (key && key->type==KEY_RELATIVE) { KeyBlock *kb; - for (kb = (KeyBlock*)shape_deformer->GetKey()->block.first; kb; kb = (KeyBlock*)kb->next) + for (kb = (KeyBlock*)key->block.first; kb; kb = (KeyBlock*)kb->next) { shape.push_back(kb->curval); } diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp b/source/gameengine/Ketsji/BL_ActionManager.cpp index af0d4bff8f0..4e4d3bc539e 100644 --- a/source/gameengine/Ketsji/BL_ActionManager.cpp +++ b/source/gameengine/Ketsji/BL_ActionManager.cpp @@ -37,42 +37,36 @@ BL_ActionManager::BL_ActionManager(class KX_GameObject *obj) BL_ActionManager::~BL_ActionManager() { for (int i=0; iGetFrame(); + return m_layers[layer]->GetFrame(); return 0.f; } void BL_ActionManager::SetActionFrame(short layer, float frame) { - if (m_layers[layer]) - m_layers[layer]->SetFrame(frame); + m_layers[layer]->SetFrame(frame); } struct bAction *BL_ActionManager::GetCurrentAction(short layer) { - if (m_layers[layer]) - return m_layers[layer]->GetAction(); + return m_layers[layer]->GetAction(); return 0; } void BL_ActionManager::SetPlayMode(short layer, short mode) { - if (m_layers[layer]) - m_layers[layer]->SetPlayMode(mode); + m_layers[layer]->SetPlayMode(mode); } void BL_ActionManager::SetTimes(short layer, float start, float end) { - if (m_layers[layer]) - m_layers[layer]->SetTimes(start, end); + m_layers[layer]->SetTimes(start, end); } bool BL_ActionManager::PlayAction(const char* name, @@ -99,8 +93,7 @@ void BL_ActionManager::StopAction(short layer) bool BL_ActionManager::IsActionDone(short layer) { - if (m_layers[layer]) - return m_layers[layer]->IsDone(); + return m_layers[layer]->IsDone(); return true; } -- cgit v1.2.3 From 6cf447a29c0c8dbdb318e28e3c8c8f95f92f5152 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 29 Aug 2011 12:57:46 +0000 Subject: Fix player build error after envmap commit. --- source/blenderplayer/bad_level_call_stubs/stubs.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source') diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 0f7a02b766e..39129fa45d7 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -51,6 +51,7 @@ struct Curve; struct EditBone; struct EditFace; struct EditMesh; +struct EnvMap; struct ID; struct FCurve; struct ImBuf; @@ -145,6 +146,7 @@ double elbeemEstimateMemreq(int res, float sx, float sy, float sz, int refine, c struct Render *RE_NewRender(const char *name){return (struct Render*) NULL;} void RE_SwapResult(struct Render *re, struct RenderResult **rr){} void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame){} +int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct EnvMap *env, const char *relpath, int imtype, float layout[12]) { return 0; } /* rna */ float *give_cursor(struct Scene *scene, struct View3D *v3d){return (float *) NULL;} -- cgit v1.2.3 From 5bac37f6d4d2e8d584ae0ec6bafd2808c47fbb25 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Mon, 29 Aug 2011 15:01:55 +0000 Subject: * Reverting Titlecard commit r37537 * Reverting update recent files commit r37155 * Turning reference counts into unsigned ints * Minor things --- source/blender/blenfont/BLF_api.h | 1 - source/blender/blenfont/intern/blf.c | 1 - source/blender/blenkernel/intern/seqeffects.c | 135 --------------------- source/blender/blenkernel/intern/sequencer.c | 3 +- source/blender/blenkernel/intern/sound.c | 1 - source/blender/blenloader/intern/writefile.c | 3 - source/blender/editors/interface/interface_style.c | 10 -- .../editors/space_sequencer/sequencer_draw.c | 1 - .../editors/space_sequencer/sequencer_edit.c | 3 +- source/blender/makesdna/DNA_sequence_types.h | 11 +- source/blender/makesdna/DNA_userdef_types.h | 1 - source/blender/makesrna/RNA_access.h | 1 - source/blender/makesrna/intern/rna_scene.c | 17 +-- source/blender/makesrna/intern/rna_sequencer.c | 35 ------ source/blender/makesrna/intern/rna_sound.c | 2 +- source/blender/makesrna/intern/rna_userdef.c | 6 +- source/blender/windowmanager/intern/wm_files.c | 7 +- 17 files changed, 15 insertions(+), 223 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index fba09ee9826..57f8c83eda6 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -215,6 +215,5 @@ void BLF_dir_free(char **dirs, int count); // XXX, bad design extern int blf_mono_font; extern int blf_mono_font_render; // dont mess drawing with render threads. -extern int blf_default_font_render; // dont mess drawing with render threads. #endif /* BLF_API_H */ diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 3bfb7c22082..c0e62b1c0c7 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -74,7 +74,6 @@ static int global_font_dpi= 72; // XXX, should these be made into global_font_'s too? int blf_mono_font= -1; int blf_mono_font_render= -1; -int blf_default_font_render= -1; static FontBLF *BLF_get(int fontid) { diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 7e760319e70..34748c64efb 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -40,11 +40,8 @@ #include "BLI_dynlib.h" #include "BLI_math.h" /* windows needs for M_PI */ -#include "BLI_string.h" #include "BLI_utildefines.h" -#include "BLF_api.h" - #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_anim_types.h" @@ -2807,130 +2804,6 @@ static struct ImBuf * do_solid_color( return out; } -/* ********************************************************************** - TITLE CARD - ********************************************************************** */ - -static void init_title_card(Sequence *seq) -{ - TitleCardVars *tv; - - if(seq->effectdata)MEM_freeN(seq->effectdata); - seq->effectdata = MEM_callocN(sizeof(struct TitleCardVars), "titlecard"); - - tv = (TitleCardVars *)seq->effectdata; - - BLI_strncpy(tv->titlestr, "Title goes here", sizeof(tv->titlestr)); - tv->fgcol[0] = tv->fgcol[1] = tv->fgcol[2] = 1.0f; /* white */ -} - -static int num_inputs_titlecard(void) -{ - return 0; -} - -static void free_title_card(Sequence *seq) -{ - if(seq->effectdata)MEM_freeN(seq->effectdata); - seq->effectdata = NULL; -} - -static void copy_title_card(Sequence *dst, Sequence *src) -{ - dst->effectdata = MEM_dupallocN(src->effectdata); -} - -static int early_out_titlecard(struct Sequence *UNUSED(seq), - float UNUSED(facf0), float UNUSED(facf1)) -{ - return -1; -} - -static struct ImBuf * do_title_card( - SeqRenderData context, Sequence *seq, float cfra, - float facf0, float facf1, - struct ImBuf *ibuf1, struct ImBuf *ibuf2, - struct ImBuf *ibuf3) -{ - TitleCardVars *tv = (TitleCardVars *)seq->effectdata; - - SolidColorVars cv = {{0}}; - struct ImBuf *out; - - int titleFontId = blf_default_font_render; // XXX: bad design! - - int width = context.rectx; - int height = context.recty; - float w, h; - int x, y; - - /* use fake solid-color vars to get backdrop (and an out buffer at the same time) */ - VECCOPY(cv.col, tv->bgcol); - seq->effectdata = &cv; - - out = do_solid_color(context, seq, cfra, - facf0, facf1, - ibuf1, ibuf2, ibuf3); - - seq->effectdata = tv; - - /* draw text */ - /* FIXME: imbuf out->rect is unsigned int NOT unsigned char, but without passing this pointer - * this drawing code doesn't work. This cast really masks some potential bugs though... - */ - BLF_buffer(titleFontId, out->rect_float, (unsigned char *)out->rect, width, height, 4); - - if (tv->titlestr[0]) { - /* automatic scale - these formulae have been derived experimentally: - * - base size is based on 40pt at 960 width - * - each 26 characters, size jumps down one step, - * but this decrease needs to be exponential to fit everything - */ - float lfac = strlen(tv->titlestr) / 26.0f; - float size = (width * 0.06f) * (1.0f - 0.1f*lfac*lfac); - - BLF_size(titleFontId, size, 72); - BLF_buffer_col(titleFontId, tv->fgcol[0], tv->fgcol[1], tv->fgcol[2], 1.0); - - BLF_width_and_height(titleFontId, tv->titlestr, &w, &h); - x = width/2.0f - w/2.0f; - if (tv->subtitle[0]) - y = height/2.0f + h; - else - y = height/2.0f; - - BLF_position(titleFontId, x, y, 0.0); - BLF_draw_buffer(titleFontId, tv->titlestr); - } - - if (tv->subtitle[0]) { - /* automatic scale - these formulae have been derived experimentally (as above): - * - base size is based on 20pt at 960 width - * - size steps aren't quite as refined here. Need a slower-growing curve! - */ - float lfac = strlen(tv->subtitle) / 36.0f; - float size = (width * 0.03f) * (1.0f - 0.1f*lfac*lfac*log(lfac)); - - BLF_size(titleFontId, size, 72); - BLF_buffer_col(titleFontId, tv->fgcol[0], tv->fgcol[1], tv->fgcol[2], 1.0); - - BLF_width_and_height(titleFontId, tv->subtitle, &w, &h); - x = width/2.0f - w/2.0f; - if (tv->titlestr[0]) - y = height/2.0f - h; - else - y = height/2.0f; - - BLF_position(titleFontId, x, y, 0.0); - BLF_draw_buffer(titleFontId, tv->subtitle); - } - - /* cleanup the buffer. */ - BLF_buffer(UIFONT_DEFAULT, NULL, NULL, 0, 0, 0); - - return out; -} - /* ********************************************************************** MULTICAM ********************************************************************** */ @@ -3470,14 +3343,6 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) rval.early_out = early_out_adjustment; rval.execute = do_adjustment; break; - case SEQ_TITLECARD: - rval.init = init_title_card; - rval.num_inputs = num_inputs_titlecard; - rval.early_out = early_out_titlecard; - rval.free = free_title_card; - rval.copy = copy_title_card; - rval.execute = do_title_card; - break; } return rval; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index bfbaa223a99..023a10b3103 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -903,7 +903,6 @@ static const char *give_seqname_by_type(int type) case SEQ_MULTICAM: return "Multicam"; case SEQ_ADJUSTMENT: return "Adjustment"; case SEQ_SPEED: return "Speed"; - case SEQ_TITLECARD: return "Title Card"; default: return NULL; } @@ -3029,7 +3028,7 @@ Sequence *seq_foreground_frame_get(Scene *scene, int frame) if(seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame) continue; /* only use elements you can see - not */ - if (ELEM6(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE, SEQ_COLOR, SEQ_TITLECARD)) { + if (ELEM5(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE, SEQ_COLOR)) { if (seq->machine > best_machine) { best_seq = seq; best_machine = seq->machine; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 842923e63d0..abead8d43dd 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -24,7 +24,6 @@ #include "DNA_sound_types.h" #include "DNA_speaker_types.h" -#define WITH_AUDASPACE #ifdef WITH_AUDASPACE # include "AUD_C-API.h" #endif diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index ed18945ea86..824b0410bd4 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1919,9 +1919,6 @@ static void write_scenes(WriteData *wd, ListBase *scebase) case SEQ_TRANSFORM: writestruct(wd, DATA, "TransformVars", 1, seq->effectdata); break; - case SEQ_TITLECARD: - writestruct(wd, DATA, "TitleCardVars", 1, seq->effectdata); - break; } } diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 704b9ae3a80..8d4b4209120 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -295,7 +295,6 @@ void uiStyleInit(void) { uiFont *font= U.uifonts.first; uiStyle *style= U.uistyles.first; - int defaultFontId = -1; /* recover from uninitialized dpi */ if(U.dpi == 0) @@ -315,7 +314,6 @@ void uiStyleInit(void) if(font->uifont_id==UIFONT_DEFAULT) { font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); - defaultFontId = font->blf_id; } else { font->blf_id= BLF_load(font->filename); @@ -353,14 +351,6 @@ void uiStyleInit(void) blf_mono_font_render= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size); BLF_size(blf_mono_font_render, 12, 72); - - /* also another copy of default for rendering else we get threading problems */ - if (defaultFontId != -1) { - if (blf_default_font_render == -1) - blf_default_font_render= BLF_load_mem_unique("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); - - BLF_size(blf_default_font_render, 12, 72); - } } void uiStyleFontSet(uiFontStyle *fs) diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 352e9f43648..a7b2250e37d 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -127,7 +127,6 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ case SEQ_GLOW: case SEQ_MULTICAM: case SEQ_ADJUSTMENT: - case SEQ_TITLECARD: UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col); /* slightly offset hue to distinguish different effects */ diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 24f2f5e7b4a..876280d5b0f 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -94,10 +94,9 @@ EnumPropertyItem sequencer_prop_effect_types[] = { {SEQ_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"}, {SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"}, {SEQ_COLOR, "COLOR", 0, "Color", "Color effect strip type"}, - {SEQ_SPEED, "SPEED", 0, "Speed", ""}, + {SEQ_SPEED, "SPEED", 0, "Speed", "Color effect strip type"}, {SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, {SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, - {SEQ_TITLECARD, "TITLE_CARD", 0, "Title Card", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 359ef8449e9..93cbb643334 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -227,14 +227,6 @@ typedef struct SolidColorVars { float pad; } SolidColorVars; -typedef struct TitleCardVars { - char titlestr[64]; - char subtitle[128]; - - float fgcol[3]; - float bgcol[3]; -} TitleCardVars; - typedef struct SpeedControlVars { float * frameMap; float globalSpeed; @@ -328,8 +320,7 @@ typedef struct SpeedControlVars { #define SEQ_SPEED 29 #define SEQ_MULTICAM 30 #define SEQ_ADJUSTMENT 31 -#define SEQ_TITLECARD 40 -#define SEQ_EFFECT_MAX 40 +#define SEQ_EFFECT_MAX 31 #define STRIPELEM_FAILED 0 #define STRIPELEM_OK 1 diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index e211a7c33c1..43dc532d4f6 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -442,7 +442,6 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_NONEGFRAMES (1 << 24) #define USER_TXT_TABSTOSPACES_DISABLE (1 << 25) #define USER_TOOLTIPS_PYTHON (1 << 26) -#define USER_NO_RECENTLOAD_UPDATE (1 << 27) /* helper macro for checking frame clamping */ #define FRAMENUMBER_MIN_CLAMP(cfra) \ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index b5b178c6c01..259c7de5cd4 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -536,7 +536,6 @@ extern StructRNA RNA_ThemeWidgetColors; extern StructRNA RNA_ThemeWidgetStateColors; extern StructRNA RNA_TimelineMarker; extern StructRNA RNA_Timer; -extern StructRNA RNA_TitleCardSequence; extern StructRNA RNA_ToolSettings; extern StructRNA RNA_TouchSensor; extern StructRNA RNA_TrackToConstraint; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2a558da1cb0..8cf5e3d14ec 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2500,26 +2500,27 @@ static void rna_def_scene_render_data(BlenderRNA *brna) 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_mixrate", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_mixrate"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 8000, 192000); - RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)"); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "ffmpeg_audio_volume", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ffcodecdata.audio_volume"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Volume", "Audio volume"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); +#endif + + // the following two "ffmpeg" settings are general audio settings + prop= RNA_def_property(srna, "ffmpeg_audio_mixrate", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_mixrate"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_range(prop, 8000, 192000); + RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_audio_channels", PROP_ENUM, PROP_NONE); 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"); -#endif prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frs_sec"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 6da4cddf1c1..c1f8bdc315d 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -409,8 +409,6 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr) return &RNA_ColorSequence; case SEQ_SPEED: return &RNA_SpeedControlSequence; - case SEQ_TITLECARD: - return &RNA_TitleCardSequence; default: return &RNA_Sequence; } @@ -889,7 +887,6 @@ static void rna_def_sequence(BlenderRNA *brna) {SEQ_SPEED, "SPEED", 0, "Speed", ""}, {SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, {SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, - {SEQ_TITLECARD, "TITLE_CARD", 0, "Title Card", ""}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem blend_mode_items[]= { @@ -1683,37 +1680,6 @@ static void rna_def_speed_control(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); } -static void rna_def_title_card(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "TitleCardSequence", "EffectSequence"); - RNA_def_struct_ui_text(srna, "Title Card Sequence", "Sequence strip creating an image displaying some text on a plain color background"); - RNA_def_struct_sdna_from(srna, "TitleCardVars", "effectdata"); - - /* texts */ - prop= RNA_def_property(srna, "title", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "titlestr"); - RNA_def_property_ui_text(prop, "Title", "Text for main heading"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - - prop= RNA_def_property(srna, "subtitle", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Subtitle", "Additional text to be shown under the main heading"); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - - /* colors */ - prop= RNA_def_property(srna, "color_background", PROP_FLOAT, PROP_COLOR); - RNA_def_property_float_sdna(prop, NULL, "bgcol"); - RNA_def_property_ui_text(prop, "Background Color", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - - prop= RNA_def_property(srna, "color_foreground", PROP_FLOAT, PROP_COLOR); - RNA_def_property_float_sdna(prop, NULL, "fgcol"); - RNA_def_property_ui_text(prop, "Text Color", ""); - RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); -} - void RNA_def_sequencer(BlenderRNA *brna) { rna_def_strip_element(brna); @@ -1739,7 +1705,6 @@ void RNA_def_sequencer(BlenderRNA *brna) rna_def_transform(brna); rna_def_solid_color(brna); rna_def_speed_control(brna); - rna_def_title_card(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index b224b55c20c..3a18fb0e7c0 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -96,7 +96,7 @@ static void rna_def_sound(BlenderRNA *brna) prop= RNA_def_property(srna, "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 mixdown to a signle one."); + RNA_def_property_ui_text(prop, "Mono", "If the file contains multiple audio channels they are rendered to a single one."); RNA_def_property_update(prop, 0, "rna_Sound_update"); } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index a67cd40e62a..7d0502f1be9 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2950,11 +2950,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 30); RNA_def_property_ui_text(prop, "Recent Files", "Maximum number of recently opened files to remember"); - - prop= RNA_def_property(srna, "use_update_recent_files_on_load", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_NO_RECENTLOAD_UPDATE); - RNA_def_property_ui_text(prop, "Update Recent on Load", "When enabled, opening files will update the recent files list. Otherwise, updates only occur when saving"); - + prop= RNA_def_property(srna, "use_save_preview_images", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS); RNA_def_property_ui_text(prop, "Save Preview Images", "Enables automatic saving of preview images in the .blend file"); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index a857577fcc8..6b3a574b6b6 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -387,12 +387,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) if (retval != BKE_READ_FILE_FAIL) { G.relbase_valid = 1; - - /* dont write recent file list if: - * 1) assuming automated tasks with background - * 2) user preference to not do this is enabled (i.e. developer testing mode) - */ - if (!G.background && !(U.flag & USER_NO_RECENTLOAD_UPDATE)) + if(!G.background) /* assume automated tasks with background, dont write recent file list */ write_history(); } -- cgit v1.2.3 From 88a538048bf7671db6a51fa2791ed1c87fa88611 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 29 Aug 2011 16:07:44 +0000 Subject: Fix #28347: VBO's highlights wrong faces when Mirror modifier is in use Added callback to drawMappedFaces which checks if two faces have got equal draw options. After discussion with Brecht we found it's nicest solution for now: - Disabling VBOs in edit mode for this case wouldn't be nicer for this case - some additional flag stored in DM should be added in this case. - Adding new callback in DM isn't nicer that this solution. - Handling face selection in drawobject would lead to duplicated code which is also not nice. Hopefully, this callback could handle all cases in the future. Also, Brecht mentioned current VBO implementation isn't perfect, so maybe when we'll redesign this area dealing with edit mode wouldn't be so tricky. --- source/blender/blenkernel/BKE_DerivedMesh.h | 3 +- source/blender/blenkernel/intern/DerivedMesh.c | 6 +++- source/blender/blenkernel/intern/cdderivedmesh.c | 31 +++++++++++++---- source/blender/blenkernel/intern/subsurf_ccg.c | 6 +++- source/blender/editors/space_view3d/drawmesh.c | 2 +- source/blender/editors/space_view3d/drawobject.c | 44 ++++++++++++++++++------ 6 files changed, 71 insertions(+), 21 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 46b533f33fd..6e17b056685 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -283,7 +283,8 @@ struct DerivedMesh { int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, - int (*setMaterial)(int, void *attribs)); + int (*setMaterial)(int, void *attribs), + int (*compareDrawOptions)(void *userData, int cur_index, int next_index)); /* Draw mapped faces using MTFace * o Drawing options too complicated to enumerate, look at code. diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index c84bcaabbd3..ff7f2586767 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -637,7 +637,8 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use } /* note, material function is ignored for now. */ -static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs)) +static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs), + int (*compareDrawOptions)(void *userData, int cur_index, int next_index)) { EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm; EditFace *efa; @@ -645,6 +646,9 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us (void)setMaterial; /* unused */ + /* currently unused -- each original face is handled separately */ + (void)compareDrawOptions; + if (emdm->vertexCos) { EditVert *eve; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 12fb11c68b3..5eb97630e83 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -843,7 +843,8 @@ static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tfa cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } -static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) +static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs), + int (*compareDrawOptions)(void *userData, int cur_index, int next_index)) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MVert *mv = cddm->mvert; @@ -958,6 +959,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us MFace *mface= mf + actualFace; int drawSmooth= (mface->flag & ME_SMOOTH); int draw = 1; + int flush = 0; if(i != tottri-1) next_actualFace= dm->drawObject->triangle_to_mface[i+1]; @@ -972,11 +974,28 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us /* Goal is to draw as long of a contiguous triangle array as possible, so draw when we hit either an invisible triangle or at the end of the array */ - if(!draw || i == tottri - 1 || mf[actualFace].mat_nr != mf[next_actualFace].mat_nr) { - if(prevstart != i) - /* Add one to the length (via `draw') - if we're drawing at the end of the array */ - glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3); + + /* flush buffer if current triangle isn't drawable or it's last triangle... */ + flush= !draw || i == tottri - 1; + + /* ... or when material setting is dissferent */ + flush|= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr; + + 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(flush) { + int first= prevstart*3; + int count= (i-prevstart+(draw ? 1 : 0))*3; /* Add one to the length if we're drawing at the end of the array */ + + if(count) + glDrawArrays(GL_TRIANGLES, first, count); + prevstart = i + 1; } } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 67d7e7bffd6..186a5ea1852 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1779,7 +1779,8 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm) } } -static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) { +static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs), + int (*compareDrawOptions)(void *userData, int cur_index, int next_index)) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; MCol *mcol= NULL; @@ -1787,6 +1788,9 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u char *faceFlags = ccgdm->faceFlags; int gridFaces = gridSize - 1, totface; + /* currently unused -- each original face is handled separately */ + (void)compareDrawOptions; + if(useColors) { mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL); if(!mcol) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 71c85483244..6e02ecbd5a8 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -607,7 +607,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o } else if(faceselect) { if(ob->mode & OB_MODE_WEIGHT_PAINT) - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material, NULL); else dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, me); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 638d197ccf7..8ca352ffe42 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2030,6 +2030,28 @@ static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNU return 0; } +static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int next_index) +{ + struct { unsigned char *cols[3]; EditFace *efa_act; } * data = userData; + EditFace *efa = EM_get_face_for_index(index); + EditFace *next_efa = EM_get_face_for_index(next_index); + unsigned char *col, *next_col; + + if(efa == next_efa) + return 1; + + if(efa == data->efa_act || next_efa == data->efa_act) + return 0; + + col = data->cols[(efa->f&SELECT)?1:0]; + next_col = data->cols[(next_efa->f&SELECT)?1:0]; + + if(col[3]==0 || next_col[3]==0) + return 0; + + return col == next_col; +} + /* also draws the active face */ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *actCol, EditFace *efa_act) { @@ -2039,7 +2061,7 @@ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned data.cols[2] = actCol; data.efa_act = efa_act; - dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material); + dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions); } static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index) @@ -2449,7 +2471,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object glEnable(GL_LIGHTING); glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); - finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material); + finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL); glFrontFace(GL_CCW); glDisable(GL_LIGHTING); @@ -2678,7 +2700,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D /* weight paint in solid mode, special case. focus on making the weights clear * rather than the shading, this is also forced in wire view */ GPU_enable_material(0, NULL); - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL); bglPolygonOffset(rv3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better @@ -2758,7 +2780,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL); glDisable(GL_COLOR_MATERIAL); glDisable(GL_LIGHTING); @@ -2766,10 +2788,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) { if(me->mcol) - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material, NULL); else { glColor3f(1.0f, 1.0f, 1.0f); - dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material); + dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material, NULL); } } } @@ -6459,7 +6481,7 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh cpack(0); if (facecol) { - dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0, GPU_enable_material); + dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0, GPU_enable_material, NULL); if(check_ob_drawface_dot(scene, v3d, ob->dt)) { glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); @@ -6470,7 +6492,7 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh } } else { - dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0, GPU_enable_material); + dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0, GPU_enable_material, NULL); } } @@ -6499,8 +6521,8 @@ static void bbs_mesh_solid(Scene *scene, Object *ob) glColor3ub(0, 0, 0); - if((me->editflag & ME_EDIT_PAINT_MASK)) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0, GPU_enable_material); - else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0, GPU_enable_material); + if((me->editflag & ME_EDIT_PAINT_MASK)) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0, GPU_enable_material, NULL); + else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0, GPU_enable_material, NULL); dm->release(dm); } @@ -6607,7 +6629,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r GPU_end_object_materials(); } else if(edm) - edm->drawMappedFaces(edm, NULL, NULL, 0, GPU_enable_material); + edm->drawMappedFaces(edm, NULL, NULL, 0, GPU_enable_material, NULL); glDisable(GL_LIGHTING); } -- cgit v1.2.3 From 099760cf1f7969d1cd16c6b5bd1a77d86bc62547 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 29 Aug 2011 17:46:07 +0000 Subject: Fix #28295 Outliner, mouse button on menu's pass through. It was introduced in rev33603 with not good patch -- release event was catching by outliner after clicking on menu item. Use KM_CLICK instead of KM_RELEASE to deal with icon drag/drop. This not changes drag/drop behavior, but prevents unneeded event be handled. Also make consistent behavior of activating and extending selection. --- source/blender/editors/space_outliner/outliner_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index f3e2c352172..2917aa5ffda 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -90,8 +90,8 @@ void outliner_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_DBL_CLICK, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_RELEASE, 0, 0)->ptr, "extend", 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, 0, 0)->ptr, "extend", 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0)->ptr, "extend", 1); RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0)->ptr, "all", 0); RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "all", 1); -- cgit v1.2.3 From 5b5e600db6f529ad7e1af9d4bb3a193be2265342 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 30 Aug 2011 07:57:55 +0000 Subject: Last bunch of minor fixes before merge. * Use NULL in AUD_Reference.h * Use SETLOOPER in sound.c * Move flags to the end of Speaker struct. --- source/blender/blenkernel/intern/sound.c | 4 +++- source/blender/editors/sound/sound_ops.c | 7 +++++++ source/blender/makesdna/DNA_speaker_types.h | 7 ++++--- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index abead8d43dd..985fef974d3 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -37,6 +37,7 @@ #include "BKE_packedFile.h" #include "BKE_animsys.h" #include "BKE_sequencer.h" +#include "BKE_scene.h" // evil global ;-) static int sound_cfra; @@ -656,12 +657,13 @@ void sound_update_scene(struct Scene* scene) NlaTrack* track; NlaStrip* strip; Speaker* speaker; + Scene* sce_it; void* new_set = AUD_createSet(); void* handle; float quat[4]; - for(base = FIRSTBASE; base; base=base->next) + for(SETLOOPER(scene, sce_it, base)) { ob = base->object; if(ob->type == OB_SPEAKER) diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index fb4355d0df7..e66abffbfd1 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -648,6 +648,13 @@ static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)) void SOUND_OT_update_animation_flags(wmOperatorType *ot) { + /* + This operator is needed to set a correct state of the sound animation + System. Unfortunately there's no really correct place to call the exec + function, that's why I made it an operator that's only visible in the + search menu. Apart from that the bake animation operator calls it too. + */ + /* identifiers */ ot->name= "Update animation"; ot->description= "Update animation flags"; diff --git a/source/blender/makesdna/DNA_speaker_types.h b/source/blender/makesdna/DNA_speaker_types.h index 50cb62c79e5..fecc65885c5 100644 --- a/source/blender/makesdna/DNA_speaker_types.h +++ b/source/blender/makesdna/DNA_speaker_types.h @@ -39,9 +39,6 @@ typedef struct Speaker { struct bSound *sound; - short flag; - short pad1[3]; - // not animatable properties float volume_max; float volume_min; @@ -55,6 +52,10 @@ typedef struct Speaker { // animatable properties float volume; float pitch; + + // flag + short flag; + short pad1[3]; } Speaker; /* **************** SPEAKER ********************* */ -- cgit v1.2.3 From 27ec8d5043f544685001aab3552b9b4b56bc1e1a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 30 Aug 2011 09:50:31 +0000 Subject: fix for some warnings with the recent merge, also tag unused args. --- source/blender/blenlib/intern/BLI_kdopbvh.c | 8 +++--- source/blender/blenlib/intern/BLI_kdtree.c | 4 +-- source/blender/blenlib/intern/graph.c | 2 +- .../editors/animation/anim_channels_defines.c | 2 +- .../blender/editors/animation/anim_channels_edit.c | 2 +- source/blender/editors/animation/anim_filter.c | 2 +- source/blender/editors/armature/poseSlide.c | 6 ++-- source/blender/editors/armature/poseobject.c | 4 +-- source/blender/editors/object/object_select.c | 2 +- source/blender/editors/space_graph/graph_draw.c | 2 +- source/blender/editors/space_nla/nla_edit.c | 12 ++++---- .../editors/space_outliner/outliner_tools.c | 2 +- source/blender/editors/space_view3d/drawobject.c | 33 +++++++++------------- source/blender/imbuf/CMakeLists.txt | 4 ++- source/blender/imbuf/intern/indexer_dv.c | 5 ++-- 15 files changed, 44 insertions(+), 46 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 527692348e7..dcbe043f0d0 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1494,7 +1494,7 @@ static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *nod float t2z = (bv[data->index[5]] - data->ray.origin[2]) * data->idot_axis[2]; if(t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return FLT_MAX; - if(t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return FLT_MAX; + if(t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return FLT_MAX; if(t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist) return FLT_MAX; dist = t1x; @@ -1599,11 +1599,11 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float data.ray_dot_axis[i] = INPR( data.ray.direction, KDOP_AXES[i]); data.idot_axis[i] = 1.0f / data.ray_dot_axis[i]; - if(fabs(data.ray_dot_axis[i]) < FLT_EPSILON) + if(fabsf(data.ray_dot_axis[i]) < FLT_EPSILON) { data.ray_dot_axis[i] = 0.0; } - data.index[2*i] = data.idot_axis[i] < 0.0 ? 1 : 0; + data.index[2*i] = data.idot_axis[i] < 0.0f ? 1 : 0; data.index[2*i+1] = 1 - data.index[2*i]; data.index[2*i] += 2*i; data.index[2*i+1] += 2*i; @@ -1654,7 +1654,7 @@ float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, fl dist = ray_nearest_hit(&data, bv); - if(dist > 0.0) + if(dist > 0.0f) { VECADDFAC(pos, light_start, data.ray.direction, dist); } diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 713bfde3417..c885e8c8a9c 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -187,7 +187,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest * cur_dist = node->co[node->d] - co[node->d]; - if(cur_dist<0.0){ + if(cur_dist<0.0f){ cur_dist= -cur_dist*cur_dist; if(-cur_distco[node->d] - co[node->d]; - if(cur_dist<0.0){ + if(cur_dist<0.0f){ cur_dist= -cur_dist*cur_dist; if(foundlength - ring[i].arc->length) > limit) + if (fabsf(ring[first].arc->length - ring[i].arc->length) > limit) { dispatch = 1; } diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 806af4c0ef5..bdc654ff25a 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -1273,7 +1273,7 @@ static int acf_dstex_icon(bAnimListElem *UNUSED(ale)) /* offset for texture expanders */ // FIXME: soon to be obsolete? -static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *ale) +static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 14; // XXX: simply include this in indention instead? } diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index c9d6f9a6420..d58d51c8e08 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2018,7 +2018,7 @@ static void rename_anim_channels (bAnimContext *ac, int channel_index) ED_region_tag_redraw(ac->ar); } -static int animchannels_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *evt) { bAnimContext ac; ARegion *ar; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 0472731dd6d..8010a41ccb3 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -990,7 +990,7 @@ static size_t animfilter_fcurves (ListBase *anim_data, bDopeSheet *ads, FCurve * return items; } -static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *act, bActionGroup *agrp, int filter_mode, ID *owner_id) +static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *UNUSED(act), bActionGroup *agrp, int filter_mode, ID *owner_id) { ListBase tmp_data = {NULL, NULL}; size_t tmp_items = 0; diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 3c15ff52a30..b0ff60455cf 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -520,7 +520,7 @@ static void pose_slide_reset (tPoseSlideOp *pso) /* ------------------------------------ */ /* draw percentage indicator in header */ -static void pose_slide_draw_status (bContext *C, tPoseSlideOp *pso) +static void pose_slide_draw_status (tPoseSlideOp *pso) { char statusStr[32]; char mode[32]; @@ -615,7 +615,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp * WM_cursor_modal(win, BC_EW_SCROLLCURSOR); /* header print */ - pose_slide_draw_status(C, pso); + pose_slide_draw_status(pso); /* add a modal handler for this operator */ WM_event_add_modal_handler(C, op); @@ -672,7 +672,7 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) RNA_float_set(op->ptr, "percentage", pso->percentage); /* update percentage indicator in header */ - pose_slide_draw_status(C, pso); + pose_slide_draw_status(pso); /* reset transforms (to avoid accumulation errors) */ pose_slide_reset(pso); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index d2f32837d6d..3911be02fe7 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1611,7 +1611,7 @@ static int compare_agroup(const void *sgrp_a_ptr, const void *sgrp_b_ptr) return strcmp(sgrp_a->agrp->name, sgrp_b->agrp->name); } -static int group_sort_exec(bContext *C, wmOperator *op) +static int group_sort_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; bPose *pose= (ob) ? ob->pose : NULL; @@ -2275,7 +2275,7 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot) /* ********************************************** */ /* Clear User Transforms */ -static int pose_clear_user_transforms_exec (bContext *C, wmOperator *op) +static int pose_clear_user_transforms_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index b3c4ffc0ac9..cb1fc7541d0 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -600,7 +600,7 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob)) */ for (ksp = ks->paths.first; ksp; ksp = ksp->next) { /* if id matches, select then stop looping (match found) */ - if (ksp->id == base->object) { + if (ksp->id == (ID *)base->object) { ED_base_object_select(base, BA_SELECT); changed = 1; break; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index d65297e068d..dc5e71f0406 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -706,7 +706,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View if (fcu->driver) resol= 32; else - resol= (int)(5.0*len_v2v2(bezt->vec[1], prevbezt->vec[1])); + resol= (int)(5.0f*len_v2v2(bezt->vec[1], prevbezt->vec[1])); if (resol < 2) { /* only draw one */ diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 0f87be0f807..1894a9fd651 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -533,7 +533,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op) if ELEM(0, (s1->flag & NLASTRIP_FLAG_SELECT), (s2->flag & NLASTRIP_FLAG_SELECT)) continue; /* check if there's space between the two */ - if (IS_EQ(s1->end, s2->start)) + if (IS_EQF(s1->end, s2->start)) continue; /* make sure neither one is a transition * - although this is impossible to create with the standard tools, @@ -613,7 +613,7 @@ void NLA_OT_transition_add (wmOperatorType *ot) /* ******************** Add Sound Clip Operator ***************************** */ /* Add a new sound clip */ -static int nlaedit_add_sound_exec (bContext *C, wmOperator *op) +static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1013,14 +1013,14 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip /* strip extents */ len= strip->end - strip->start; - if (IS_EQ(len, 0.0f)) + if (IS_EQF(len, 0.0f)) return; else splitframe= strip->start + (len / 2.0f); /* action range */ len= strip->actend - strip->actstart; - if (IS_EQ(len, 0.0f)) + if (IS_EQF(len, 0.0f)) splitaframe= strip->actend; else splitaframe= strip->actstart + (len / 2.0f); @@ -1858,10 +1858,10 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op) strip->start= (float)CFRA; break; case NLAEDIT_SNAP_NEAREST_FRAME: /* to nearest frame */ - strip->start= (float)(floor(start+0.5)); + strip->start= floorf(start+0.5); break; case NLAEDIT_SNAP_NEAREST_SECOND: /* to nearest second */ - strip->start= ((float)floor(start/secf + 0.5f) * secf); + strip->start= floorf(start/secf + 0.5f) * secf; break; case NLAEDIT_SNAP_NEAREST_MARKER: /* to nearest marker */ strip->start= (float)ED_markers_find_nearest_marker_time(ac.markers, start); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 4525ea9c8d9..3ae158bd275 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -822,7 +822,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l /* ------------------------------------------ */ -static void actionset_id_cb(TreeElement *te, TreeStoreElem *tselem, TreeStoreElem *tsep, ID *actId) +static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, TreeStoreElem *tsep, ID *actId) { bAction *act = (bAction *)actId; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index b4ccea71aa2..d573198aa10 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1493,7 +1493,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob } /* flag similar to draw_object() */ -static void drawspeaker(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int flag) +static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D *UNUSED(rv3d), Object *UNUSED(ob), int UNUSED(flag)) { //Speaker *spk = ob->data; @@ -1502,34 +1502,29 @@ static void drawspeaker(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o glEnable(GL_BLEND); - for(j = 0; j < 3; j++) - { - vec[2] = .25f * j -.125f; + for(j = 0; j < 3; j++) { + vec[2] = 0.25f * j -0.125f; glBegin(GL_LINE_LOOP); - for(i = 0; i < 16; i++) - { - vec[0] = cos(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f); - vec[1] = sin(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f); + for(i = 0; i < 16; i++) { + vec[0] = cosf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); + vec[1] = sinf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); glVertex3fv(vec); } glEnd(); } - for(j = 0; j < 4; j++) - { - vec[0] = (((j + 1) % 2) * (j - 1)) * .5f; - vec[1] = ((j % 2) * (j - 2)) * .5f; + for(j = 0; j < 4; j++) { + vec[0] = (((j + 1) % 2) * (j - 1)) * 0.5f; + vec[1] = ((j % 2) * (j - 2)) * 0.5f; glBegin(GL_LINE_STRIP); - for(i = 0; i < 3; i++) - { - if(i == 1) - { - vec[0] *= .5f; - vec[1] *= .5f; + for(i = 0; i < 3; i++) { + if(i == 1) { + vec[0] *= 0.5f; + vec[1] *= 0.5f; } - vec[2] = .25f * i -.125f; + vec[2] = 0.25f * i -0.125f; glVertex3fv(vec); } glEnd(); diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index ff13be20d4e..1547d2ee9ce 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -55,6 +55,8 @@ set(SRC intern/filetype.c intern/filter.c intern/imageprocess.c + intern/indexer.c + intern/indexer_dv.c intern/iris.c intern/jp2.c intern/jpeg.c @@ -73,7 +75,6 @@ set(SRC intern/tiff.c intern/util.c intern/writeimage.c - intern/indexer.c IMB_imbuf.h IMB_imbuf_types.h @@ -82,6 +83,7 @@ set(SRC intern/IMB_anim.h intern/IMB_filetype.h intern/IMB_filter.h + intern/IMB_indexer.h intern/IMB_metadata.h intern/cineon/cin_debug_stuff.h intern/cineon/cineonfile.h diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c index 0961af10f69..2def0d042b7 100644 --- a/source/blender/imbuf/intern/indexer_dv.c +++ b/source/blender/imbuf/intern/indexer_dv.c @@ -26,6 +26,7 @@ #include "IMB_indexer.h" #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include typedef struct indexer_dv_bitstream { @@ -279,7 +280,7 @@ static void fill_gap(indexer_dv_context * This, int isPAL) } static void proc_frame(indexer_dv_context * This, - unsigned char* framebuffer, int isPAL) + unsigned char* UNUSED(framebuffer), int isPAL) { struct tm recDate; time_t t; @@ -329,7 +330,7 @@ static void proc_frame(indexer_dv_context * This, static void indexer_dv_proc_frame(anim_index_builder * idx, unsigned char * buffer, - int data_size, + int UNUSED(data_size), struct anim_index_entry * entry) { int isPAL; -- cgit v1.2.3 From b3704f45c4e165618e898b5b7d1a7391ad14dc50 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 30 Aug 2011 10:07:50 +0000 Subject: Fixes for snprintf usage: * replace by BLI_snprintf in various places, note _snprintf on windows does not properly null terminate the string. * fix overflow in sequencer proxy code due to buffer being smaller than specified size. * fix some usage of snprintf as strcpy, this is will go wrong if the string contains % characters. * remove BLI_dynstr_printf function in gpu module, use BLI_dynstr_appendf --- source/blender/blenkernel/intern/particle_system.c | 11 +- source/blender/blenkernel/intern/pointcache.c | 20 ++-- source/blender/blenkernel/intern/report.c | 6 -- source/blender/blenkernel/intern/sequencer.c | 13 +-- source/blender/blenkernel/intern/unit.c | 11 +- source/blender/blenkernel/intern/writeffmpeg.c | 6 +- source/blender/blenlib/intern/storage.c | 2 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/physics/physics_fluid.c | 18 ++-- .../blender/editors/space_console/space_console.c | 4 +- source/blender/editors/space_nla/nla_draw.c | 14 +-- source/blender/gpu/intern/gpu_codegen.c | 111 ++++++++------------- source/blender/python/intern/bpy_rna.c | 2 +- 13 files changed, 84 insertions(+), 136 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f62ba2be193..e1ea6e419d3 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -69,6 +69,7 @@ #include "BLI_listbase.h" #include "BLI_threads.h" #include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */ +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_main.h" @@ -104,12 +105,6 @@ #include #include -#ifdef WIN32 -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - #endif // DISABLE_ELBEEM /************************************************/ @@ -3876,7 +3871,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) gzf = gzopen(filename, "rb"); if (!gzf) { - snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename); + BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s' \n", filename); // XXX bad level call elbeemDebugOut(debugStrBuffer); return; } @@ -3937,7 +3932,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) gzclose( gzf ); totpart = psys->totpart = activeParts; - snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", psys->totpart,activeParts,fileParts,readMask); + BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", psys->totpart,activeParts,fileParts,readMask); // bad level call // XXX elbeemDebugOut(debugStrBuffer); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 0f0afe30392..a56010a5ccf 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -917,14 +917,14 @@ static int ptcache_path(PTCacheID *pid, char *filename) if (i > 6) file[i-6] = '\0'; - snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */ + BLI_snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */ BLI_path_abs(filename, blendfilename); return BLI_add_slash(filename); /* new strlen() */ } /* use the temp path. this is weak but better then not using point cache at all */ /* btempdir is assumed to exist and ALWAYS has a trailing slash */ - snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid())); + BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid())); return BLI_add_slash(filename); /* new strlen() */ } @@ -948,7 +948,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p idname = (pid->ob->id.name+2); /* convert chars to hex so they are always a valid filename */ while('\0' != *idname) { - snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++)); + BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++)); newname+=2; len += 2; } @@ -967,12 +967,12 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p if(pid->cache->flag & PTCACHE_EXTERNAL) { if(pid->cache->index >= 0) - snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ + BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ else - snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */ + BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */ } else { - snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ + BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ } len += 16; } @@ -2002,7 +2002,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) if (dir==NULL) return; - snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); + BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2204,7 +2204,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (dir==NULL) return; - snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); + BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2904,7 +2904,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) return; } - snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); + BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); /* put new name into cache */ strcpy(pid->cache->name, to); @@ -2960,7 +2960,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) return; if(cache->index >= 0) - snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); + BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); else strcpy(ext, PTCACHE_EXT); diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index f84d98a31b4..4926edaeec2 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -44,12 +44,6 @@ #include #include -#ifdef _WIN32 -#ifndef vsnprintf -#define vsnprintf _vsnprintf -#endif -#endif - static const char *report_type_str(int type) { switch(type) { diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 40e02d65323..9ef30bdd49b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -78,11 +78,6 @@ # include "AUD_C-API.h" #endif -#ifdef WIN32 -#define snprintf _snprintf -#endif - - static ImBuf* seq_render_strip_stack( SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown); @@ -1193,7 +1188,7 @@ static void seq_open_anim_file(Sequence * seq) static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name) { int frameno; - char dir[FILE_MAXDIR]; + char dir[PROXY_MAXFILE]; int render_size = context.preview_render_size; if (!seq->strip->proxy) { @@ -1211,7 +1206,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { strcpy(dir, seq->strip->proxy->dir); } else if (seq->type == SEQ_IMAGE) { - snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); + BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); } else { return FALSE; } @@ -1232,14 +1227,14 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, /* generate a separate proxy directory for each preview size */ if (seq->type == SEQ_IMAGE) { - snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, + BLI_snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, context.preview_render_size, give_stripelem(seq, cfra)->name); frameno = 1; } else { frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; - snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, + BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, context.preview_render_size); } diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index a9792bc44fa..72fe1c19884 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -34,6 +34,7 @@ #include "BKE_unit.h" #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_winstuff.h" @@ -344,7 +345,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC /* Convert to a string */ { - len= snprintf(str, len_max, "%.*lf", prec, value_conv); + len= BLI_snprintf(str, len_max, "%.*lf", prec, value_conv); if(len >= len_max) len= len_max; @@ -495,7 +496,7 @@ static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pr len_name = strlen(replace_str); len_move= (len - (found_ofs+len_name)) + 1; /* 1+ to copy the string terminator */ - len_num= snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */ + len_num= BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */ if(len_num > len_max) len_num= len_max; @@ -629,12 +630,12 @@ int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pre /* add the unit prefix and re-run, use brackets incase there was an expression given */ - if(snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) { + if(BLI_snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) { strncpy(str, str_tmp, len_max); return bUnit_ReplaceString(str, len_max, NULL, scale_pref, system, type); } else { - /* snprintf would not fit into str_tmp, cant do much in this case + /* BLI_snprintf would not fit into str_tmp, cant do much in this case * check for this because otherwise bUnit_ReplaceString could call its self forever */ return 0; } @@ -705,7 +706,7 @@ void bUnit_ToUnitAltName(char *str, int len_max, char *orig_str, int system, int /* print the alt_name */ if(unit->name_alt) - len_name= snprintf(str, len_max, "%s", unit->name_alt); + len_name= BLI_snprintf(str, len_max, "%s", unit->name_alt); else len_name= 0; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 24e0fe95a1f..13875ff19f7 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -39,10 +39,6 @@ #include #include -#if defined(WIN32) && (!(defined snprintf)) -#define snprintf _snprintf -#endif - #include "MEM_guardedalloc.h" #include "DNA_scene_types.h" @@ -652,7 +648,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report fmt->audio_codec = ffmpeg_audio_codec; - snprintf(of->filename, sizeof(of->filename), "%s", name); + BLI_snprintf(of->filename, sizeof(of->filename), "%s", name); /* set the codec to the user's selection */ switch(ffmpeg_type) { case FFMPEG_AVI: diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 41eedef8835..67e27063fd0 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -338,7 +338,7 @@ void BLI_adddirstrings(void) if ( pwuser ) { BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner)); } else { - snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid); + BLI_snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid); } } #endif diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4a86de51d9c..363e98d7a4b 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10081,7 +10081,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { - snprintf(seq->strip->proxy->dir, + BLI_snprintf(seq->strip->proxy->dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir); } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 37309f1e07c..bd53de20871 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -41,12 +41,6 @@ #include #include -#ifdef WIN32 /* Windos */ -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - #include "MEM_guardedalloc.h" /* types */ @@ -155,8 +149,8 @@ static int fluid_is_animated_mesh(FluidsimSettings *fss) #if 0 /* helper function */ void fluidsimGetGeometryObjFilename(Object *ob, char *dst) { //, char *srcname) { - //snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name); - snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name); + //BLI_snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name); + BLI_snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name); } #endif @@ -888,7 +882,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) if(getenv(strEnvName)) { int dlevel = atoi(getenv(strEnvName)); elbeemSetDebugLevel(dlevel); - snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName); elbeemDebugOut(debugStrBuffer); } @@ -925,7 +919,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) /* rough check of settings... */ if(domainSettings->previewresxyz > domainSettings->resolutionxyz) { - snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz); elbeemDebugOut(debugStrBuffer); domainSettings->previewresxyz = domainSettings->resolutionxyz; } @@ -945,7 +939,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) } else { gridlevels = domainSettings->maxRefine; } - snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels ); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels ); elbeemDebugOut(debugStrBuffer); @@ -997,7 +991,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) /* ******** init domain object's matrix ******** */ copy_m4_m4(domainMat, fsDomain->obmat); if(!invert_m4_m4(invDomMat, domainMat)) { - snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n"); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n"); elbeemDebugOut(debugStrBuffer); BKE_report(reports, RPT_ERROR, "Invalid object matrix."); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 52c5100900d..c8fa049f5eb 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -169,7 +169,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) BLI_strescape(id_esc, id->name+2, sizeof(id_esc)); - snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); + BLI_snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); /* copy drag path to properties */ RNA_string_set(drop->ptr, "text", text); @@ -186,7 +186,7 @@ static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve static void path_drop_copy(wmDrag *drag, wmDropBox *drop) { char pathname[FILE_MAXDIR+FILE_MAXFILE+2]; - snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); + BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); RNA_string_set(drop->ptr, "text", pathname); } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 0583f328371..0c9c7877ddc 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -468,10 +468,10 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, /* just print the name and the range */ if (strip->flag & NLASTRIP_FLAG_TEMP_META) { - sprintf(str, "%d) Temp-Meta", index); + BLI_snprintf(str, sizeof(str), "%d) Temp-Meta", index); } else { - sprintf(str, strip->name); + BLI_strncpy(str, strip->name, sizeof(str)); } /* set text color - if colors (see above) are light, draw black text, otherwise draw white */ @@ -514,7 +514,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V { const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */ const char col[4] = {220, 220, 220, 255}; /* light grey */ - char str[16] = ""; + char str[32] = ""; /* Always draw times above the strip, whereas sequencer drew below + above. @@ -524,11 +524,11 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V * while also preserving some accuracy, since we do use floats */ /* start frame */ - sprintf(str, "%.1f", strip->start); + BLI_snprintf(str, sizeof(str), "%.1f", strip->start); UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, str, col); /* end frame */ - sprintf(str, "%.1f", strip->end); + BLI_snprintf(str, sizeof(str), "%.1f", strip->end); UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, str, col); } @@ -730,9 +730,9 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie special = ICON_ACTION; if (act) - sprintf(name, "%s", act->id.name+2); + BLI_snprintf(name, sizeof(name), "%s", act->id.name+2); else - sprintf(name, ""); + BLI_strncpy(name, "", sizeof(name)); // draw manually still doDraw= 1; diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 77498835d57..360f3dbf63f 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -59,15 +59,6 @@ #include #include -#ifdef _WIN32 -#ifndef vsnprintf -#define vsnprintf _vsnprintf -#endif -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - extern char datatoc_gpu_shader_material_glsl[]; extern char datatoc_gpu_shader_vertex_glsl[]; @@ -168,24 +159,6 @@ struct GPUPass { struct GPUShader *shader; }; -/* Strings utility */ - -static void BLI_dynstr_printf(DynStr *dynstr, const char *format, ...) -{ - va_list args; - int retval; - char str[2048]; - - va_start(args, format); - retval = vsnprintf(str, sizeof(str), format, args); - va_end(args); - - if (retval >= sizeof(str)) - fprintf(stderr, "BLI_dynstr_printf: limit exceeded\n"); - else - BLI_dynstr_append(dynstr, str); -} - /* GLSL code parsing for finding function definitions. * These are stored in a hash for lookup when creating a material. */ @@ -318,7 +291,7 @@ static char *gpu_generate_function_prototyps(GHash *hash) name = BLI_ghashIterator_getValue(ghi); function = BLI_ghashIterator_getValue(ghi); - BLI_dynstr_printf(ds, "void %s(", name); + BLI_dynstr_appendf(ds, "void %s(", name); for(a=0; atotparam; a++) { if(function->paramqual[a] == FUNCTION_QUAL_OUT) BLI_dynstr_append(ds, "out "); @@ -334,7 +307,7 @@ static char *gpu_generate_function_prototyps(GHash *hash) else BLI_dynstr_append(ds, GPU_DATATYPE_STR[function->paramtype[a]]); - //BLI_dynstr_printf(ds, " param%d", a); + //BLI_dynstr_appendf(ds, " param%d", a); if(a != function->totparam-1) BLI_dynstr_append(ds, ", "); @@ -390,42 +363,42 @@ static void codegen_convert_datatype(DynStr *ds, int from, int to, const char *t { char name[1024]; - snprintf(name, sizeof(name), "%s%d", tmp, id); + BLI_snprintf(name, sizeof(name), "%s%d", tmp, id); if (from == to) { BLI_dynstr_append(ds, name); } else if (to == GPU_FLOAT) { if (from == GPU_VEC4) - BLI_dynstr_printf(ds, "dot(%s.rgb, vec3(0.35, 0.45, 0.2))", name); + BLI_dynstr_appendf(ds, "dot(%s.rgb, vec3(0.35, 0.45, 0.2))", name); else if (from == GPU_VEC3) - BLI_dynstr_printf(ds, "dot(%s, vec3(0.33))", name); + BLI_dynstr_appendf(ds, "dot(%s, vec3(0.33))", name); else if (from == GPU_VEC2) - BLI_dynstr_printf(ds, "%s.r", name); + BLI_dynstr_appendf(ds, "%s.r", name); } else if (to == GPU_VEC2) { if (from == GPU_VEC4) - BLI_dynstr_printf(ds, "vec2(dot(%s.rgb, vec3(0.35, 0.45, 0.2)), %s.a)", name, name); + BLI_dynstr_appendf(ds, "vec2(dot(%s.rgb, vec3(0.35, 0.45, 0.2)), %s.a)", name, name); else if (from == GPU_VEC3) - BLI_dynstr_printf(ds, "vec2(dot(%s.rgb, vec3(0.33)), 1.0)", name); + BLI_dynstr_appendf(ds, "vec2(dot(%s.rgb, vec3(0.33)), 1.0)", name); else if (from == GPU_FLOAT) - BLI_dynstr_printf(ds, "vec2(%s, 1.0)", name); + BLI_dynstr_appendf(ds, "vec2(%s, 1.0)", name); } else if (to == GPU_VEC3) { if (from == GPU_VEC4) - BLI_dynstr_printf(ds, "%s.rgb", name); + BLI_dynstr_appendf(ds, "%s.rgb", name); else if (from == GPU_VEC2) - BLI_dynstr_printf(ds, "vec3(%s.r, %s.r, %s.r)", name, name, name); + BLI_dynstr_appendf(ds, "vec3(%s.r, %s.r, %s.r)", name, name, name); else if (from == GPU_FLOAT) - BLI_dynstr_printf(ds, "vec3(%s, %s, %s)", name, name, name); + BLI_dynstr_appendf(ds, "vec3(%s, %s, %s)", name, name, name); } else { if (from == GPU_VEC3) - BLI_dynstr_printf(ds, "vec4(%s, 1.0)", name); + BLI_dynstr_appendf(ds, "vec4(%s, 1.0)", name); else if (from == GPU_VEC2) - BLI_dynstr_printf(ds, "vec4(%s.r, %s.r, %s.r, %s.g)", name, name, name, name); + BLI_dynstr_appendf(ds, "vec4(%s.r, %s.r, %s.r, %s.g)", name, name, name, name); else if (from == GPU_FLOAT) - BLI_dynstr_printf(ds, "vec4(%s, %s, %s, 1.0)", name, name, name); + BLI_dynstr_appendf(ds, "vec4(%s, %s, %s, 1.0)", name, name, name); } } @@ -433,10 +406,10 @@ static void codegen_print_datatype(DynStr *ds, int type, float *data) { int i; - BLI_dynstr_printf(ds, "%s(", GPU_DATATYPE_STR[type]); + BLI_dynstr_appendf(ds, "%s(", GPU_DATATYPE_STR[type]); for(i=0; isource == GPU_SOURCE_TEX) || (input->source == GPU_SOURCE_TEX_PIXEL)) { /* create exactly one sampler for each texture */ if (codegen_input_has_texture(input) && input->bindtex) - BLI_dynstr_printf(ds, "uniform %s samp%d;\n", + BLI_dynstr_appendf(ds, "uniform %s samp%d;\n", (input->textype == GPU_TEX1D)? "sampler1D": (input->textype == GPU_TEX2D)? "sampler2D": "sampler2DShadow", input->texid); @@ -580,11 +553,11 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) name = GPU_builtin_name(input->builtin); if(gpu_str_prefix(name, "unf")) { - BLI_dynstr_printf(ds, "uniform %s %s;\n", + BLI_dynstr_appendf(ds, "uniform %s %s;\n", GPU_DATATYPE_STR[input->type], name); } else { - BLI_dynstr_printf(ds, "varying %s %s;\n", + BLI_dynstr_appendf(ds, "varying %s %s;\n", GPU_DATATYPE_STR[input->type], name); } } @@ -592,19 +565,19 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) else if (input->source == GPU_SOURCE_VEC_UNIFORM) { if(input->dynamicvec) { /* only create uniforms for dynamic vectors */ - BLI_dynstr_printf(ds, "uniform %s unf%d;\n", + BLI_dynstr_appendf(ds, "uniform %s unf%d;\n", GPU_DATATYPE_STR[input->type], input->id); } else { /* for others use const so the compiler can do folding */ - BLI_dynstr_printf(ds, "const %s cons%d = ", + BLI_dynstr_appendf(ds, "const %s cons%d = ", GPU_DATATYPE_STR[input->type], input->id); codegen_print_datatype(ds, input->type, input->vec); BLI_dynstr_append(ds, ";\n"); } } else if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) { - BLI_dynstr_printf(ds, "varying %s var%d;\n", + BLI_dynstr_appendf(ds, "varying %s var%d;\n", GPU_DATATYPE_STR[input->type], input->attribid); } } @@ -624,8 +597,8 @@ static void codegen_declare_tmps(DynStr *ds, ListBase *nodes) for (input=node->inputs.first; input; input=input->next) { if (input->source == GPU_SOURCE_TEX_PIXEL) { if (codegen_input_has_texture(input) && input->definetex) { - BLI_dynstr_printf(ds, "\tvec4 tex%d = texture2D(", input->texid); - BLI_dynstr_printf(ds, "samp%d, gl_TexCoord[%d].st);\n", + BLI_dynstr_appendf(ds, "\tvec4 tex%d = texture2D(", input->texid); + BLI_dynstr_appendf(ds, "samp%d, gl_TexCoord[%d].st);\n", input->texid, input->texid); } } @@ -633,7 +606,7 @@ static void codegen_declare_tmps(DynStr *ds, ListBase *nodes) /* declare temporary variables for node output storage */ for (output=node->outputs.first; output; output=output->next) - BLI_dynstr_printf(ds, "\t%s tmp%d;\n", + BLI_dynstr_appendf(ds, "\t%s tmp%d;\n", GPU_DATATYPE_STR[output->type], output->id); } @@ -647,13 +620,13 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final GPUOutput *output; for (node=nodes->first; node; node=node->next) { - BLI_dynstr_printf(ds, "\t%s(", node->name); + BLI_dynstr_appendf(ds, "\t%s(", node->name); for (input=node->inputs.first; input; input=input->next) { if (input->source == GPU_SOURCE_TEX) { - BLI_dynstr_printf(ds, "samp%d", input->texid); + BLI_dynstr_appendf(ds, "samp%d", input->texid); if (input->link) - BLI_dynstr_printf(ds, ", gl_TexCoord[%d].st", input->texid); + BLI_dynstr_appendf(ds, ", gl_TexCoord[%d].st", input->texid); } else if (input->source == GPU_SOURCE_TEX_PIXEL) { if (input->link && input->link->output) @@ -664,21 +637,21 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final "tex", input->texid); } else if(input->source == GPU_SOURCE_BUILTIN) - BLI_dynstr_printf(ds, "%s", GPU_builtin_name(input->builtin)); + BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin)); else if(input->source == GPU_SOURCE_VEC_UNIFORM) { if(input->dynamicvec) - BLI_dynstr_printf(ds, "unf%d", input->id); + BLI_dynstr_appendf(ds, "unf%d", input->id); else - BLI_dynstr_printf(ds, "cons%d", input->id); + BLI_dynstr_appendf(ds, "cons%d", input->id); } else if (input->source == GPU_SOURCE_ATTRIB) - BLI_dynstr_printf(ds, "var%d", input->attribid); + BLI_dynstr_appendf(ds, "var%d", input->attribid); BLI_dynstr_append(ds, ", "); } for (output=node->outputs.first; output; output=output->next) { - BLI_dynstr_printf(ds, "tmp%d", output->id); + BLI_dynstr_appendf(ds, "tmp%d", output->id); if (output->next) BLI_dynstr_append(ds, ", "); } @@ -702,7 +675,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch codegen_print_uniforms_functions(ds, nodes); //if(G.f & G_DEBUG) - // BLI_dynstr_printf(ds, "/* %s */\n", name); + // BLI_dynstr_appendf(ds, "/* %s */\n", name); BLI_dynstr_append(ds, "void main(void)\n"); BLI_dynstr_append(ds, "{\n"); @@ -731,9 +704,9 @@ static char *code_generate_vertex(ListBase *nodes) for (node=nodes->first; node; node=node->next) { for (input=node->inputs.first; input; input=input->next) { if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) { - BLI_dynstr_printf(ds, "attribute %s att%d;\n", + BLI_dynstr_appendf(ds, "attribute %s att%d;\n", GPU_DATATYPE_STR[input->type], input->attribid); - BLI_dynstr_printf(ds, "varying %s var%d;\n", + BLI_dynstr_appendf(ds, "varying %s var%d;\n", GPU_DATATYPE_STR[input->type], input->attribid); } } @@ -747,11 +720,11 @@ static char *code_generate_vertex(ListBase *nodes) if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) { if(input->attribtype == CD_TANGENT) /* silly exception */ { - BLI_dynstr_printf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid); - BLI_dynstr_printf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid); + BLI_dynstr_appendf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid); + BLI_dynstr_appendf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid); } else - BLI_dynstr_printf(ds, "\tvar%d = att%d;\n", input->attribid, input->attribid); + BLI_dynstr_appendf(ds, "\tvar%d = att%d;\n", input->attribid, input->attribid); } BLI_dynstr_append(ds, "}\n\n"); @@ -799,9 +772,9 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes) continue; if (input->ima || input->tex) - snprintf(input->shadername, sizeof(input->shadername), "samp%d", input->texid); + BLI_snprintf(input->shadername, sizeof(input->shadername), "samp%d", input->texid); else - snprintf(input->shadername, sizeof(input->shadername), "unf%d", input->id); + BLI_snprintf(input->shadername, sizeof(input->shadername), "unf%d", input->id); /* pass non-dynamic uniforms to opengl */ extract = 0; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4abcbc684e2..e1c38a82142 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1251,7 +1251,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) #if 0 // gives python decoding errors while generating docs :( char error_str[256]; - snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop)); + BLI_snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop)); PyErr_Warn(PyExc_RuntimeWarning, error_str); #endif -- cgit v1.2.3 From 947d4a654b7ec3b7f413f2132a0524ab2e2e5c9e Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 30 Aug 2011 10:09:10 +0000 Subject: Fix for [#25062] Sound Actuator - Positional Audio. Now all sounds that are not mono but have 3D checked automatically get reduced to mono during BGE conversion time. Also removed the now unneeded function sound_get_channels and added a missing header file to audaspace's CMakeLists.txt. --- source/blender/blenkernel/BKE_sound.h | 2 -- source/blender/blenkernel/intern/sound.c | 10 ---------- source/gameengine/Converter/KX_ConvertActuators.cpp | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index e1b6ff02bc4..fac5bf1cfd2 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -134,8 +134,6 @@ void sound_free_waveform(struct bSound* sound); void sound_read_waveform(struct bSound* sound); -int sound_get_channels(struct bSound* sound); - void sound_update_scene(struct Scene* scene); void* sound_get_factory(void* sound); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 985fef974d3..cdb509ab8e1 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -641,15 +641,6 @@ void sound_read_waveform(struct bSound* sound) } } -int sound_get_channels(struct bSound* sound) -{ - AUD_SoundInfo info; - - info = AUD_getInfo(sound->playback_handle); - - return info.specs.channels; -} - void sound_update_scene(struct Scene* scene) { Object* ob; @@ -769,6 +760,5 @@ void sound_seek_scene(struct bContext *UNUSED(C)) {} float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; } int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; } int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } -int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; } #endif // WITH_AUDASPACE diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 7b9cba7770b..9621d05b5cc 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -46,6 +46,7 @@ #ifdef WITH_AUDASPACE # include "AUD_C-API.h" +# include "AUD_ChannelMapperFactory.h" #endif // Actuators @@ -406,7 +407,23 @@ void BL_ConvertActuators(char* maggiename, "\" has no sound datablock." << std::endl; } else + { snd_sound = *reinterpret_cast*>(sound->playback_handle); + + // if sound shall be 3D but isn't mono, we have to make it mono! + if(is3d) + { + AUD_Reference reader = snd_sound->createReader(); + if(reader->getSpecs().channels != AUD_CHANNELS_MONO) + { + AUD_DeviceSpecs specs; + specs.channels = AUD_CHANNELS_MONO; + specs.rate = AUD_RATE_INVALID; + specs.format = AUD_FORMAT_INVALID; + snd_sound = new AUD_ChannelMapperFactory(snd_sound, specs); + } + } + } KX_SoundActuator* tmpsoundact = new KX_SoundActuator(gameobj, snd_sound, -- cgit v1.2.3 From b20c9b0ba368d5685d3c996572780befe852b889 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 30 Aug 2011 10:49:58 +0000 Subject: minor edits, pep8 - also correct float -> double promotion for blf. --- source/blender/blenfont/intern/blf.c | 30 ++++++++++++++--------------- source/blender/editors/space_nla/nla_edit.c | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index c0e62b1c0c7..fc812d652b3 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -369,28 +369,28 @@ void BLF_position(int fontid, float x, float y, float z) za= 1.0f; } - remainder= x - floor(x); - if (remainder > 0.4 && remainder < 0.6) { - if (remainder < 0.5) - x -= 0.1 * xa; + remainder= x - floorf(x); + if (remainder > 0.4f && remainder < 0.6f) { + if (remainder < 0.5f) + x -= 0.1f * xa; else - x += 0.1 * xa; + x += 0.1f * xa; } - remainder= y - floor(y); - if (remainder > 0.4 && remainder < 0.6) { - if (remainder < 0.5) - y -= 0.1 * ya; + remainder= y - floorf(y); + if (remainder > 0.4f && remainder < 0.6f) { + if (remainder < 0.5f) + y -= 0.1f * ya; else - y += 0.1 * ya; + y += 0.1f * ya; } - remainder= z - floor(z); - if (remainder > 0.4 && remainder < 0.6) { - if (remainder < 0.5) - z -= 0.1 * za; + remainder= z - floorf(z); + if (remainder > 0.4f && remainder < 0.6f) { + if (remainder < 0.5f) + z -= 0.1f * za; else - z += 0.1 * za; + z += 0.1f * za; } font->pos[0]= x; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 1894a9fd651..08026e8a1d2 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1858,7 +1858,7 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op) strip->start= (float)CFRA; break; case NLAEDIT_SNAP_NEAREST_FRAME: /* to nearest frame */ - strip->start= floorf(start+0.5); + strip->start= floorf(start+0.5f); break; case NLAEDIT_SNAP_NEAREST_SECOND: /* to nearest second */ strip->start= floorf(start/secf + 0.5f) * secf; -- cgit v1.2.3