Community Forum Supporto Utenti Supporto Installazione, interfaccia e comandi, varie usare blender da riga di comando e modificatori

Stai visualizzando 1 post (di 1 totali)
  • Autore
    Post
  • #22891
    ramarromarrone
    Membro
    @ramarromarrone

    ciao raga, vi chiedo se è tanto strano utilizzare blender via riga di comando oppure è una cosa più diffusa di quello che sembra, perchè cercando su google si trovano pochi esempi…. Pertanto vi chiedo se potete darmi una mano sul mio quesito. Ho la necessità  di ridurre la qualità  di un .obj in modo tale da creare una anteprima più “leggera” dell’originale.

     

     

    Sono arrivata fino a questo punto.

     

    Questo è l’output da riga di comando:

     

     

    C:WindowsSystem32>J:Programmiblender-2.75a-windows32blender.exe --background --python J:p.py
    found bundled python: J:Programmiblender-2.75a-windows322.75python
    
    
    importing obj 'J:\model.obj'
            parsing obj file...
    0.3311 sec
            loading materials and images...
    0.0010 sec
            building geometry...
            verts:5008 faces:10000 materials: 0 smoothgroups:1 ...
    WARNING! Getting invalid NULL loop space for loop 26638!
    WARNING! Getting invalid NULL loop space for loop 26640!
    WARNING! Getting invalid NULL loop space for loop 26646!
    WARNING! Getting invalid NULL loop space for loop 26653!
    WARNING! Getting invalid NULL loop space for loop 26662!
    WARNING! Getting invalid NULL loop space for loop 26664!
    WARNING! Still getting invalid NULL loop space in second loop for loop 26638!
    WARNING! Still getting invalid NULL loop space in second loop for loop 26640!
    WARNING! Still getting invalid NULL loop space in second loop for loop 26646!
    WARNING! Still getting invalid NULL loop space in second loop for loop 26653!
    WARNING! Still getting invalid NULL loop space in second loop for loop 26662!
    WARNING! Still getting invalid NULL loop space in second loop for loop 26664!
    finished importing: b'J:\model.obj' in 0.7305 sec.
    
    
    Blender quit
    

     

     

    Questo è il codice python:

     

     

    import os
    import bpy
    
    full_path_to_directory = os.path.join('J:\')
    
    # get list of all files in directory
    file_list = os.listdir(full_path_to_directory)
    
    # reduce the list to files ending in 'obj'
    # using 'list comprehensions'
    obj_list = [item for item in file_list if item[-3:] == 'obj']
    
    # loop through the strings in obj_list.
    for item in obj_list:
        full_path_to_file = os.path.join(full_path_to_directory, item)
        bpy.ops.import_scene.obj(filepath=full_path_to_file)
        
    mod = bpy.data.objects[1].modifiers.new(name='decimate', type='DECIMATE')
    mod.ratio = 0.5
    

     

    E’ corretto fin qui?

     

    Vorrei che l’operazione sia eseguita in batch per tutti gli .obj contenuti in una cartella.

     

    Come faccio poi per esportare il modello in .obj decimato?

     

     

    GRAZIEEEEE!!!

     

     

     

     

     

     

     

     

Stai visualizzando 1 post (di 1 totali)
  • Devi essere connesso per rispondere a questo topic.