Hi,
I have another problem, this time with UI.
I'm making my own tool bar panel with single command button.
The problem is that when I set isPromoted value to True button appears in the Panel but it's empty. No icon, no tool tip, no action assigned to it. Just empty placeholder.
When I disable isPromoted then command button is availabe when I click on small arrow and it works as expected.
Is there any way to fix this and have button displayed in the panel?
buttonTheaExport = cmdDefs.addButtonDefinition('TheaExportDefIdPython', 'Export to Thea', 'Export to Thea', './/Resources//theaExport') # Connect the command created event. TheaExportCommandCreated = TheaExportCommandCreatedEventHandler() buttonTheaExport.commandCreated.add(TheaExportCommandCreated) handlers.append(TheaExportCommandCreated) # Create new panel theaPanel = ui.toolbarPanels.add('theaPanelId', 'Thea Render') exportControl = theaPanel.controls.addCommand(buttonTheaExport, 'TheaExportCmdDefControl') exportControl.isPromoted = True exportControl.isPromotedByDefault = True
Solved! Go to Solution.
Hi,
I have another problem, this time with UI.
I'm making my own tool bar panel with single command button.
The problem is that when I set isPromoted value to True button appears in the Panel but it's empty. No icon, no tool tip, no action assigned to it. Just empty placeholder.
When I disable isPromoted then command button is availabe when I click on small arrow and it works as expected.
Is there any way to fix this and have button displayed in the panel?
buttonTheaExport = cmdDefs.addButtonDefinition('TheaExportDefIdPython', 'Export to Thea', 'Export to Thea', './/Resources//theaExport') # Connect the command created event. TheaExportCommandCreated = TheaExportCommandCreatedEventHandler() buttonTheaExport.commandCreated.add(TheaExportCommandCreated) handlers.append(TheaExportCommandCreated) # Create new panel theaPanel = ui.toolbarPanels.add('theaPanelId', 'Thea Render') exportControl = theaPanel.controls.addCommand(buttonTheaExport, 'TheaExportCmdDefControl') exportControl.isPromoted = True exportControl.isPromotedByDefault = True
Solved! Go to Solution.
Solved by zhijie.li. Go to Solution.
I cannot see anything wrong with your code in the context of the snippet you shared. Can you post the entire script?
DaVeR
I cannot see anything wrong with your code in the context of the snippet you shared. Can you post the entire script?
DaVeR
Hi,
This is a known issue that the command id should be the same as the ButtonDefinition id, otherwise the promoted comand control will be blank because the command cannot be connected with the button definition in Fusion. Please try the following code:
buttonTheaExport = cmdDefs.addButtonDefinition('TheaExportDefIdPython', 'Export to Thea',
'Export to Thea',
'.//Resources//theaExport')
# Connect the command created event.
TheaExportCommandCreated = TheaExportCommandCreatedEventHandler()
buttonTheaExport.commandCreated.add(TheaExportCommandCreated)
handlers.append(TheaExportCommandCreated)
# Create new panel
theaPanel = ui.toolbarPanels.add('theaPanelId', 'Thea Render')
exportControl = theaPanel.controls.addCommand(buttonTheaExport, 'TheaExportDefIdPython') # The id of the command is changed.
exportControl.isPromoted = True
exportControl.isPromotedByDefault = True
In our comming release, the design of the API method "addCommand" is changed. And then you doesn't need to set the id when "addCommand". And the command control's id will inherit from the button definition. So in our next release, you just need to call the function like this: exportControl = theaPanel.controls.addCommand(buttonTheaExport)
Sorry for inconvenience
Best regards,
Zhijie
Hi,
This is a known issue that the command id should be the same as the ButtonDefinition id, otherwise the promoted comand control will be blank because the command cannot be connected with the button definition in Fusion. Please try the following code:
buttonTheaExport = cmdDefs.addButtonDefinition('TheaExportDefIdPython', 'Export to Thea',
'Export to Thea',
'.//Resources//theaExport')
# Connect the command created event.
TheaExportCommandCreated = TheaExportCommandCreatedEventHandler()
buttonTheaExport.commandCreated.add(TheaExportCommandCreated)
handlers.append(TheaExportCommandCreated)
# Create new panel
theaPanel = ui.toolbarPanels.add('theaPanelId', 'Thea Render')
exportControl = theaPanel.controls.addCommand(buttonTheaExport, 'TheaExportDefIdPython') # The id of the command is changed.
exportControl.isPromoted = True
exportControl.isPromotedByDefault = True
In our comming release, the design of the API method "addCommand" is changed. And then you doesn't need to set the id when "addCommand". And the command control's id will inherit from the button definition. So in our next release, you just need to call the function like this: exportControl = theaPanel.controls.addCommand(buttonTheaExport)
Sorry for inconvenience
Best regards,
Zhijie
Can't find what you're looking for? Ask the community or share your knowledge.