[Bf-blender-cvs] [9374a3dbf08] universal-scene-description: Merge branch 'master' into universal-scene-description

Michael Kowalski noreply at git.blender.org
Sun Jul 17 18:59:24 CEST 2022


Commit: 9374a3dbf08d47786bcf9f2dbbd2d7bf166665d5
Author: Michael Kowalski
Date:   Sun Jul 17 12:23:26 2022 -0400
Branches: universal-scene-description
https://developer.blender.org/rB9374a3dbf08d47786bcf9f2dbbd2d7bf166665d5

Merge branch 'master' into universal-scene-description

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



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

diff --cc source/blender/editors/io/io_usd.c
index deab62e0000,a59cdf60243..defcdba3a39
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@@ -58,79 -57,17 +58,79 @@@ const EnumPropertyItem rna_enum_usd_exp
      {0, NULL, 0, NULL, NULL},
  };
  
 +const EnumPropertyItem rna_enum_usd_import_shaders_mode_items[] = {
 +    {USD_IMPORT_SHADERS_NONE, "NONE", 0, "None", "Don't import USD shaders"},
 +    {USD_IMPORT_USD_PREVIEW_SURFACE,
 +     "USD_PREVIEW_SURFACE",
 +     0,
 +     "USD Preview Surface",
 +     "Convert USD Preview Surface shaders to Blender Principled BSDF"},
 +    {USD_IMPORT_MDL,
 +     "USD MDL",
 +     0,
 +     "MDL",
 +     "Convert MDL shaders to Blender materials; if no MDL shaders "
 +     "exist on the material, log a warning and import existing USD "
 +     "Preview Surface shaders instead"},
 +    {0, NULL, 0, NULL, NULL},
 +};
 +
 +const EnumPropertyItem rna_enum_usd_import_shaders_mode_items_no_umm[] = {
 +    {USD_IMPORT_SHADERS_NONE, "NONE", 0, "None", "Don't import USD shaders"},
 +    {USD_IMPORT_USD_PREVIEW_SURFACE,
 +     "USD_PREVIEW_SURFACE",
 +     0,
 +     "USD Preview Surface",
 +     "Convert USD Preview Surface shaders to Blender Principled BSDF"},
 +    {0, NULL, 0, NULL, NULL},
 +};
 +
 +const EnumPropertyItem rna_enum_usd_xform_op_mode_items[] = {
 +    {USD_XFORM_OP_SRT,
 +     "SRT",
 +     0,
 +     "Scale, Rotate, Translate",
 +     "Export scale, rotate, and translate Xform operators"},
 +    {USD_XFORM_OP_SOT,
 +     "SOT",
 +     0,
 +     "Scale, Orient, Translate",
 +     "Export scale, orient, and translate Xform operators"},
 +    {USD_XFORM_OP_MAT, "MAT", 0, "Matrix", "Export matrix operator"},
 +    {0, NULL, 0, NULL, NULL},
 +};
 +
 +const EnumPropertyItem prop_usd_export_global_forward[] = {
 +    {USD_GLOBAL_FORWARD_X, "X", 0, "X Forward", "Global Forward is positive X Axis"},
 +    {USD_GLOBAL_FORWARD_Y, "Y", 0, "Y Forward", "Global Forward is positive Y Axis"},
 +    {USD_GLOBAL_FORWARD_Z, "Z", 0, "Z Forward", "Global Forward is positive Z Axis"},
 +    {USD_GLOBAL_FORWARD_MINUS_X, "-X", 0, "-X Forward", "Global Forward is negative X Axis"},
 +    {USD_GLOBAL_FORWARD_MINUS_Y, "-Y", 0, "-Y Forward", "Global Forward is negative Y Axis"},
 +    {USD_GLOBAL_FORWARD_MINUS_Z, "-Z", 0, "-Z Forward", "Global Forward is negative Z Axis"},
 +    {0, NULL, 0, NULL, NULL},
 +};
 +
 +const EnumPropertyItem prop_usd_export_global_up[] = {
 +    {USD_GLOBAL_UP_X, "X", 0, "X Up", "Global UP is positive X Axis"},
 +    {USD_GLOBAL_UP_Y, "Y", 0, "Y Up", "Global UP is positive Y Axis"},
 +    {USD_GLOBAL_UP_Z, "Z", 0, "Z Up", "Global UP is positive Z Axis"},
 +    {USD_GLOBAL_UP_MINUS_X, "-X", 0, "-X Up", "Global UP is negative X Axis"},
 +    {USD_GLOBAL_UP_MINUS_Y, "-Y", 0, "-Y Up", "Global UP is negative Y Axis"},
 +    {USD_GLOBAL_UP_MINUS_Z, "-Z", 0, "-Z Up", "Global UP is negative Z Axis"},
 +    {0, NULL, 0, NULL, NULL},
 +};
 +
  const EnumPropertyItem rna_enum_usd_mtl_name_collision_mode_items[] = {
-     {USD_MTL_NAME_COLLISION_MODIFY,
-      "MODIFY",
+     {USD_MTL_NAME_COLLISION_MAKE_UNIQUE,
+      "MAKE_UNIQUE",
       0,
-      "Modify",
-      "Create a unique name for the imported material"},
-     {USD_MTL_NAME_COLLISION_SKIP,
-      "SKIP",
+      "Make Unique",
+      "Import each USD material as a unique Blender material"},
+     {USD_MTL_NAME_COLLISION_REFERENCE_EXISTING,
+      "REFERENCE_EXISTING",
       0,
-      "Skip",
-      "Keep the existing material and discard the imported material"},
+      "Reference Existing",
+      "If a material with the same name already exists, reference that instead of importing"},
      {0, NULL, 0, NULL, NULL},
  };
  
@@@ -219,296 -123,101 +219,316 @@@ 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 export_textures = RNA_boolean_get(op->ptr, "export_textures");
 +  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 add_properties_namespace = RNA_boolean_get(op->ptr, "add_properties_namespace");
 +  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, 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, 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, NULL);
 +
 +  material_prim_path = usd_ensure_prim_path(material_prim_path);
 +
 +  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");
 +
-   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");
 +
 +  const bool fix_skel_root = RNA_boolean_get(op->ptr, "fix_skel_root");
 +  
    const bool overwrite_textures = RNA_boolean_get(op->ptr, "overwrite_textures");
 +
+   const bool relative_paths = RNA_boolean_get(op->ptr, "relative_paths");
+ 
 -  struct USDExportParams params = {
 -      export_animation,
 -      export_hair,
 -      export_uvmaps,
 -      export_normals,
 -      export_materials,
 -      selected_objects_only,
 -      visible_objects_only,
 -      use_instancing,
 -      evaluation_mode,
 -      generate_preview_surface,
 -      export_textures,
 -      overwrite_textures,
 -      relative_paths,
 -  };
 +  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,
 +                               

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list