1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 */ 16 #pragma once 17 18 /** \file 19 * \ingroup balembic 20 */ 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 struct CacheReader; 27 struct ListBase; 28 struct Main; 29 struct Mesh; 30 struct Object; 31 struct Scene; 32 struct bContext; 33 34 typedef struct AbcArchiveHandle AbcArchiveHandle; 35 36 int ABC_get_version(void); 37 38 struct AlembicExportParams { 39 double frame_start; 40 double frame_end; 41 42 unsigned int frame_samples_xform; 43 unsigned int frame_samples_shape; 44 45 double shutter_open; 46 double shutter_close; 47 48 bool selected_only; 49 bool uvs; 50 bool normals; 51 bool vcolors; 52 bool apply_subdiv; 53 bool curves_as_mesh; 54 bool flatten_hierarchy; 55 bool visible_objects_only; 56 bool renderable_only; 57 bool face_sets; 58 bool use_subdiv_schema; 59 bool packuv; 60 bool triangulate; 61 bool export_hair; 62 bool export_particles; 63 bool export_custom_properties; 64 bool use_instancing; 65 66 /* See MOD_TRIANGULATE_NGON_xxx and MOD_TRIANGULATE_QUAD_xxx 67 * in DNA_modifier_types.h */ 68 int quad_method; 69 int ngon_method; 70 71 float global_scale; 72 }; 73 74 /* The ABC_export and ABC_import functions both take a as_background_job 75 * parameter, and return a boolean. 76 * 77 * When as_background_job=true, returns false immediately after scheduling 78 * a background job. 79 * 80 * When as_background_job=false, performs the export synchronously, and returns 81 * true when the export was ok, and false if there were any errors. 82 */ 83 84 bool ABC_export(struct Scene *scene, 85 struct bContext *C, 86 const char *filepath, 87 const struct AlembicExportParams *params, 88 bool as_background_job); 89 90 bool ABC_import(struct bContext *C, 91 const char *filepath, 92 float scale, 93 bool is_sequence, 94 bool set_frame_range, 95 int sequence_len, 96 int offset, 97 bool validate_meshes, 98 bool as_background_job); 99 100 AbcArchiveHandle *ABC_create_handle(struct Main *bmain, 101 const char *filename, 102 struct ListBase *object_paths); 103 104 void ABC_free_handle(AbcArchiveHandle *handle); 105 106 void ABC_get_transform(struct CacheReader *reader, 107 float r_mat_world[4][4], 108 float time, 109 float scale); 110 111 /* Either modifies existing_mesh in-place or constructs a new mesh. */ 112 struct Mesh *ABC_read_mesh(struct CacheReader *reader, 113 struct Object *ob, 114 struct Mesh *existing_mesh, 115 const float time, 116 const char **err_str, 117 int read_flags); 118 119 bool ABC_mesh_topology_changed(struct CacheReader *reader, 120 struct Object *ob, 121 struct Mesh *existing_mesh, 122 const float time, 123 const char **err_str); 124 125 void CacheReader_incref(struct CacheReader *reader); 126 void CacheReader_free(struct CacheReader *reader); 127 128 struct CacheReader *CacheReader_open_alembic_object(struct AbcArchiveHandle *handle, 129 struct CacheReader *reader, 130 struct Object *object, 131 const char *object_path); 132 133 bool ABC_has_vec3_array_property_named(struct CacheReader *reader, const char *name); 134 135 /* r_vertex_velocities should point to a preallocated array of num_vertices floats */ 136 int ABC_read_velocity_cache(struct CacheReader *reader, 137 const char *velocity_name, 138 float time, 139 float velocity_scale, 140 int num_vertices, 141 float *r_vertex_velocities); 142 143 #ifdef __cplusplus 144 } 145 #endif 146