To store to one of the folders in the state in which you select more than one light
What should I do?
This way to you has created a tool, not only one of the light storage,
It does not result in the desired street.
from pyfbsdk import *
#light folder create#
light = FBLight("test_light")
light_folder = FBFolder("light folder", light)
#selected lights#
for i in FBSystem().Scene.Lights:
i.Selected = True
models = FBModelList()
FBGetSelectedModels(models)
for i in models:
print i.Name
#appenf light_folder#
light_folder.Items.append(i)
print i.Name
Thank you so much for your reply!
I found out the problem, but this (bellow) is what I wanted to say.
------------------------------------------------------------------------------------------------------
How should I write a python script that makes selected nodes get stored into one folder?
Even though I thought I made the correct script, when I executed it, only one node went into the folder.
What do you think is wrong with my script?
------------------------------------------------------------------------------------------------------
The problem was that I didn't include an "indent (space)".
I just started learning python but I hope I can get better at it soon.
Thank you.
Pesimiti.
Hi,
You probably missed something with the indentation, try something like that :
from pyfbsdk import * #light folder create# lightA = FBLight("test_lightA") lightB = FBLight("test_lightB") lightC = FBLight("test_lightC") light_folder = FBFolder("light folder", lightA) #selected lights# for i in FBSystem().Scene.Lights: i.Selected = True #Create the model list models = FBModelList() FBGetSelectedModels(models) for i in models: #appenf light_folder# #If the light is not already in the folder, we add it if i not in light_folder.Items: light_folder.Items.append(i) print i.Name
I've just add an if statement to check if the light is already in folder or not to avoid a 'duplication' error message.
Keep it up !
Cheers
Thank you so much for your advice!!
The duplication error was exactly the next trouble I was having.
All my problems for this time has been solved.
Thank you again and I will keep studying!
Best regards,
Pesimiti
Can't find what you're looking for? Ask the community or share your knowledge.