Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_scene_api.c
| Show All 31 Lines | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_kdopbvh.h" | #include "BLI_kdopbvh.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | |||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "rna_internal.h" /* own include */ | #include "rna_internal.h" /* own include */ | ||||
| #ifdef WITH_ALEMBIC | |||||
| # include "../../alembic/ABC_alembic.h" | |||||
campbellbarton: 2-spaces indent for pre-processor - https://wiki.blender.org/index.php/Dev… | |||||
| #endif | |||||
| EnumPropertyItem rna_enum_abc_compression_items[] = { | |||||
| #ifdef WITH_ALEMBIC | |||||
| { ABC_ARCHIVE_OGAWA, "OGAWA", 0, "Ogawa", "" }, | |||||
| { ABC_ARCHIVE_HDF5, "HDF5", 0, "HDF5", "" }, | |||||
| #endif | |||||
| { 0, NULL, 0, NULL, NULL } | |||||
| }; | |||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_depsgraph.h" | #include "BKE_depsgraph.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| ▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | else { | ||||
| *r_success = false; | *r_success = false; | ||||
| unit_m4((float(*)[4])r_obmat); | unit_m4((float(*)[4])r_obmat); | ||||
| zero_v3(r_location); | zero_v3(r_location); | ||||
| zero_v3(r_normal); | zero_v3(r_normal); | ||||
| } | } | ||||
| } | } | ||||
| #ifdef WITH_ALEMBIC | |||||
| static void rna_Scene_alembic_export( | |||||
| Scene *scene, | |||||
| bContext *C, | |||||
| const char *filepath, | |||||
| int start, | |||||
| int end, | |||||
| int xformsamples, | |||||
| int geomsamples, | |||||
| float shutter_open, | |||||
| float shutter_close, | |||||
| int selected_only, | |||||
| int uvs, | |||||
| int normals, | |||||
| int vcolors, | |||||
| int apply_subdiv, | |||||
| int flatten_hierarchy, | |||||
| int vislayers, | |||||
| int renderable, | |||||
| int facesets, | |||||
| int subdiv_schema, | |||||
| int compression, | |||||
| int packuv, | |||||
| float scale) | |||||
| { | |||||
| /* We have to enable allow_threads, because we may change scene frame number | |||||
| * during export. */ | |||||
| #ifdef WITH_PYTHON | |||||
| BPy_BEGIN_ALLOW_THREADS; | |||||
| #endif | |||||
| ABC_export(scene, | |||||
| C, | |||||
| filepath, | |||||
| start, | |||||
| end, | |||||
| 1.0 / (double)xformsamples, | |||||
| 1.0 / (double)geomsamples, | |||||
| shutter_open, | |||||
| shutter_close, | |||||
| selected_only, | |||||
| uvs, | |||||
| normals, | |||||
| vcolors, | |||||
| apply_subdiv, | |||||
| flatten_hierarchy, | |||||
| vislayers, | |||||
| renderable, | |||||
| facesets, | |||||
| subdiv_schema, | |||||
| compression, | |||||
| packuv, | |||||
| scale); | |||||
| #ifdef WITH_PYTHON | |||||
| BPy_END_ALLOW_THREADS; | |||||
| #endif | |||||
| } | |||||
| #endif | |||||
| #ifdef WITH_COLLADA | #ifdef WITH_COLLADA | ||||
| /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ | /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ | ||||
| #include "../../collada/collada.h" | #include "../../collada/collada.h" | ||||
| static void rna_Scene_collada_export( | static void rna_Scene_collada_export( | ||||
| Scene *scene, | Scene *scene, | ||||
| const char *filepath, | const char *filepath, | ||||
| int apply_modifiers, | int apply_modifiers, | ||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | #ifdef WITH_COLLADA | ||||
| parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); | parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); | ||||
| parm = RNA_def_boolean(func, "open_sim", 0, "Export for SL/OpenSim", "Compatibility mode for SL, OpenSim and similar online worlds"); | parm = RNA_def_boolean(func, "open_sim", 0, "Export for SL/OpenSim", "Compatibility mode for SL, OpenSim and similar online worlds"); | ||||
| parm = RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, | parm = RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, | ||||
| "Transformation", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); | "Transformation", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); | ||||
| RNA_def_function_ui_description(func, "Export to collada file"); | RNA_def_function_ui_description(func, "Export to collada file"); | ||||
| #endif | #endif | ||||
| #ifdef WITH_ALEMBIC | |||||
| func = RNA_def_function(srna, "alembic_export", "rna_Scene_alembic_export"); | |||||
| RNA_def_function_ui_description(func, "Export to Alembic file"); | |||||
| parm = RNA_def_string(func, "filepath", NULL, FILE_MAX, "File Path", "File path to write Alembic file"); | |||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | |||||
| RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ | |||||
| RNA_def_int(func, "start", 1, INT_MIN, INT_MAX, "Start", "Start Frame", INT_MIN, INT_MAX); | |||||
| RNA_def_int(func, "end", 1, INT_MIN, INT_MAX, "End", "End Frame", INT_MIN, INT_MAX); | |||||
| RNA_def_int(func, "xformsamples", 1, 1, 128, "Xform samples", "Transform samples per frame", 1, 128); | |||||
| RNA_def_int(func, "geomsamples", 1, 1, 128, "Geom samples", "Geometry samples per frame", 1, 128); | |||||
| RNA_def_float(func, "sh_open", 0.0f, -1.0f, 1.0f, "Shutter open", "", -1.0f, 1.0f); | |||||
| RNA_def_float(func, "sh_close", 1.0f, -1.0f, 1.0f, "Shutter close", "", -1.0f, 1.0f); | |||||
| RNA_def_boolean(func, "selected_only" , 0, "Selected only", "Export only selected objects"); | |||||
| RNA_def_boolean(func, "uvs" , 1, "UVs", "Export UVs"); | |||||
| RNA_def_boolean(func, "normals" , 1, "Normals", "Export cormals"); | |||||
| RNA_def_boolean(func, "vcolors" , 0, "Vertex colors", "Export vertex colors"); | |||||
| RNA_def_boolean(func, "forcemeshes" , 1, "Subsurfs as meshes", "Export subdivision surfaces as meshes"); | |||||
| RNA_def_boolean(func, "flatten" , 0, "Flatten hierarchy", "Flatten hierarchy"); | |||||
| RNA_def_boolean(func, "vislayers" , 0, "Visible layers only", "Export only objects in visible layers"); | |||||
| RNA_def_boolean(func, "renderable" , 0, "Renderable objects only", "Export only objects marked renderable in the outliner"); | |||||
| RNA_def_boolean(func, "facesets" , 0, "Facesets", "Export facesets"); | |||||
| RNA_def_boolean(func, "subdiv_schema", 0, "Use Alembic subdivision Schema", "Use Alembic subdivision Schema"); | |||||
| RNA_def_enum(func, "compression_type", rna_enum_abc_compression_items, 0, "Compression", ""); | |||||
| RNA_def_boolean(func, "packuv" , 0, "Export with packed UV islands", "Export with packed UV islands"); | |||||
| RNA_def_float(func, "scale", 1.0f, 0.0001f, 1000.0f, "Scale", "Value by which to enlarge or shrink the objects with respect to the world's origin", 0.0001f, 1000.0f); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT); | |||||
| #endif | |||||
| } | } | ||||
| void RNA_api_scene_render(StructRNA *srna) | void RNA_api_scene_render(StructRNA *srna) | ||||
| { | { | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| Show All 15 Lines | |||||
2-spaces indent for pre-processor - https://wiki.blender.org/index.php/Dev:Doc/Code_Style#Preprocessor_Indentation