Isotropix Forums

create layer3d base on selected image

Clarisse Scripting related topics

create layer3d base on selected image

Unread postby anhungxadieu » Sat Nov 22, 2014 6:15 pm

hi there,

how can i create a layer by selected image?
thanks for the help,
anhungxadieu
 
Posts: 4
Joined: Tue Aug 12, 2014 10:21 am

Re: create layer3d base on selected image

Unread postby support_team » Sun Nov 23, 2014 7:13 pm

Hi,

As you're posting on the scripting section of the forum, I suppose you would like to add a layer to the selected image using Python scripting. Am I correct?
Isotropix
Support Team
User avatar
support_team
 
Posts: 1024
Joined: Thu Jan 31, 2013 11:10 am

Re: create layer3d base on selected image

Unread postby anhungxadieu » Mon Nov 24, 2014 9:04 am

year exactly!
sorry for my poor question ;) , and one more question how can i list all object in a context, or filter them by type?
thank you,
anhungxadieu
 
Posts: 4
Joined: Tue Aug 12, 2014 10:21 am

Re: create layer3d base on selected image

Unread postby support_team » Mon Nov 24, 2014 5:09 pm

Hi,

Which version of Clarisse iFX are you using?

Thanks
Isotropix
Support Team
User avatar
support_team
 
Posts: 1024
Joined: Thu Jan 31, 2013 11:10 am

Re: create layer3d base on selected image

Unread postby anhungxadieu » Mon Nov 24, 2014 6:58 pm

hi,

i use v1.6SP5 ple

thanks
anhungxadieu
 
Posts: 4
Joined: Tue Aug 12, 2014 10:21 am

Re: create layer3d base on selected image

Unread postby support_team » Tue Nov 25, 2014 5:19 pm

Hi,

This is one way to create a Layer 3d in your selected image:

python code

selection = ix.application.get_selection()
for i in range(selection.get_count()):
obj = selection.get_item(i)
if obj.is_kindof("Image"):
layer = obj.get_module().add_layer("Layer3d", "new_layer")


Please note that there is a restriction in PLE on how many items you can access using script at the same time, and your selection cannot contain more than 10 items for this example to work.
Isotropix
Support Team
User avatar
support_team
 
Posts: 1024
Joined: Thu Jan 31, 2013 11:10 am

Re: create layer3d base on selected image

Unread postby support_team » Tue Nov 25, 2014 5:35 pm

If you want to retrieve items in a context you can use:

python code

ctx = ix.get_item("project://scene/context")
items = ix.api.OfItemVector()
ctx.get_all_items(items)
for i in range(items.get_count()):
it = items[i]
print it.get_name()


But again, you will be able to retrieve only the first 10 items due to PLE restriction :)
Isotropix
Support Team
User avatar
support_team
 
Posts: 1024
Joined: Thu Jan 31, 2013 11:10 am

Re: create layer3d base on selected image

Unread postby anhungxadieu » Tue Dec 09, 2014 9:49 am

hi thanks U!

so where i can find info about "ix.api"?
i have a context already have all my camera inside, how can i create a image have separate 3d layer that have a camera inside the context apply to that?
i do like this but it is a module layer so i can not apply my cam to it :(
Code: Select all
img = ix.create_object("thuy","Image")

for i in range(ix.selection.get_count()):
    item = ix.selection[i]
    itemname = ix.selection[i].get_name()
    layer = img.get_module().add_layer("Layer3d",itemname)
    print layer
anhungxadieu
 
Posts: 4
Joined: Tue Aug 12, 2014 10:21 am


Return to Scripting
cron