示例#1
0
    public static ChannelMenuLevel MakeRootLevelForFigure(ActorModel model)
    {
        var rootLevel = new ChannelMenuLevel(model);

        foreach (Channel channel in model.MainDefinition.ChannelSystem.Channels)
        {
            if (!channel.Visible)
            {
                continue;
            }
            if (channel.Path.StartsWith("/Joints/"))
            {
                continue;
            }

            var pathArray = channel.Path.Split('/');
            rootLevel.Add(channel, pathArray, 0);
        }

        rootLevel.Extract(new string[] { "Shapes", "People" });
        rootLevel.Extract(new string[] { "Shapes", "Full Body", "People" });
        rootLevel.Extract(new string[] { "Shapes", "Head", "People" });
        rootLevel.Extract(new string[] { "Shapes", "Shape" });

        return(rootLevel);
    }
    public static IMenuLevel MakeRootMenuLevel(Actor actor)
    {
        var model                 = actor.Model;
        var channelMenuLevel      = ChannelMenuLevel.MakeRootLevelForFigure(model);
        var poseControlsMenuLevel = channelMenuLevel.Extract(new string[] { "Pose Controls" });
        var expressionsMenuLevel  = poseControlsMenuLevel.Extract(new string[] { "Head", "Expressions" });
        var behaviorMenuLevel     = new BehaviorMenuLevel(model.Behavior);

        var charactersMenuLevel = new CharactersMenuLevel(actor.Characters, actor.Main.Definition, actor.Main.Model);

        var shapingItems           = new List <IMenuItem>();
        var channelShapesMenuLevel = channelMenuLevel.Extract(new string[] { "Shapes" });

        shapingItems.Add(new ActionMenuItem("Reset Shape", () => model.ResetShape()));
        shapingItems.AddRange(channelShapesMenuLevel.GetItems());
        var shapingMenuLevel = new StaticMenuLevel(shapingItems.ToArray());

        var animationsMenuLevel = new AnimationMenuLevel(model.Animation);

        var hairMenuLevel = MakeHairMenuLevel(actor.Hair);

        var clothingMenuLevel = ClothingMenuLevel.Make(actor);

        List <IMenuItem> items = new List <IMenuItem> {
        };

        items.Add(new SubLevelMenuItem("Characters", charactersMenuLevel));
        items.Add(new SubLevelMenuItem("Clothing", clothingMenuLevel));
        if (hairMenuLevel != null)
        {
            items.Add(new SubLevelMenuItem("Hair", hairMenuLevel));
        }
        items.Add(new SubLevelMenuItem("Shaping", shapingMenuLevel));
        items.Add(new SubLevelMenuItem("Behavior", behaviorMenuLevel));
        items.Add(new SubLevelMenuItem("Expressions", expressionsMenuLevel));
        items.Add(new SubLevelMenuItem("Posing", poseControlsMenuLevel));
        items.Add(new SubLevelMenuItem("Animations", animationsMenuLevel));
        items.Add(new ActionMenuItem("Reset Pose", () => model.ResetPose()));

        var figureMenuLevel = new StaticMenuLevel(items.ToArray());

        return(figureMenuLevel);
    }
    public static ChannelMenuLevel MakeRootLevelForFigure(ActorModel model)
    {
        var rootLevel = new ChannelMenuLevel(model);

        foreach (Channel channel in model.MainDefinition.ChannelSystem.Channels)
        {
            if (!channel.Visible)
            {
                continue;
            }
            if (channel.Path.StartsWith("/Joints/"))
            {
                continue;
            }

            var pathArray = channel.Path.Split('/');
            rootLevel.Add(channel, pathArray, 0);
        }

        return(rootLevel);
    }
示例#4
0
    private void Add(Channel channel, string[] path, int levelIdx)
    {
        while (path[levelIdx].Length == 0 || SkipCategories.Contains(path[levelIdx]))
        {
            levelIdx += 1;
        }

        string pathElem = path[levelIdx];

        if (levelIdx == path.Length - 1)
        {
            Channels[pathElem] = channel;
        }
        else
        {
            if (!SubLevels.TryGetValue(pathElem, out var subLevel))
            {
                subLevel = new ChannelMenuLevel(model);
                SubLevels.Add(pathElem, subLevel);
            }
            subLevel.Add(channel, path, levelIdx + 1);
        }
    }