From 704c1840f0f96c131b5dbc22efe26e429098c03c Mon Sep 17 00:00:00 2001 From: Ju Hee Son <juheeson@ajou.ac.kr> Date: Fri, 23 Jun 2023 00:14:56 +0900 Subject: [PATCH] Add new file --- .../2.2 data access(bpy.data)" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "2. \354\225\240\355\224\214\353\246\254\354\274\200\354\235\264\354\205\230 \353\252\250\353\223\210/2.2 data access(bpy.data)" diff --git "a/2. \354\225\240\355\224\214\353\246\254\354\274\200\354\235\264\354\205\230 \353\252\250\353\223\210/2.2 data access(bpy.data)" "b/2. \354\225\240\355\224\214\353\246\254\354\274\200\354\235\264\354\205\230 \353\252\250\353\223\210/2.2 data access(bpy.data)" new file mode 100644 index 0000000..53a6bc4 --- /dev/null +++ "b/2. \354\225\240\355\224\214\353\246\254\354\274\200\354\235\264\354\205\230 \353\252\250\353\223\210/2.2 data access(bpy.data)" @@ -0,0 +1,33 @@ +Data Access (bpy.data) +This module is used for all Blender/Python access. + +bpy.data.data +Access to Blender’s internal data + +Type +bpy.types.BlendData + +import bpy + + +# print all objects +for obj in bpy.data.objects: + print(obj.name) + + +# print all scene names in a list +print(bpy.data.scenes.keys()) + + +# remove mesh Cube +if "Cube" in bpy.data.meshes: + mesh = bpy.data.meshes["Cube"] + print("removing mesh", mesh) + bpy.data.meshes.remove(mesh) + + +# write images into a file next to the blend +import os +with open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w') as fs: + for image in bpy.data.images: + fs.write("%s %d x %d\n" % (image.filepath, image.size[0], image.size[1])) -- GitLab