Image
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************

ScriptName = "SZ_AddKeyframe_Settings"

-- **************************************************
-- General information about this script
-- **************************************************

SZ_AddKeyframe_Settings = {}

function SZ_AddKeyframe_Settings:Name()
    return "SZ_AddKeyframe_Settings"
end

function SZ_AddKeyframe_Settings:Version()
    return "1.2"
end

function SZ_AddKeyframe_Settings:Description()
    return self:Localize("description")
end

function SZ_AddKeyframe_Settings:Creator()
    return "Stan from 2danimator.ru"
end

function SZ_AddKeyframe_Settings:UILabel()
    return self:Localize("uiLabel")
end

function SZ_AddKeyframe_Settings:OnMouseDown(moho, mouseEvent)
    
end

-- **************************************************
-- Recurring values
-- **************************************************
SZ_AddKeyframe_Settings.keyBones = true
SZ_AddKeyframe_Settings.keyPoints = true
SZ_AddKeyframe_Settings.keyWidth = false
SZ_AddKeyframe_Settings.keyCurvature = false
SZ_AddKeyframe_Settings.keyLayer = false
SZ_AddKeyframe_Settings.keyRotation = false

-- **************************************************
-- The guts of this script
-- **************************************************

function SZ_AddKeyframe_Settings:IsEnabled(moho)
    return true
end

function SZ_AddKeyframe_Settings:IsRelevant(moho)
    return true
end


-- **************************************************
-- Tool options - create and respond to tool's UI
-- **************************************************
SZ_AddKeyframe_Settings.BONES = MOHO.MSG_BASE
SZ_AddKeyframe_Settings.POINTS = MOHO.MSG_BASE+1
SZ_AddKeyframe_Settings.WIDTH = MOHO.MSG_BASE+2
SZ_AddKeyframe_Settings.CURVATURE = MOHO.MSG_BASE+3
SZ_AddKeyframe_Settings.LAYER = MOHO.MSG_BASE+4
SZ_AddKeyframe_Settings.ROTATION = MOHO.MSG_BASE+5


function SZ_AddKeyframe_Settings:DoLayout(moho, layout)
    layout:AddChild(LM.GUI.StaticText(self:Localize("keyThese")))
    
    self.keyBonesCB = LM.GUI.CheckBox(self:Localize("bones"), self.BONES)
    layout:AddChild(self.keyBonesCB)
    
    self.keyPointsCB = LM.GUI.CheckBox(self:Localize("points"), self.POINTS)
    layout:AddChild(self.keyPointsCB)
    
    self.keyWidthCB = LM.GUI.CheckBox(self:Localize("lineWidth"), self.WIDTH)
    layout:AddChild(self.keyWidthCB)
    
    self.keyCurvatureCB = LM.GUI.CheckBox(self:Localize("curvature"), self.CURVATURE)
    layout:AddChild(self.keyCurvatureCB)
    
    self.keyLayerCB = LM.GUI.CheckBox(self:Localize("layerTransform"), self.LAYER)
    layout:AddChild(self.keyLayerCB)
    
    self.keyRotationCB = LM.GUI.CheckBox(self:Localize("layerRotationXY"), self.ROTATION)
    layout:AddChild(self.keyRotationCB)
    
    
end

function SZ_AddKeyframe_Settings:UpdateWidgets(moho)
    self.keyBonesCB:SetValue(self.keyBones)
    self.keyPointsCB:SetValue(self.keyPoints)
    self.keyWidthCB:SetValue(self.keyWidth)
    self.keyCurvatureCB:SetValue(self.keyCurvature)
    self.keyLayerCB:SetValue(self.keyLayer)
    self.keyRotationCB:SetValue(self.keyRotation)
end

function SZ_AddKeyframe_Settings:HandleMessage(moho, view, msg)
    if msg==self.BONES then
        self.keyBones = self.keyBonesCB:Value()
    elseif msg==self.POINTS then
        self.keyPoints = self.keyPointsCB:Value()
    elseif msg==self.WIDTH then
        self.keyWidth = self.keyWidthCB:Value()
    elseif msg==self.CURVATURE then
        self.keyCurvature = self.keyCurvatureCB:Value()
    elseif msg==self.LAYER then
        self.keyLayer = self.keyLayerCB:Value()
    elseif msg==self.ROTATION then
        self.keyRotation = self.keyRotationCB:Value()
    end
end


function SZ_AddKeyframe_Settings:Localize(text)
    local phrase = {}
    
    phrase['description'] = "Settings for the Add Keyframe button"
    phrase['uiLabel'] = "Add Keyframe Settings"
    phrase['keyThese'] = "Key these channels: "
    phrase['bones'] = "Bones"
    phrase['points'] = "Points"
    phrase['lineWidth'] = "Line width"
    phrase['curvature'] = "Curvature"
    phrase['layerTransform'] = "Layer transformation"
    phrase['layerRotationXY'] = "Layer rotation XY"
    
    local fileWord = MOHO.Localize("/Menus/File/File=File")
    if fileWord == "Файл" then
        phrase['description'] = "Инструмент хранит настройки для инструмента Пробивка Ключей"
        phrase['uiLabel'] = "Настройки инструмента Пробивка Ключей"
        phrase['keyThese'] = "Пробивать каналы: "
        phrase['bones'] = "Кости"
        phrase['points'] = "Точки"
        phrase['lineWidth'] = "Ширина контура"
        phrase['curvature'] = "Кривизна"
        phrase['layerTransform'] = "Трансформация слоя"
        phrase['layerRotationXY'] = "Вращение слоя по осям XY"
    end

    return phrase[text]
end


Icon
Add Keyframe Settings
Unlisted

Author: Stan View Script
Script type: Tool

Uploaded: Sep 21 2020, 22:21

Settings for the SZ Add Keyframe button
This tool holds the settings for the Add Keyframe tool and defines what channels are need to be keyframed when user presses the button.
This script, and all other scripts on this site are distributed as free software under the GNU General Public License 3.0 or later.
Downloads count: 868