resources_test.py#
resources_test.py
Resources management
1# This example demostrates the resources management in 3DCoat
2# See the coat.resource class for the full list of functions
3import coat
4
5#show the console (if hidden)
7
8# list all resources types like Alphas, Strips, ...
10print("The list of all resources types:\n", res)
11
12# for each resource type:
13for r in res:
14 # create the resource object by it's name
15 current = coat.resource(r)
16 # get the list of foldes
17 folders = current.listFolders()
18 # get the list of supported extensions
19 exts = current.supportedExtensions()
20 print("\n", r,":", exts)
21 print(folders)
22 # current folder and current item (if availabble)
24 # print the list of all items in current folder of this resource
25 items = current.listCurrentFolderItems()
26 for i in items:
27 print("\t\t",i)
28
29# example of getting Alphas
31
32# we remove folder
33alphas.removeFolder("TestAlphas")
34
35# add new folder and switch there
37
38# add item to the new folder
40
41# the new item becomes current:
1 # This example demostrates the resources management in 3DCoat
2 # See the coat.resource class for the full list of functions
3 import coat
4
5 #show the console (if hidden)
6 coat.io.showPythonConsole()
7
8 # list all resources types like Alphas, Strips, ...
9 res = coat.resource.listAllResourcesTypes()
10 print("The list of all resources types:\n", res)
11
12 # for each resource type:
13 for r in res:
14 # create the resource object by it's name
15 current = coat.resource(r)
16 # get the list of foldes
17 folders = current.listFolders()
18 # get the list of supported extensions
19 exts = current.supportedExtensions()
20 print("\n", r,":", exts)
21 print(folders)
22 # current folder and current item (if availabble)
23 print("\tcurrent folder:", current.currentFolder(), "current item:", current.getCurrentItem())
24 # print the list of all items in current folder of this resource
25 items = current.listCurrentFolderItems()
26 for i in items:
27 print("\t\t",i)
28
29 # example of getting Alphas
30 alphas = coat.resource("Alphas")
31
32 # we remove folder
33 alphas.removeFolder("TestAlphas")
34
35 # add new folder and switch there
36 alphas.createFolder("TestAlphas")
37
38 # add item to the new folder
39 alphas.addItem('data/textures/arrow_up.png')
40
41 # the new item becomes current:
42 print("Current alpha:", alphas.getCurrentItem(), "in folder",alphas.currentFolder())