public void Initialize(LayoutOverlay layoutOverlay) { m_PastePanel = PastePanel.GenerateFromUXML(); BindElements(); layoutOverlay.rightOverlay.Add(m_PastePanel); m_PastePanel.SetHiddenFromLayout(true); }
private void AddMainUI(VisualElement mainView) { var visualTree = ResourceLoader.Load <VisualTreeAsset>("LayoutOverlay/LayoutOverlay.uxml"); VisualElement clone = visualTree.CloneTree(); m_LayoutOverlay = clone.Q <LayoutOverlay>("LayoutOverlay"); mainView.Add(m_LayoutOverlay); m_LayoutOverlay.hasScrollbar = true; m_LayoutOverlay.verticalToolbar.verticalScrollerVisibility = ScrollerVisibility.Hidden; m_LayoutOverlay.StretchToParentSize(); CreatePoseToolbar(); CreateBoneToolbar(); CreateMeshToolbar(); CreateWeightToolbar(); CreateRigToolbar(); m_ShortcutContext = new InternalEditorBridge.ShortcutContext() { isActive = isFocused, context = this }; InternalEditorBridge.RegisterShortcutContext(m_ShortcutContext); InternalEditorBridge.AddEditorApplicationProjectLoadedCallback(OnProjectLoaded); }
public override void Initialize(LayoutOverlay layout) { if (m_View == null) { m_View = SpriteBoneInfluenceWindow.CreateFromUXML(); m_Controller.OnViewCreated(); } layout.rightOverlay.Add(m_View); }
public override void Initialize(LayoutOverlay layout) { base.Initialize(layout); m_GenerateWeightsPanel = GenerateWeightsPanel.GenerateFromUXML(); layout.rightOverlay.Add(m_GenerateWeightsPanel); BindElements(); m_GenerateWeightsPanel.SetHiddenFromLayout(true); }
public override void Initialize(LayoutOverlay layout) { base.Initialize(layout); m_GenerateGeometryPanel = GenerateGeometryPanel.GenerateFromUXML(); m_GenerateGeometryPanel.skinningCache = skinningCache; layout.rightOverlay.Add(m_GenerateGeometryPanel); BindElements(); Hide(); }
public override void Initialize(LayoutOverlay layout) { if (m_View == null) { m_View = BoneReparentToolWindow.CreateFromUXML(); } m_Model = new BoneReparentToolModel(skinningCache, m_View); m_Controller = new BoneReparentToolController(m_Model, skinningCache.events); m_View.GetController = () => m_Controller; m_View.GetModel = () => m_Model; layout.rightOverlay.Add(m_View); m_View.SetHiddenFromLayout(true); }
private void CreateWeightTools(SkeletonTool skeletonTool, MeshTool meshTool, LayoutOverlay layoutOverlay) { var weightPainterTool = CreateCache <WeightPainterTool>(); weightPainterTool.Initialize(layoutOverlay); weightPainterTool.skeletonTool = skeletonTool; weightPainterTool.meshTool = meshTool; { var tool = CreateTool <SpriteBoneInfluenceTool>(); tool.Initialize(layoutOverlay); tool.skeletonTool = skeletonTool; m_ToolMap.Add(Tools.BoneInfluence, tool); } { var tool = CreateTool <BoneSpriteInfluenceTool>(); tool.Initialize(layoutOverlay); tool.skeletonTool = skeletonTool; m_ToolMap.Add(Tools.SpriteInfluence, tool); } { var tool = CreateTool <WeightPainterToolWrapper>(); tool.weightPainterTool = weightPainterTool; tool.paintMode = WeightPainterMode.Slider; tool.title = TextContent.weightSlider; tool.Initialize(layoutOverlay); m_ToolMap.Add(Tools.WeightSlider, tool); } { var tool = CreateTool <WeightPainterToolWrapper>(); tool.weightPainterTool = weightPainterTool; tool.paintMode = WeightPainterMode.Brush; tool.title = TextContent.weightBrush; tool.Initialize(layoutOverlay); m_ToolMap.Add(Tools.WeightBrush, tool); } { var tool = CreateTool <GenerateWeightsTool>(); tool.Initialize(layoutOverlay); tool.meshTool = meshTool; tool.skeletonTool = skeletonTool; m_ToolMap.Add(Tools.GenerateWeights, tool); } }
public override void Initialize(LayoutOverlay layout) { base.Initialize(layout); m_WeightPainterPanel = WeightPainterPanel.GenerateFromUXML(); m_WeightPainterPanel.SetHiddenFromLayout(true); layout.rightOverlay.Add(m_WeightPainterPanel); m_WeightPainterPanel.sliderStarted += () => { EditStart(skinningCache.vertexSelection, false); }; m_WeightPainterPanel.sliderChanged += (value) => { EditWeights(value, true); meshTool.UpdateWeights(); }; m_WeightPainterPanel.sliderEnded += () => { EditEnd(); }; m_WeightPainterPanel.bonePopupChanged += (i) => { var skeleton = skinningCache.GetEffectiveSkeleton(skinningCache.selectedSprite); if (skeleton != null) { BoneCache bone = null; if (i != -1) { bone = skeleton.GetBone(i).ToCharacterIfNeeded(); } if (bone != skinningCache.skeletonSelection.activeElement) { using (skinningCache.UndoScope(TextContent.boneSelection)) { skinningCache.skeletonSelection.activeElement = bone; InvokeBoneSelectionChanged(); } } } }; m_WeightPainterPanel.weightsChanged += () => meshTool.UpdateWeights(); }
public void CreateToolCache(ISpriteEditor spriteEditor, LayoutOverlay layoutOverlay) { var spriteEditorDataProvider = spriteEditor.GetDataProvider <ISpriteEditorDataProvider>(); var skeletonTool = CreateCache <SkeletonTool>(); var meshTool = CreateCache <MeshTool>(); skeletonTool.Initialize(layoutOverlay); meshTool.Initialize(layoutOverlay); m_ToolMap.Add(Tools.EditPose, CreateSkeletonTool <SkeletonToolWrapper>(skeletonTool, SkeletonMode.EditPose, false, layoutOverlay)); m_ToolMap.Add(Tools.EditJoints, CreateSkeletonTool <SkeletonToolWrapper>(skeletonTool, SkeletonMode.EditJoints, true, layoutOverlay)); m_ToolMap.Add(Tools.CreateBone, CreateSkeletonTool <SkeletonToolWrapper>(skeletonTool, SkeletonMode.CreateBone, true, layoutOverlay)); m_ToolMap.Add(Tools.SplitBone, CreateSkeletonTool <SkeletonToolWrapper>(skeletonTool, SkeletonMode.SplitBone, true, layoutOverlay)); m_ToolMap.Add(Tools.ReparentBone, CreateSkeletonTool <BoneReparentTool>(skeletonTool, SkeletonMode.EditPose, false, layoutOverlay)); m_ToolMap.Add(Tools.EditGeometry, CreateMeshTool <MeshToolWrapper>(skeletonTool, meshTool, SpriteMeshViewMode.EditGeometry, SkeletonMode.Disabled, layoutOverlay)); m_ToolMap.Add(Tools.CreateVertex, CreateMeshTool <MeshToolWrapper>(skeletonTool, meshTool, SpriteMeshViewMode.CreateVertex, SkeletonMode.Disabled, layoutOverlay)); m_ToolMap.Add(Tools.CreateEdge, CreateMeshTool <MeshToolWrapper>(skeletonTool, meshTool, SpriteMeshViewMode.CreateEdge, SkeletonMode.Disabled, layoutOverlay)); m_ToolMap.Add(Tools.SplitEdge, CreateMeshTool <MeshToolWrapper>(skeletonTool, meshTool, SpriteMeshViewMode.SplitEdge, SkeletonMode.Disabled, layoutOverlay)); m_ToolMap.Add(Tools.GenerateGeometry, CreateMeshTool <GenerateGeometryTool>(skeletonTool, meshTool, SpriteMeshViewMode.EditGeometry, SkeletonMode.EditPose, layoutOverlay)); var copyTool = CreateTool <CopyTool>(); copyTool.Initialize(layoutOverlay); copyTool.pixelsPerUnit = spriteEditorDataProvider.pixelsPerUnit; copyTool.skeletonTool = skeletonTool; copyTool.meshTool = meshTool; m_ToolMap.Add(Tools.CopyPaste, copyTool); CreateWeightTools(skeletonTool, meshTool, layoutOverlay); m_SelectionTool = CreateTool <SelectionTool>(); m_SelectionTool.spriteEditor = spriteEditor; m_SelectionTool.Initialize(layoutOverlay); m_SelectionTool.Activate(); var visibilityTool = CreateTool <VisibilityTool>(); visibilityTool.Initialize(layoutOverlay); visibilityTool.skeletonTool = skeletonTool; m_ToolMap.Add(Tools.Visibility, visibilityTool); var switchModeTool = CreateTool <SwitchModeTool>(); m_ToolMap.Add(Tools.SwitchMode, switchModeTool); }
private void AddMainUI(VisualElement mainView) { var visualTree = Resources.Load("LayoutOverlay") as VisualTreeAsset; VisualElement clone = visualTree.CloneTree(null); m_LayoutOverlay = clone.Q <LayoutOverlay>("LayoutOverlay"); mainView.Add(m_LayoutOverlay); m_LayoutOverlay.hasScrollbar = true; m_LayoutOverlay.StretchToParentSize(); CreateBoneToolbar(); CreateMeshToolbar(); CreateWeightToolbar(); m_ShortcutContext = InternalEditorBridge.CreateShortcutContext(isFocused); m_ShortcutContext.context = this; InternalEditorBridge.RegisterShortcutContext(m_ShortcutContext); InternalEditorBridge.AddEditorApplicationProjectLoadedCallback(OnProjectLoaded); }
public void Initialize(LayoutOverlay layout) { layout.rightOverlay.Add(this); Hide(); }
public override void Initialize(LayoutOverlay layout) { m_ToolView.Initialize(layout); }
private T CreateSkeletonTool <T>(SkeletonTool skeletonTool, SkeletonMode mode, bool editBindPose, LayoutOverlay layoutOverlay) where T : SkeletonToolWrapper { var tool = CreateTool <T>(); tool.skeletonTool = skeletonTool; tool.mode = mode; tool.editBindPose = editBindPose; tool.Initialize(layoutOverlay); return(tool); }
private T CreateMeshTool <T>(SkeletonTool skeletonTool, MeshTool meshTool, SpriteMeshViewMode meshViewMode, SkeletonMode skeletonMode, LayoutOverlay layoutOverlay) where T : MeshToolWrapper { var tool = CreateTool <T>(); tool.skeletonTool = skeletonTool; tool.meshTool = meshTool; tool.meshMode = meshViewMode; tool.skeletonMode = skeletonMode; tool.Initialize(layoutOverlay); return(tool); }
public virtual void Initialize(LayoutOverlay layout) { m_LayoutOverlay = layout; }
public override void Initialize(LayoutOverlay layoutOverlay) { m_Sprites = new List <SpriteCache>(skinningCache.GetSprites()); SetFromSpriteEditor(); }
public void Initialize(LayoutOverlay layout) { layout.rightOverlay.Add(m_BoneInspectorPanel); }