Difference between revisions of "IC Python API:Table View"
From Reallusion Wiki!
Chuck (RL) (Talk | contribs) m |
Chuck (RL) (Talk | contribs) m |
||
Line 2: | Line 2: | ||
{{Parent|IC_Python_API:RL_Python_Samples|RL Python Samples}} | {{Parent|IC_Python_API:RL_Python_Samples|RL Python Samples}} | ||
− | [[File:Ic_python_api_lights_table_01.png]] The QT table widget is a useful UI widget suitable for listing distinct non-hierarchical entities that share common set of attributes. Imagine if you were to list the different brands of luxury hand-bags. You would need a column to list the names of each bag such as "Jackie", "Leather Serpenti Forever", "Monogram Canvas", etc. You would likely also have a column to list the brand name that the bags belong to such as "Gucci", "Bulgari", "Coach", "Louis Vuitton", etc. You might even add other columns for pricing, color, type, etc. | + | [[File:Ic_python_api_lights_table_01.png |left]] The QT table widget is a useful UI widget suitable for listing distinct non-hierarchical entities that share common set of attributes. Imagine if you were to list the different brands of luxury hand-bags. You would need a column to list the names of each bag such as "Jackie", "Leather Serpenti Forever", "Monogram Canvas", etc. You would likely also have a column to list the brand name that the bags belong to such as "Gucci", "Bulgari", "Coach", "Louis Vuitton", etc. You might even add other columns for pricing, color, type, etc. Likewise, many digital assets can be categorized in this fashion as well. |
+ | |||
+ | {{Notice|If your assets are part of a hierarchical structure, then a QT tree widget would be more suitable}} | ||
+ | |||
+ | This article will go over the creation of a table widget for listing all the standard lights in the scene; their name, active state, multiplier, and color attributes. To top it off, we will add a refresh button to the window to update the light list to the current state of the scene. | ||
+ | |||
+ | {{clear}} | ||
== Necessary Modules == | == Necessary Modules == | ||
Line 15: | Line 21: | ||
== Light Table Widget == | == Light Table Widget == | ||
+ | |||
+ | |||
=== Refresh Function === | === Refresh Function === |
Revision as of 21:46, 15 December 2019
- Main article: RL Python Samples.
- ⚠ If your assets are part of a hierarchical structure, then a QT tree widget would be more suitable
This article will go over the creation of a table widget for listing all the standard lights in the scene; their name, active state, multiplier, and color attributes. To top it off, we will add a refresh button to the window to update the light list to the current state of the scene.
Necessary Modules
Besides the fundamental Reallusion Python module, we'll also need Pyside2 to build the user interface. But we don't need the entire Pyside2 module for this simple example, so I'll just import QtWidgets for building the user interface and wrapInstance to bind the iClone dialog window to the Pyside2 interface.
import RLPy
from PySide2 import QtWidgets
from PySide2.shiboken2 import wrapInstance