enzyme69 / blendersushi

Blender Sushi related scripts. Mostly about Sverchok, Geometry Nodes, Animation Nodes, and related Python scripts.
244 stars 33 forks source link

LIVENODING 1054 / SV Nodes to Save and to Load Weight Map Sequence #442

Open enzyme69 opened 6 years ago

enzyme69 commented 6 years ago

To Save Weight Data:

screen shot 2018-08-14 at 11 45 18 am screen shot 2018-08-14 at 11 45 55 am
enzyme69 commented 6 years ago

To Load Multiple TXT Files Into Memory: (run this once, specify the folder name)

import os
import bpy

# put the location to the folder where the objs are located here in this fashion
# this line will only work on windows ie C:\objects
path_to_obj_dir = os.path.join('/Users/jimmygunawan', 'TXTOUT')

# get list of all files in directory
file_list = sorted(os.listdir(path_to_obj_dir))

# get a list of files ending in 'obj'
obj_list = [item for item in file_list if item.endswith('.txt')]

# loop through the strings in obj_list and add the files to the scene
for item in obj_list:
    path_to_file = os.path.join(path_to_obj_dir, item)
    #bpy.ops.import_scene.obj(filepath = path_to_file)
    #print(path_to_file)
    #bpy.ops.text.open(filepath = path_to_file, internal=True)
    loaded_text_file = bpy.data.texts.load(filepath = path_to_file, internal=False)
    loaded_text_file.use_fake_user = False

print("DONE...")
enzyme69 commented 6 years ago

To Load Weight Data into another BLEND:

make sure you have loaded TXT file sequence into BLEND

screen shot 2018-08-14 at 11 40 53 am screen shot 2018-08-14 at 11 44 15 am
enzyme69 commented 6 years ago

All the Blends used: [Uploading reaction_diffusion_load_013.blend.zip…]() import_many_003.blend.zip reaction_diffusion_007_save.blend.zip