Changeset 556

Show
Ignore:
Timestamp:
04/01/08 15:20:03 (9 months ago)
Author:
phill
Message:

o Exporter boilerplate.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/morph-targets/libx42make/include/x42make-modelbuilder.h

    r554 r556  
    680680        void end_skeleton_update(); 
    681681 
    682         void apply_root_scale( const ::x42::math::vec3 &pos_ofs, const ::x42::math::quat &rot_ofs, 
     682        void insert_root_transform( const ::x42::math::vec3 &pos_ofs, const ::x42::math::quat &rot_ofs, 
    683683                const ::x42::math::vec3 &inner_scale_ofs, const ::x42::math::vec3 &outer_scale_ofs ); 
     684 
     685        void make_animation_scales_uniform(); 
     686        void clean_animation_tracks(); 
    684687 
    685688        void collapse_constant_bones(); 
  • branches/morph-targets/libx42make/modelbuilder-animation.cpp

    r522 r556  
    517517                v = vec3c( mid );  
    518518        } 
     519 
     520        local_matrices.clear(); 
     521        world_matrices.clear(); 
    519522} 
    520523 
     
    544547} 
    545548 
    546 void model_builder::apply_root_scale( const vec3 &pos_ofs, const quat &rot_ofs, 
     549void model_builder::clean_animation_tracks() 
     550
     551        for( size_t i = 0; i < bones.size(); i++ ) 
     552        { 
     553                bones[i]->anim_tracks.clean_tracks(); 
     554        } 
     555
     556 
     557void model_builder::make_animation_scales_uniform() 
     558
     559        for( size_t i = 0; i < bones.size(); i++ ) 
     560        { 
     561                bones[i]->anim_tracks.make_scale_uniform(); 
     562        } 
     563
     564 
     565void model_builder::insert_root_transform( const vec3 &pos_ofs, const quat &rot_ofs, 
    547566        const vec3 &inner_scale_ofs, const vec3 &outer_scale_ofs ) 
    548567{ 
  • branches/morph-targets/libx42make/modelbuilder-skeleton.cpp

    r517 r556  
    374374                        continue; 
    375375 
    376                 const animation_tracks &anim = bi->anim_tracks; 
     376                animation_tracks &anim = bi->anim_tracks; 
     377                anim.clean_tracks(); 
    377378 
    378379                if( anim.position.size() != 1 || anim.rotation.size() != 1 || 
  • branches/morph-targets/libx42pp/include/x42math-quat.h

    r462 r556  
    5555inline quat quatc( const vec3 &ijk, float w ) { quat ret = { ijk.x, ijk.y, ijk.z, w }; return ret; } 
    5656 
     57inline quat quati() { quat ret = { 0, 0, 0, 1 }; return ret; } 
     58 
    5759quat quat_from_aa( const vec3 &axis, angle a ); 
    5860void quat_to_aa( vec3 &axis, angle &a, const quat &q ); 
  • branches/morph-targets/x42maya/translator.h

    r554 r556  
    3131{ 
    3232 
     33class maya_error : public std::exception 
     34{ 
     35private: 
     36        MStatus statcode; 
     37 
     38public: 
     39        explicit maya_error( MStatus status_code ) 
     40                : statcode( status_code ) 
     41        { 
     42        } 
     43 
     44        virtual const char* what() const 
     45        { 
     46                return statcode.errorString().asChar(); 
     47        } 
     48 
     49        MStatus status_code( void ) const { return statcode; } 
     50}; 
     51 
     52void check_status( MStatus status ); 
     53 
    3354typedef make::simple_api_tag< MObject > obj_tag; 
    3455typedef make::simple_api_tag< MDagPath > dag_tag; 
     
    3758{ 
    3859public: 
    39         export_selection( MPxFileTranslator::FileAccessMode mode ); 
     60        export_selection(); 
     61        explicit export_selection( MPxFileTranslator::FileAccessMode mode ); 
    4062 
    4163        size_t mesh_count() const { return meshes.length(); } 
     
    4567        const MDagPath& tag( size_t index ) const { return tags[(uint)index]; } 
    4668 
     69        void add_mesh( const MDagPath &path ) { meshes.append( path ); } 
     70        void add_tag( const MDagPath &path ) { tags.append( path ); } 
     71 
     72        void add_all_objects(); 
     73        void add_selected_objects(); 
     74 
    4775private: 
    4876        MDagPathArray tags; 
    4977        MDagPathArray meshes; 
    5078 
    51         void is_tag( const MDagPath &path ) const; 
    52         void is_visible( const MDagPath &path ) const; 
     79        bool is_tag( const MDagPath &path ) const; 
     80        bool is_visible( const MDagPath &path ) const; 
    5381        void check_object( const MDagPath &path ); 
    5482}; 
     
    5785{ 
    5886public: 
     87        model_exporter(); 
     88 
     89        void add_mesh( const MDagPath &path ); 
     90        void add_tag( const MDagPath &path ); 
    5991        void add_objects( const export_selection &sel ); 
     92 
     93        void import_animations( MTime begin, MTime end, MTime step ); 
    6094 
    6195        void compile(); 
     
    6397        void write_file( std::ostream &out ); 
    6498 
     99        static const int do_not_split = -1; 
     100 
    65101private: 
    66102        make::model_builder     model; 
     103 
     104        persist_flags pers_flags; 
     105        bool force_uniform_scale; 
     106        vec3 pos_ofs; 
     107        quat rot_ofs; 
     108        vec3 scale_ofs; 
     109        float unit_scale; 
     110        float group_split_factor; 
     111        make::geometry::optimize_type preferred_geometry_type; 
    67112}; 
    68113 
  • branches/morph-targets/x42maya/x42maya.vcproj

    r554 r556  
    663663                        > 
    664664                        <File 
     665                                RelativePath=".\modelexporter.cpp" 
     666                                > 
     667                        </File> 
     668                        <File 
    665669                                RelativePath=".\translator.cpp" 
    666670                                >