mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
Added select_loader_color action
This commit is contained in:
parent
af734f9c56
commit
a43d0f06b5
1 changed files with 35 additions and 0 deletions
35
colorbleed/plugins/fusion/inventory/select_loader_color.py
Normal file
35
colorbleed/plugins/fusion/inventory/select_loader_color.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
from avalon import api
|
||||
from avalon.vendor.Qt import QtGui, QtWidgets
|
||||
|
||||
import avalon.fusion
|
||||
|
||||
|
||||
class FusionSelectLoaderColor(api.InventoryAction):
|
||||
|
||||
label = "Select Loader Color"
|
||||
icon = "plus"
|
||||
color = "#d8d8d8"
|
||||
|
||||
def process(self, containers):
|
||||
|
||||
comp = avalon.fusion.get_current_comp()
|
||||
|
||||
# Get color of selected container
|
||||
_tool = containers[0]["_tool"]
|
||||
table = _tool.TileColor
|
||||
if table:
|
||||
color = QtGui.QColor.fromRgbF(table["R"], table["G"], table["B"])
|
||||
else:
|
||||
color = QtGui.QColor.fromRgbF(0.0, 0.0, 0.0)
|
||||
|
||||
# Launch pick color
|
||||
picked_color = QtWidgets.QColorDialog().getColor(color)
|
||||
with avalon.fusion.comp_lock_and_undo_chunk(comp):
|
||||
for container in containers:
|
||||
# Convert color to 0-1 floats
|
||||
rgb_f = picked_color.getRgbF()
|
||||
rgb_f_table = {"R": rgb_f[0], "G": rgb_f[1], "B": rgb_f[2]}
|
||||
|
||||
# Update tool
|
||||
tool = container["_tool"]
|
||||
tool.TileColor = rgb_f_table
|
||||
Loading…
Add table
Add a link
Reference in a new issue