1

Here is what I'm trying to do:

  1. Make a LODGroup Empty object ("fbx_type":"LodGroup").
  2. Import an asset
  3. Parent the asset to the lod group.
  4. Duplicate (important: original asset not decimated asset), and decimate asset. Parent it also.
  5. Repeat 4 until x many LODS.

Here is my code so far:

import bpy
import os.path
from os import path

main_dir="D:\Documents\Megascans Library\Downloaded\3d\rock_assembly_siuw3" model_id=main_dir.split("\")[-1].split("_")[-1]

bpy.ops.object.empty_add(type="PLAIN_AXES", radius=1, location=(0, 0, 0))

lod_group = bpy.context.active_object lod_group.name="LODGroup" lod_group["fbx_type"]="LodGroup"

print(main_dir+"\"+model_id+"_High.fbx")

if os.path.exists(main_dir+"\"+model_id+"_High.fbx"): bpy.ops.import_scene.fbx(filepath=main_dir+"\"+model_id+"_High.fbx")

My issue is that bpy.context.active_object doesn't point to the imported fbx after importing and as such I can't parent it to my LODGroup.

Ray Mairlot
  • 29,192
  • 11
  • 103
  • 125
Apoqlite
  • 111
  • 1
  • Suggest try: print (bpy.context.selected_objects[0]), related: https://blender.stackexchange.com/q/176104/31447 ... btw: How to decimate the asset? Using the decimate modifier or remesh? – brockmann Aug 22 '20 at 08:43
  • @brockmann Yes bpy.context.selected_objects[0] works! I didn't want to know the command for decimating I do know that thankfully. – Apoqlite Aug 22 '20 at 08:52

0 Answers0