Skip to content

Instantly share code, notes, and snippets.

@MaskeZen
Created January 28, 2021 20:13
Show Gist options
  • Save MaskeZen/f3b5a729100eae0ec1ddc20b36b9ec58 to your computer and use it in GitHub Desktop.
Save MaskeZen/f3b5a729100eae0ec1ddc20b36b9ec58 to your computer and use it in GitHub Desktop.
python scrypt
import bpy
# Eliminar cubo?
# bpy.ops.object.delete(use_global=False, confirm=False)
# Importar archivo COLADA (.dae)
bpy.ops.wm.collada_import(filepath="/home/maske/repo/maske/ai/AFLW_image00041.dae")
# Rotación de la imagen
bpy.ops.transform.rotate(value=-3.13098, orient_axis='Y', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
# Escalado
bpy.ops.transform.resize(value=(0.0748091, 0.0748091, 0.0748091), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
bpy.ops.transform.resize(value=(0.240406, 0.240406, 0.240406), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
bpy.ops.transform.translate(value=(0.122051, -0.0666484, -0.263056), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, cursor_transform=True, release_confirm=True)
bpy.ops.transform.translate(value=(0.916612, 0.646237, -0.258008), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, cursor_transform=True, release_confirm=True)
bpy.ops.transform.rotate(value=0.239605, orient_axis='Z', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
bpy.ops.transform.translate(value=(0, 0, 2.83361), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
bpy.ops.transform.translate(value=(0, 0.736373, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
bpy.ops.transform.translate(value=(3.77738, 0, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
bpy.ops.transform.translate(value=(0.0896428, -0.0444574, -0.232485), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True)
# Piel
bpy.ops.material.new()
bpy.context.object.active_material_index = 0
# bpy.context.object.active_material.name = "Piel.001"
# bpy.data.materials[0].node_tree.nodes["Vertex Color"].layer_name = "shape0-lib-vcolor"
## Guardar Imagen
bpy.ops.image.save_as(save_as_render=True, copy=True, filepath="//blender_render_002.png", relative_path=True, show_multiview=False, use_multiview=False)
@sergey1513
Copy link

Hello @MaskeZen, lost for weeks, but still interested in your script. As you said before, you are working in a script to use with blender, to automate the process. I would like to know how your progress is. Is there any tutorial on how to implement your approach for the vrn network? Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment