Hello friends, how are you.
I am using the function: ScriptInterface:SetSelLayer(layer) to select a layer, but for example if I am in a bone layer and I select a vector layer, it does not update its corresponding tool, when I select the vector it should change to drawing tool, but it stays in the bone tool for example. Would anyone please know how to do it?
Select layer and update tool?
Moderators: Víctor Paredes, Belgarath, slowtiger
-
- Posts: 69
- Joined: Thu Jan 24, 2019 3:52 am
-
- Posts: 69
- Joined: Thu Jan 24, 2019 3:52 am
Re: Select layer and update tool?
I was going through scripts and came across this.
I have also tried everything; but I think this is the only solution?
If there is another way let me know.
This script: https://mohoscripts.com/script/sz_layer ... on_buttons
I have also tried everything; but I think this is the only solution?
If there is another way let me know.
This script: https://mohoscripts.com/script/sz_layer ... on_buttons
Code: Select all
-- These are the methods I tried, and none of them updates the tool panel:
-- moho:UpdateUI()
-- moho.view:DrawMe()
-- moho.view:RefreshView()
-- layer:UpdateCurFrame(true)
-- MOHO.Redraw()
-- moho:UpdateSelectedChannels()
-- moho:UpdateBonePointSelection()
-- That's why we have to do some dark magic here instead:
local sacrificialLayer = moho:CreateNewLayer(MOHO.LT_UNKNOWN)
moho:DeleteLayer(sacrificialLayer)
- synthsin75
- Posts: 10266
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: Select layer and update tool?
You might also try jumping to/from frame zero and back. That's another thing that reliably reevaluates the tools window.
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
-
- Posts: 69
- Joined: Thu Jan 24, 2019 3:52 am
Re: Select layer and update tool?
But it works when you use PickGlobalLayer :
Code: Select all
function Pickckckc:OnMouseUp(moho, mouseEvent)
local layer = mouseEvent.view:PickGlobalLayer(mouseEvent.pt)
if layer == nil then return end
if (layer == nil or layer == moho.layer) then
return
end
moho.document:ClearSecondarySelection()
moho:SetSelLayer(layer)
moho:ShowLayerInLayersPalette(layer)
moho:UpdateUI()
end
-
- Posts: 69
- Joined: Thu Jan 24, 2019 3:52 am
Re: Select layer and update tool?
Ah, that works well too, thankssynthsin75 wrote: ↑Thu Feb 09, 2023 12:57 am You might also try jumping to/from frame zero and back. That's another thing that reliably reevaluates the tools window.