Message 1 of 1
Active panels, or in use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am designing a script which filters in graph editor the selected attributes, but there is a problem if I have selected the attributes in channelbox and graph editor at the same time, they always end up being the filtered attributes of channelbox and I can't make the graph editor and channelbox selection coexist. For that reason I would like to detect if the last active is the channelbox or graph editor panel and then filter the selected attributes. I don't know how to do the detection of these active panels, or in use.
Thank you very much!
Here is the code, which does not take the selection of graph editor and channelbox together. Only if I use each module independently does the filtering selection of its attributes work.
global proc ApplyFilter() {
string $filter_attr = "graphEditor1Window|graphEditor1|menu36|FilterUISaveFilterMenuItem";
string $graphEditor = "graphEditor1OutlineEd";
// Obtén la selección actual en la vista 3D
string $selection[] = `ls -sl`;
if (size($selection) == 0) {
error "No objects selected in the 3D view.";
return;
}
string $channels[] = `channelBox -q -sma mainChannelBox`;
if (size($channels) > 0) {
// Si hay canales seleccionados en la Channel Box, aplica el filtro desde la Channel Box
selectionConnection -e -clr graphEditor1FromOutliner;
for ($s in $selection) {
for ($c in $channels) {
selectionConnection -e -obj ($s + "." + $c) graphEditor1FromOutliner;
}
}
// Apply the filter to the Graph Editor
filterUIFilterSelection $graphEditor $filter_attr;
} else {
// Si no hay canales seleccionados en la Channel Box, aplica el filtro desde el Graph Editor
filterUIFilterSelection $graphEditor $filter_attr;
}
}
global proc ClearFilter() {
// Clear the filter in the Graph Editor
filterUIClearFilter "graphEditor1OutlineEd";
// Clear animGraph's current selection list.
selectionConnection -e -clr graphEditor1FromOutliner;
}
global proc create_ui() {
if (`window -exists my_window`) {
deleteUI my_window;
}
// Crear la ventana sin barra de menú, botones de minimizar ni maximizar
string $window = `window -title " " -widthHeight 141 26`;
window -edit -menuBar false -minimizeButton false -maximizeButton false $window;
showWindow $window;
// ColumnLayout dentro de la nueva ventana
columnLayout -adj true;
// RowLayout para colocar los botones uno al lado del otro
rowLayout -nc 2 -cw 1 70 -cw 2 120;
button
-l "Apply Filter"
-c "ApplyFilter()"
-bgc 0.2 0.8 0.2; // Verde
button
-l "Clear Filter"
-c "ClearFilter()"
-bgc 0.8 0.2 0.2; // Rojo
setParent ..; // Volver al columnLayout
}
create_ui();