Post #2813: : post_02815
🏷️ Tags
pie-menu custom-properties intermediate solved
⚙️ Related PME Features
- Custom Tab
- Enum Property
- OnUpdate code
- Python Scripting
- Property Editor
💬 Content
anminmakura:
I’m in trouble because I can’t get the properties of the part surrounded by the red line in the system menu.
Hi @anminmakura.
Use this code in Custom tab:
L.row(align=True).prop(C.preferences.addons['cycles'].preferences, "compute_device_type", expand=True)
anminmakura:
Is there a way to switch between displaying and hiding “only one item”?
Yes, you can use Custom tab for this. Eg:
L.row(align=True).prop(C.preferences.addons['cycles'].preferences, "compute_device_type", expand=True) if C.scene.render.engine == 'CYCLES' else None
anminmakura:
-If the property of Cycles Render Devices is None, C.scene.cycles.device = ‘CPU’
-If the property of Cycles Render Devices is CUDA or OpenCL, C.scene.cycles.device = ‘GPU’
Yes, you can create a new Enum Property in PME with these 3 items (item_id|item_label):
NONE|None
CUDA|Cuda
OPENCL|OpenCL
OnUpdate code:
C.preferences.addons['cycles'].preferences.compute_device_type = props(menu); C.scene.cycles.device = 'CPU' if props(menu) == 'NONE' else 'GPU'
menu - name of the current PME property
props(menu) - returns value of PME property by its name
Here is an example of this enum property. Download and import json file.
❤️ 2 likes