Commit: 8f17cb2052bd5f4e5e0c57fd87fb3f527585609a Author: Michael Kowalski Date: Mon May 2 20:17:10 2022 -0400 Branches: universal-scene-description https://developer.blender.org/rB8f17cb2052bd5f4e5e0c57fd87fb3f527585609a
Merge branch 'master' into universal-scene-description =================================================================== =================================================================== diff --cc source/blender/editors/io/io_usd.c index fa76a0dc529,e0616a0cec3..684c7c45ef9 --- a/source/blender/editors/io/io_usd.c +++ b/source/blender/editors/io/io_usd.c @@@ -520,7 -201,7 +520,8 @@@ void WM_OT_usd_export(struct wmOperator ot->poll = WM_operator_winactive; ot->ui = wm_usd_export_draw; - ot->flag = OPTYPE_PRESET; - ot->flag = OPTYPE_REGISTER; /* No UNDO possible. */ ++ ot->flag = OPTYPE_PRESET /* Show preset menu. */ ++ | OPTYPE_REGISTER; /* No UNDO possible. */ WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_USD, @@@ -562,93 -222,37 +563,93 @@@ "visible_objects_only", true, "Visible Only", - "Only visible objects are exported. Invisible parents of exported objects are " - "exported as empty transform"); + "Only export visible objects. Invisible parents of exported objects are " + "exported as empty transforms"); + + RNA_def_boolean( + ot->srna, + "export_animation", + false, + "Animation", + "Export all frames in the render frame range, rather than only the current frame"); + - RNA_def_boolean(ot->srna, - "export_animation", - false, - "Animation", - "When checked, the render frame range is exported. When false, only the current " - "frame is exported"); RNA_def_boolean( - ot->srna, "export_hair", true, "Hair", "When checked, hair is exported as USD curves"); - ot->srna, "export_hair", false, "Hair", "Export hair particle systems as USD curves"); - RNA_def_boolean( - ot->srna, "export_uvmaps", true, "UV Maps", "Include all mesh UV maps in the export"); ++ ot->srna, "export_hair", true, "Hair", "Export hair particle systems as USD curves"); + RNA_def_boolean(ot->srna, + "export_vertices", + true, + "Vertices", + "When checked, vertex and point data are included in the export"); + RNA_def_boolean(ot->srna, + "export_vertex_colors", + true, + "Vertex Colors", + "When checked, all vertex colors are included in the export"); + RNA_def_boolean(ot->srna, + "export_vertex_groups", + false, + "Vertex Groups", + "When checked, all vertex groups are included in the export"); + RNA_def_boolean(ot->srna, + "export_face_maps", + false, + "Face Maps", + "When checked, all face maps are included in the export"); + RNA_def_boolean(ot->srna, + "export_uvmaps", + true, - "UV Maps", - "When checked, all UV maps of exported meshes are included in the export"); ++ "UV Maps", "Include all mesh UV maps in the export"); ++ RNA_def_boolean(ot->srna, "export_normals", true, "Normals", - "When checked, normals of exported meshes are included in the export"); + "Include normals of exported meshes in the export"); + RNA_def_boolean( + ot->srna, + "export_transforms", + true, + "Transforms", + "When checked, transform data/operations will be exported for all applicable prims"); RNA_def_boolean(ot->srna, "export_materials", true, "Materials", - "When checked, the viewport settings of materials are exported as USD preview " - "materials, and material assignments are exported as geometry subsets"); + "Export viewport settings of materials as USD preview materials, and export " + "material assignments as geometry subsets"); + RNA_def_boolean( + ot->srna, "export_meshes", true, "Meshes", "When checked, all meshes will be exported"); + RNA_def_boolean( + ot->srna, "export_lights", true, "Lights", "When checked, all lights will be exported"); + RNA_def_boolean( + ot->srna, "export_cameras", true, "Cameras", "When checked, all cameras will be exported"); + RNA_def_boolean( + ot->srna, "export_curves", true, "Curves", "When checked, all curves will be exported"); + RNA_def_boolean(ot->srna, + "export_particles", + true, + "Particles", + "When checked, all particle systems will be exported"); + + RNA_def_boolean(ot->srna, + "export_armatures", + false, + "Armatures (Experimental)", + "Export armatures and skinned meshes"); RNA_def_boolean(ot->srna, "use_instancing", false, "Instancing", - "When checked, instanced objects are exported as references in USD. " - "When unchecked, instanced objects are exported as real objects"); + "Export instanced objects as references in USD rather than real objects"); + RNA_def_boolean(ot->srna, + "fix_skel_root", + false, + "Fix Skel Root", + "If exporting armatures, attempt to automatically " + "correct invalid USD Skel Root hierarchies"); + RNA_def_enum(ot->srna, "evaluation_mode", rna_enum_usd_export_evaluation_mode_items, @@@ -1090,8 -456,8 +1091,7 @@@ void WM_OT_usd_import(struct wmOperator ot->exec = wm_usd_import_exec; ot->poll = WM_operator_winactive; ot->ui = wm_usd_import_draw; -- - ot->flag = OPTYPE_PRESET; - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ++ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_PRESET; WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_USD, diff --cc source/blender/io/usd/CMakeLists.txt index 3e78cee0d55,e2e959814fa..fd6fcb0c004 --- a/source/blender/io/usd/CMakeLists.txt +++ b/source/blender/io/usd/CMakeLists.txt @@@ -16,9 -16,24 +16,27 @@@ add_definitions(-DPXR_STATIC # USD headers use deprecated TBB headers, silence warning. add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1) +# Python is always required +add_definitions(-DWITH_PYTHON) + + # Check if USD has the imaging headers available, if they are + # add a USD_HAS_IMAGING define so code can dynamically detect this. + # Cleanup of this variable is done at the end of the file since + # test code further down uses it to add imaging tests. + FIND_FILE(USD_IMAGING_HEADERS + NAMES + capsuleAdapter.h + PATHS + ${USD_INCLUDE_DIRS} + PATH_SUFFIXES + pxr/usdImaging/usdImaging/ + NO_DEFAULT_PATH + ) + + if(USD_IMAGING_HEADERS) + add_definitions(-DUSD_HAS_IMAGING) + endif() + set(INC . ../common diff --cc source/blender/io/usd/intern/usd_reader_light.cc index 6f74d63d9e0,55b9557dfb5..2fac35735b6 --- a/source/blender/io/usd/intern/usd_reader_light.cc +++ b/source/blender/io/usd/intern/usd_reader_light.cc @@@ -10,10 -9,8 +10,9 @@@ #include "DNA_light_types.h" #include "DNA_object_types.h" +#include <pxr/usd/usdGeom/metrics.h> #include <pxr/usd/usdLux/diskLight.h> #include <pxr/usd/usdLux/distantLight.h> - #include <pxr/usd/usdLux/light.h> #include <pxr/usd/usdLux/rectLight.h> #include <pxr/usd/usdLux/shapingAPI.h> #include <pxr/usd/usdLux/sphereLight.h> @@@ -135,18 -95,20 +139,18 @@@ void USDLightReader::read_object_data(M light_prim.GetDiffuseAttr().Get(&diffuse, motionSampleTime); #endif - if (pxr::UsdAttribute spec_attr = light_api.GetSpecularAttr()) { - float spec = 0.0f; - if (spec_attr.Get(&spec, motionSampleTime)) { - blight->spec_fac = spec; - } + float specular; - if (get_authored_value(light_prim.GetSpecularAttr(), motionSampleTime, &specular) || ++ if (get_authored_value(light_api.GetSpecularAttr(), motionSampleTime, &specular) || + prim_.GetAttribute(usdtokens::specular).Get(&specular, motionSampleTime)) { + blight->spec_fac = specular; } - if (pxr::UsdAttribute color_attr = light_api.GetColorAttr()) { - pxr::GfVec3f color; - if (color_attr.Get(&color, motionSampleTime)) { - blight->r = color[0]; - blight->g = color[1]; - blight->b = color[2]; - } + pxr::GfVec3f color; - if (get_authored_value(light_prim.GetColorAttr(), motionSampleTime, &color) || ++ if (get_authored_value(light_api.GetColorAttr(), motionSampleTime, &color) || + prim_.GetAttribute(usdtokens::color).Get(&color, motionSampleTime)) { + blight->r = color[0]; + blight->g = color[1]; + blight->b = color[2]; } /* TODO(makowalski): Not currently supported. */ @@@ -275,27 -233,6 +279,27 @@@ break; } + float intensity; - if (get_authored_value(light_prim.GetIntensityAttr(), motionSampleTime, &intensity) || ++ if (get_authored_value(light_api.GetIntensityAttr(), motionSampleTime, &intensity) || + prim_.GetAttribute(usdtokens::intensity).Get(&intensity, motionSampleTime)) { + + float intensity_scale = this->import_params_.light_intensity_scale; + + if (import_params_.convert_light_from_nits) { + /* It's important that we perform the light unit conversion before applying any scaling to + * the light size, so we can use the USD's meters per unit value. */ + const float meters_per_unit = static_cast<float>( + pxr::UsdGeomGetStageMetersPerUnit(prim_.GetStage())); + intensity_scale *= nits_to_energy_scale_factor(blight, meters_per_unit * usd_world_scale_); + } + + blight->energy = intensity * intensity_scale; + } + + if ((blight->type == LA_SPOT || blight->type == LA_LOCAL) && import_params_.scale_light_radius) { + blight->area_size *= settings_->scale; + } + USDXformReader::read_object_data(bmain, motionSampleTime); } diff --cc source/blender/io/usd/intern/usd_reader_mesh.cc in @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs