Hi, Mike:
Thanks for review my post. The “create_process_libraries.py” is one of the scripts that don’t show up in the context menu. The following are another two similar scripts that not appear as well…
For creating a media library with folders:
def get_media_panel_custom_ui_actions():
def scope_libraries(selection):
import flame
for item in selection:
if isinstance(item, flame.PyLibrary):
return True
return False
def create_media_library(selection):
import flame
customLibrary = flame.project.current_project.current_workspace.create_library("Media")
Footage = customLibrary.create_folder("Footage")
Footage.create_folder("Flat")
Footage.create_folder("Grade")
customLibrary.create_folder("Artwork")
customLibrary.create_folder("Stock")
customLibrary.create_folder("CGI_AFX")
customLibrary.create_folder("Audio")
return [
{
"name": "PYTHON: Libraries",
"actions": [
{
"name": "Create Media Library",
"isVisible": scope_libraries,
"execute": create_media_library
}
]
}
]
and for creating a new batch group:
def get_media_panel_custom_ui_actions():
def scope_desktop(selection):
import flame
for item in selection:
if isinstance(item, flame.PyDesktop):
return True
return False
def create_new_batch(selection):
import flame, os
schematicReels = [ 'Src', ' Pre' ] #create/name schematic reels
shelfReels = [ 'Batch Renders', 'Backup' ] #create/name shelf reels
#Create batch group with name, start_frame value, duration value, set of schematic reel names, set of shelf reel names
flame.batch.create_batch_group( '30s_SH000',
start_frame = 1,
duration = 99,
reels = schematicReels,
shelf_reels = shelfReels )
return [
{
"name": "PYTHON: DESKTOP",
"actions": [
{
"name": "Create New Batch",
"isVisible": scope_desktop,
"execute": create_new_batch
}
]
}
]
Finally, there is the code that can show up in context menu correctly:
def get_media_panel_custom_ui_actions():
def scope_libraries(selection):
import flame
for item in selection:
if isinstance(item, flame.PyLibrary):
return True
return False
def create_shared_library(selection):
import flame
import os
from PySide2 import QtWidgets
dlg = QtWidgets.QInputDialog()
dlg.setLabelText("Enter the artist name")
if dlg.exec_():
name = str(dlg.textValue())
shared = flame.project.current_project.create_shared_library(name)
shared.acquire_exclusive_access()
shared.create_folder("from_"+name)
shared.create_folder("to_"+name)
shared.release_exclusive_access()
return [
{
"name": "PYTHON: Libraries",
"actions": [
{
"name": "Create Shared Library",
"isVisible": scope_libraries,
"execute": create_shared_library
}
]
}
]
I have tried to compare and reference the “create_shared_library” script with other “disappear” ones but can’t figure what’s wrong. Need more learning and luck here >_<
Again I’m very appreciate for your input!
Best wish,
Jeff Chin