3DCoat Python API
The 3DCoat Python API documentation.
Loading...
Searching...
No Matches
resources_test.py

Resources management.

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)
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
30alphas = coat.resource("Alphas")
31
32# we remove folder
33alphas.removeFolder("TestAlphas")
34
35# add new folder and switch there
36alphas.createFolder("TestAlphas")
37
38# add item to the new folder
39alphas.addItem('data/textures/arrow_up.png')
40
41# the new item becomes current:
42print("Current alpha:", alphas.getCurrentItem(), "in folder",alphas.currentFolder())
showPythonConsole()
Show the python console, clear it and pop up.
Definition coat.py:3786
Definition coat.py:3523
list listAllResourcesTypes()
list all available resources types
Definition coat.py:3528