[Bf-blender-cvs] [ffa078a0796] temp-usd-latest-master: Merge remote-tracking branch 'blender_org/master' into temp-usd-latest-master

Michael Kowalski noreply at git.blender.org
Fri Sep 10 04:34:32 CEST 2021


Commit: ffa078a0796ffce22870832bc4fd3ff179d30832
Author: Michael Kowalski
Date:   Thu Sep 9 22:24:54 2021 -0400
Branches: temp-usd-latest-master
https://developer.blender.org/rBffa078a0796ffce22870832bc4fd3ff179d30832

Merge remote-tracking branch 'blender_org/master' into temp-usd-latest-master

===================================================================



===================================================================

diff --cc source/blender/editors/io/io_usd.c
index abcc1955318,d0007d9e5be..7fd550a1254
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@@ -215,143 -125,23 +215,143 @@@ static int wm_usd_export_exec(bContext 
    const bool visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only");
    const bool export_animation = RNA_boolean_get(op->ptr, "export_animation");
    const bool export_hair = RNA_boolean_get(op->ptr, "export_hair");
 +  const bool export_vertices = RNA_boolean_get(op->ptr, "export_vertices");
 +  const bool export_vertex_colors = RNA_boolean_get(op->ptr, "export_vertex_colors");
 +  const bool export_vertex_groups = RNA_boolean_get(op->ptr, "export_vertex_groups");
 +  const bool export_face_maps = RNA_boolean_get(op->ptr, "export_face_maps");
    const bool export_uvmaps = RNA_boolean_get(op->ptr, "export_uvmaps");
    const bool export_normals = RNA_boolean_get(op->ptr, "export_normals");
 +  const bool export_transforms = RNA_boolean_get(op->ptr, "export_transforms");
    const bool export_materials = RNA_boolean_get(op->ptr, "export_materials");
 +  const bool export_meshes = RNA_boolean_get(op->ptr, "export_meshes");
 +  const bool export_lights = RNA_boolean_get(op->ptr, "export_lights");
 +  const bool export_cameras = RNA_boolean_get(op->ptr, "export_cameras");
 +  const bool export_curves = RNA_boolean_get(op->ptr, "export_curves");
 +  const bool export_particles = RNA_boolean_get(op->ptr, "export_particles");
    const bool use_instancing = RNA_boolean_get(op->ptr, "use_instancing");
    const bool evaluation_mode = RNA_enum_get(op->ptr, "evaluation_mode");
 +  const bool generate_preview_surface = RNA_boolean_get(op->ptr, "generate_preview_surface");
 +  const bool convert_uv_to_st = RNA_boolean_get(op->ptr, "convert_uv_to_st");
 +  const bool convert_orientation = RNA_boolean_get(op->ptr, "convert_orientation");
 +  const bool export_child_particles = RNA_boolean_get(op->ptr, "export_child_particles");
 +  const bool export_as_overs = RNA_boolean_get(op->ptr, "export_as_overs");
 +  const bool merge_transform_and_shape = RNA_boolean_get(op->ptr, "merge_transform_and_shape");
 +  const bool export_custom_properties = RNA_boolean_get(op->ptr, "export_custom_properties");
 +  const bool export_identity_transforms = RNA_boolean_get(op->ptr, "export_identity_transforms");
 +  const bool apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv");
 +  const bool author_blender_name = RNA_boolean_get(op->ptr, "author_blender_name");
 +  const bool vertex_data_as_face_varying = RNA_boolean_get(op->ptr, "vertex_data_as_face_varying");
 +  const float frame_step = RNA_float_get(op->ptr, "frame_step");
 +
 +  const bool override_shutter = RNA_boolean_get(op->ptr, "override_shutter");
 +  const double shutter_open = (double)RNA_float_get(op->ptr, "shutter_open");
 +  const double shutter_close = (double)RNA_float_get(op->ptr, "shutter_close");
 +
 +  // This default prim path is not sanitized. This happens in usd_capi.cc
-   char *default_prim_path = RNA_string_get_alloc(op->ptr, "default_prim_path", NULL, 0);
++  char *default_prim_path = RNA_string_get_alloc(op->ptr, "default_prim_path", NULL, 0, NULL);
 +
 +  default_prim_path = usd_ensure_prim_path(default_prim_path);
 +
-   char *root_prim_path = RNA_string_get_alloc(op->ptr, "root_prim_path", NULL, 0);
++  char *root_prim_path = RNA_string_get_alloc(op->ptr, "root_prim_path", NULL, 0, NULL);
 +
 +  // Do not allow / path
 +  if (root_prim_path[0] == '/' && strlen(root_prim_path) == 1)
 +    root_prim_path[0] = '\0';
 +
 +  root_prim_path = usd_ensure_prim_path(root_prim_path);
 +
-   char *material_prim_path = RNA_string_get_alloc(op->ptr, "material_prim_path", NULL, 0);
++  char *material_prim_path = RNA_string_get_alloc(op->ptr, "material_prim_path", NULL, 0, NULL);
 +
 +  int global_forward = RNA_enum_get(op->ptr, "export_global_forward_selection");
 +  int global_up = RNA_enum_get(op->ptr, "export_global_up_selection");
 +
 +  bool export_textures = RNA_boolean_get(op->ptr, "export_textures");
  
 -  struct USDExportParams params = {
 -      export_animation,
 -      export_hair,
 -      export_uvmaps,
 -      export_normals,
 -      export_materials,
 -      selected_objects_only,
 -      visible_objects_only,
 -      use_instancing,
 -      evaluation_mode,
 -  };
 +  bool relative_texture_paths = RNA_boolean_get(op->ptr, "relative_texture_paths");
 +
 +  const bool backward_compatible = true;
 +
 +  const float light_intensity_scale = RNA_float_get(op->ptr, "light_intensity_scale");
 +
 +  const bool generate_mdl = USD_umm_module_loaded() ? RNA_boolean_get(op->ptr, "generate_mdl") :
 +                                                      false;
 +
 +  const bool convert_to_cm = RNA_boolean_get(op->ptr, "convert_to_cm");
 +
 +  const bool convert_light_to_nits = RNA_boolean_get(op->ptr, "convert_light_to_nits");
 +
 +  const bool scale_light_radius = RNA_boolean_get(op->ptr, "scale_light_radius");
 +
 +  const bool convert_world_material = RNA_boolean_get(op->ptr, "convert_world_material");
 +
 +  const bool generate_cycles_shaders = RNA_boolean_get(op->ptr, "generate_cycles_shaders");
 +
 +  const bool export_armatures = RNA_boolean_get(op->ptr, "export_armatures");
 +
 +  const eUSDXformOpMode xform_op_mode = RNA_enum_get(op->ptr, "xform_op_mode");
 +
 +  struct USDExportParams params = {RNA_int_get(op->ptr, "start"),
 +                                   RNA_int_get(op->ptr, "end"),
 +                                   export_animation,
 +                                   export_hair,
 +                                   export_vertices,
 +                                   export_vertex_colors,
 +                                   export_vertex_groups,
 +                                   export_face_maps,
 +                                   export_uvmaps,
 +                                   export_normals,
 +                                   export_transforms,
 +                                   export_materials,
 +                                   export_meshes,
 +                                   export_lights,
 +                                   export_cameras,
 +                                   export_curves,
 +                                   export_particles,
 +                                   selected_objects_only,
 +                                   visible_objects_only,
 +                                   use_instancing,
 +                                   evaluation_mode,
 +                                   default_prim_path,
 +                                   root_prim_path,
 +                                   material_prim_path,
 +                                   generate_preview_surface,
 +                                   convert_uv_to_st,
 +                                   convert_orientation,
 +                                   global_forward,
 +                                   global_up,
 +                                   export_child_particles,
 +                                   export_as_overs,
 +                                   merge_transform_and_shape,
 +                                   export_custom_properties,
 +                                   export_identity_transforms,
 +                                   apply_subdiv,
 +                                   author_blender_name,
 +                                   vertex_data_as_face_varying,
 +                                   frame_step,
 +                                   override_shutter,
 +                                   shutter_open,
 +                                   shutter_close,
 +                                   export_textures,
 +                                   relative_texture_paths,
 +                                   backward_compatible,
 +                                   light_intensity_scale,
 +                                   generate_mdl,
 +                                   convert_to_cm,
 +                                   convert_light_to_nits,
 +                                   scale_light_radius,
 +                                   convert_world_material,
 +                                   generate_cycles_shaders,
 +                                   export_armatures,
 +                                   xform_op_mode};
 +
 +  /* Take some defaults from the scene, if not specified explicitly. */
 +  Scene *scene = CTX_data_scene(C);
 +  if (params.frame_start == INT_MIN) {
 +    params.frame_start = SFRA;
 +  }
 +  if (params.frame_end == INT_MIN) {
 +    params.frame_end = EFRA;
 +  }
  
    bool ok = USD_export(C, filename, &params, as_background_job);
  
diff --cc source/blender/io/usd/intern/usd_capi_export.cc
index e8014fed7b2,efa31df25c1..968d95a853a
--- a/source/blender/io/usd/intern/usd_capi_export.cc
+++ b/source/blender/io/usd/intern/usd_capi_export.cc
@@@ -177,26 -100,10 +177,26 @@@ static void export_startjob(void *custo
      return;
    }
  
 -  usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, pxr::VtValue(pxr::UsdGeomTokens->z));
 -  usd_stage->SetMetadata(pxr::UsdGeomTokens->metersPerUnit,
 -                         static_cast<double>(scene->unit.scale_length));
 +  if (data->params.export_lights && !data->params.selected_objects_only &&
 +      data->params.convert_world_material) {
 +    world_material_to_dome_light(data->params, scene, usd_stage);
 +  }
 +
 +  // Define material prim path as a scope
 +  if (data->params.export_materials)
 +    blender::io::usd::usd_define_or_over<pxr::UsdGeomScope>(
 +        usd_stage, pxr::SdfPath(data->params.material_prim_path), data->params.export_as_overs);
 +
 +  pxr::VtValue upAxis = pxr::VtValue(pxr::UsdGeomTokens->z);
 +  if (data->params.convert_orientation) {
 +    if (data->params.up_axis == USD_GLOBAL_UP_X)
 +      upAxis = pxr::VtValue(pxr::UsdGeomTokens->x);
 +    else if (data->params.up_axis == USD_GLOBAL_UP_Y)
 +      upAxis = pxr::VtValue(pxr::UsdGeomTokens->y);
 +  }
 +
 +  usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, upAxis);
-   usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender ") +
+   usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender v") +
       

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list