• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Creating custom Mouse Rect Attachpoint

Messages
32
Country
germany
Hey guys,

following situation: I have created a FMC model + display gauge and now want to animate the LSK buttons. The animation is already done and customly defined in my own modeldef.xml but I just can't seem to get my Mouse Rect to work to click on the LSK Button.
I use Blender 2.8 as well as the Blender2FSX/P3D plugin. The animation and the attachpoint show up in the plugin section but the Mouse Rect attachpoint does not work in the sim.

This is my code for now:

XML:
<?xml version="1.0" encoding="utf-8"?>
<ModelInfo>
    <Animation name="B737_FMCL_LSK1_anim" guid="4275280d-ecad-4de8-83b7-c89105314730" length="50" type="Sim" typeParam2="B737_FMCL_LSK1_anim" typeParam="AutoPlay"/>

    <PartInfo>
        <Name>B737_FMCL_LSK1_anim</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>(L:B737_FMCL_LSK1, bool) 50 *</Code>
                <Lag>50</Lag>
            </Parameter>
            </Animation>
    </PartInfo>

    <PartInfo>
        <Name>B737_FMCL_LSK1_rect</Name>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>LSK1</TooltipText>
                <CallbackCode>
                    (M:Event) 'LeftSingle' scmp 0 == if{ (M:X) (>L:B737_FMCL_LSK1, bool) }
                </CallbackCode>
        </MouseRect>
    </PartInfo>
</ModelInfo>

So if anyone knows how to create a custom Mouse Rect attachpoint to control a custom animation I would be very, very thankful.

Greetings,
Max
 
you need mouse flag, I blend it into single <partinfo>
try this:
XML:
    <Animation name="B737_FMCL_LSK1_anim" guid="4275280d-ecad-4de8-83b7-c89105314730" length="50" type="Sim" typeParam2="B737_FMCL_LSK1_anim" typeParam="AutoPlay"/>

    <PartInfo>
        <Name>B737_FMCL_LSK1_anim</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>(L:B737_FMCL_LSK1, bool) 50 *</Code>
                <Lag>50</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>LSK1</TooltipText>
            <MouseFlags>LeftSingle</MouseFlags>
            <CallbackCode>
                (M:Event) 'LeftSingle' scmp 0 == if{ L:B737_FMCL_LSK1, bool) ! (&gt;L:B737_FMCL_LSK1, bool) }
            </CallbackCode>
        </MouseRect>
    </PartInfo>
 
Thanks for your reply but it doesn't work unfortunately. The mouse cursor doesn't change into the clicking symbol and when I click the button it doesn't move at all.
 
OK, solved. I just noticed that MCX didn't have any ModelDef.xml code in it so I just added it there.
 
One problem I encountered again is the animation. As soon as I click on the button I have to reload the SimObject to click it again. How can I get the button to be clickable again?
 
I would not 'latch' the button as posted above, but would reset the button's L:var upon mouse button release as shown below. When the left mouse button is pressed down, the LSK1 button will likewise be pressed down. When the mouse button is released, so too will the LSK1 button:

XML:
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>LSK1</TooltipText>
            <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
            <CallbackCode>
                (M:Event) 'LeftSingle' scmp 0 == if{ 1 (&gt;L:B737_FMCL_LSK1, bool) }
                (M:Event) 'LeftRelease' scmp 0 == if{ 0 (&gt;L:B737_FMCL_LSK1, bool) }
            </CallbackCode>
        </MouseRect>
 
Back
Top