code: def kubricify(output_folder, obj=None, density=None, friction=None):
      if obj is None:
          obj = get_active_object()
      with select(obj):
          print(f"Kubricifying {obj.name}...")
          print("Applying scale and rotation transformations...")
          apply_transformations(obj)
          print("Converting and validating...")
          # first convert to trimesh just for computing center of mass
          tmesh = create_trimesh_from_obj(obj)
          # center the mesh around its center of mass (i.e. ensure center-of-mass = [0,0,0])
          center_mesh_around(obj, tmesh.center_mass)
          # re-convert to trimesh for computing the properties
          tmesh = create_trimesh_from_obj(obj)
          print("Computing properties...")
          properties = get_object_properties(
              obj, density=density, friction=friction, tmesh=tmesh
          )
  
          print(properties)
          print(json.dumps(properties, indent=4, sort_keys=True))
  
          # Export
          output_path = pathlib.Path(output_folder) / obj.name
          print(f"Exporting to {output_path}")
          output_path.mkdir(
              parents=True, exist_ok=True
          )  # ensure path exists
          urdf_path = save_urdf(output_path, properties)
          vis_path = save_visual_geometry(obj, output_path)
  
          if tmesh.is_convex():
              coll_path = save_collision_geometry(obj, output_path)
          else:
              print("Creating collision geometry...")
              cobj = create_blender_object_from_tmesh(
                  tmesh.convex_hull, name=obj.name + "_CVX"
              )
              cobj.location = obj.location
              cobj.location[2] -= tmesh.extents[2] * 1.5
              coll_path = save_collision_geometry(cobj, output_path)
  
          properties["paths"] = {
              "visual_geometry": [
                  str(vis_path.relative_to(output_path))
              ],
              "collision_geometry": [
                  str(coll_path.relative_to(output_path))
              ],
              "urdf": [str(urdf_path.relative_to(output_path))],
          }
          save_properties(output_path, properties)
          compress_object_dir(output_path, obj.name)
  
      print("tidying up...")
      shutil.rmtree(output_path)
      return properties
  
imports: import contextlib
  import copy
  import json
  import pathlib
  import tarfile
  import shutil
  import numpy
  import trimesh
  from kubric.safeimport.bpy import bpy
label_desc: Use image node_id 12 for calling a global function with example usage: kubricify(output_folder, obj, density, friction) and returns: properties