From 9abcb5224f2387e36cdf2a4970ffa802cdc81b52 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Sun, 27 Aug 2023 13:58:16 +0200 Subject: [PATCH 01/12] Initial WIP --- Assets/Prefabs/TextWidget.prefab | 646 ++++++++++++++++++ Assets/Prefabs/TextWidget.prefab.meta | 7 + Assets/Scenes/Main.unity | 1 + Assets/Scripts/API/ApiMethods.Utils.cs | 6 + Assets/Scripts/API/ApiMethods.cs | 45 ++ .../Scripts/Commands/CreateWidgetCommand.cs | 6 + .../Scripts/GUI/SketchbookMenuPopUpWindow.cs | 59 ++ .../GUI/SketchbookMenuPopUpWindow.cs.meta | 11 + Assets/Scripts/Tools/TextTool.cs | 124 ++++ Assets/Scripts/Tools/TextTool.cs.meta | 3 + Assets/Scripts/WidgetManager.cs | 54 +- Assets/Scripts/Widgets/TextWidget.cs | 71 ++ Assets/Scripts/Widgets/TextWidget.cs.meta | 11 + 13 files changed, 1043 insertions(+), 1 deletion(-) create mode 100644 Assets/Prefabs/TextWidget.prefab create mode 100644 Assets/Prefabs/TextWidget.prefab.meta create mode 100644 Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs create mode 100644 Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs.meta create mode 100644 Assets/Scripts/Tools/TextTool.cs create mode 100644 Assets/Scripts/Tools/TextTool.cs.meta create mode 100644 Assets/Scripts/Widgets/TextWidget.cs create mode 100644 Assets/Scripts/Widgets/TextWidget.cs.meta diff --git a/Assets/Prefabs/TextWidget.prefab b/Assets/Prefabs/TextWidget.prefab new file mode 100644 index 0000000000..8798b26aea --- /dev/null +++ b/Assets/Prefabs/TextWidget.prefab @@ -0,0 +1,646 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &104792 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 413480} + - component: {fileID: 11466202} + m_Layer: 0 + m_Name: TextWidget + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &413480 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104792} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 2.146, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2887450827974332392} + - {fileID: 412772} + - {fileID: 435884} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &11466202 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 104792} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a4076c5e23f394f42b64d6a6b6ccebd4, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowDuration: 0.2 + m_GrabDistance: 1 + m_CollisionRadius: 1.2 + m_AllowTwoHandGrab: 1 + m_DestroyOnHide: 0 + m_AllowHideWithToss: 1 + m_DisableDrift: 0 + m_RecordMovements: 1 + m_AllowSnapping: 1 + m_SnapDisabledDelay: 0.2 + m_AllowPinning: 1 + m_AllowDormancy: 1 + m_TossDuration: 0.25 + m_TintableMeshes: [] + m_SpawnPlacementOffset: {x: 0, y: 0, z: 0} + m_IntroAnimSpinAmount: 360 + m_BoxCollider: {fileID: 6507318} + m_Mesh: {fileID: 2887450827974332392} + m_HighlightMeshXfs: + - {fileID: 466610} + m_ValidSnapRotationStickyAngle: 65 + m_SnapGhostMaterial: {fileID: 2100000, guid: 43172d360a2f0f44798d94e9c440e24b, type: 2} + m_SelectionIndicatorRenderer: {fileID: 0} + m_ContainerBloat: {x: 0, y: 0, z: 0.4} + m_UngrabbableFromInside: 0 + m_MinSize_CS: 0.05 + m_MaxSize_CS: 2000 + m_NoImageTexture: {fileID: 2800000, guid: 57ec9586d21ff9142abf94cca6f69ef3, type: 3} + m_StartScale: 2 + m_ColliderBloat: 0.1 + m_MeshScalar: 1 + m_Background: {fileID: 466610} + m_Missing: {fileID: 435884} + m_MissingText: {fileID: 10267632} + m_MissingQuestionMark: {fileID: 149674} + m_QuestionMarkScalar: 1.5 + m_MinTextSize: 0.6 + m_TiltMeterCost: 1 + m_ImageQuad: {fileID: 2357204} + m_TextMeshPro: {fileID: 894299446316308540} +--- !u!1 &105650 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2887450827974332392} + - component: {fileID: 2357204} + - component: {fileID: 894299446316308540} + m_Layer: 0 + m_Name: TextMeshPro + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2887450827974332392 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 105650} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 466610} + m_Father: {fileID: 413480} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!23 &2357204 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 105650} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2122602, guid: ec48085d8b1ed18499cf1411d42005a0, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!114 &894299446316308540 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 105650} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Text + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: ec48085d8b1ed18499cf1411d42005a0, type: 2} + m_sharedMaterial: {fileID: 2122602, guid: ec48085d8b1ed18499cf1411d42005a0, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 0 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + _SortingLayer: 0 + _SortingLayerID: 0 + _SortingOrder: 0 + m_hasFontAssetChanged: 0 + m_renderer: {fileID: 2357204} + m_maskType: 0 +--- !u!1 &108072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 473572} + - component: {fileID: 3309956} + - component: {fileID: 2359870} + m_Layer: 0 + m_Name: SelectionIndicator + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &473572 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108072} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 0.3} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 412772} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3309956 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108072} + m_Mesh: {fileID: 4300000, guid: 1fffb18ea3c95344a8ea624958a8319b, type: 3} +--- !u!23 &2359870 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108072} + m_Enabled: 0 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 32562375f01c8c845a494d700c4ef48d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &108750 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 412772} + - component: {fileID: 6507318} + m_Layer: 0 + m_Name: Container + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &412772 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108750} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 473572} + m_Father: {fileID: 413480} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!65 &6507318 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 108750} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &114356 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 435884} + m_Layer: 18 + m_Name: Missing + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &435884 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114356} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 433034} + - {fileID: 478790} + m_Father: {fileID: 413480} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &135062 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 466610} + - component: {fileID: 3313898} + m_Layer: 0 + m_Name: BG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &466610 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 135062} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.005} + m_LocalScale: {x: 1, y: 1, z: 0.00125} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2887450827974332392} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3313898 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 135062} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &149674 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 478790} + - component: {fileID: 3322804} + - component: {fileID: 2375594} + m_Layer: 18 + m_Name: QuestionMark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &478790 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 149674} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.011} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 435884} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3322804 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 149674} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &2375594 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 149674} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: fcfcb94554ebd814aa6f067fe1cba536, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &173606 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 433034} + - component: {fileID: 2352122} + - component: {fileID: 10267632} + m_Layer: 18 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &433034 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 173606} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.011} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 435884} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &2352122 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 173606} + m_Enabled: 0 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!102 &10267632 +TextMesh: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 173606} + m_Text: 'Missing Image: + + file.png' + m_OffsetZ: 0 + m_CharacterSize: 0.05 + m_LineSpacing: 1 + m_Anchor: 4 + m_Alignment: 1 + m_TabSize: 4 + m_FontSize: 20 + m_FontStyle: 0 + m_RichText: 1 + m_Font: {fileID: 0} + m_Color: + serializedVersion: 2 + rgba: 4294967295 diff --git a/Assets/Prefabs/TextWidget.prefab.meta b/Assets/Prefabs/TextWidget.prefab.meta new file mode 100644 index 0000000000..646409c945 --- /dev/null +++ b/Assets/Prefabs/TextWidget.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c28bc4e3ed71248b889df2a70d873d0b +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index bf144a7cd0..4b1062ad1c 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -29545,6 +29545,7 @@ MonoBehaviour: type: 3} m_VideoWidgetPrefab: {fileID: 854942063617328480, guid: a1bf54eee52cec14e8207351740867f3, type: 3} + m_TextWidgetPrefab: {fileID: 11466202, guid: c28bc4e3ed71248b889df2a70d873d0b, type: 3} m_CameraPathWidgetPrefab: {fileID: 114268259032398848, guid: a933b2a19614a6c4da08a0143f0ec912, type: 3} m_CameraPathPositionKnotPrefab: {fileID: 1334758335721002, guid: 38b506951b7a81e4e9a6c65a9a20efa9, diff --git a/Assets/Scripts/API/ApiMethods.Utils.cs b/Assets/Scripts/API/ApiMethods.Utils.cs index 89bef9d6ae..14278b3a0e 100644 --- a/Assets/Scripts/API/ApiMethods.Utils.cs +++ b/Assets/Scripts/API/ApiMethods.Utils.cs @@ -127,6 +127,12 @@ private static ImageWidget _GetActiveImage(int index) index = _NegativeIndexing(index, WidgetManager.m_Instance.ActiveImageWidgets); return WidgetManager.m_Instance.ActiveImageWidgets[index].WidgetScript; } + + private static TextWidget _GetActiveTextWidget(int index) + { + index = _NegativeIndexing(index, WidgetManager.m_Instance.ActiveImageWidgets); + return WidgetManager.m_Instance.ActiveTextWidgets[index].WidgetScript; + } private static VideoWidget _GetActiveVideo(int index) { diff --git a/Assets/Scripts/API/ApiMethods.cs b/Assets/Scripts/API/ApiMethods.cs index 1a1881ac0d..52143c9f3d 100644 --- a/Assets/Scripts/API/ApiMethods.cs +++ b/Assets/Scripts/API/ApiMethods.cs @@ -357,6 +357,33 @@ private static ReferenceImage _LoadReferenceImage(string location) image.SynchronousLoad(); return image; } + + [ApiEndpoint("text.add", "Adds a text widget to the sketch")] + public static void AddText(string text) + { + var tr = TrTransform.TR( + ApiManager.Instance.BrushPosition, + ApiManager.Instance.BrushRotation + ); + + var cmd = new CreateWidgetCommand( + WidgetManager.m_Instance.TextWidgetPrefab, tr, null, true + ); + + SketchMemoryScript.m_Instance.PerformAndRecordCommand(cmd); + + var textWidget = cmd.Widget as TextWidget; + if (textWidget != null) + { + textWidget.Text = text; + textWidget.Show(true); + cmd.SetWidgetCost(textWidget.GetTiltMeterCost()); + } + + WidgetManager.m_Instance.WidgetsDormant = false; + SketchControlsScript.m_Instance.EatGazeObjectInput(); + SelectionManager.m_Instance.RemoveFromSelection(false); + } [ApiEndpoint("image.import", "Imports an image given a url or a filename in Media Library\\Images (Images loaded from a url are saved locally first)")] public static void ImportImage(string location) @@ -477,6 +504,24 @@ public static void PositionImage(int index, Vector3 position) { _PositionWidget(_GetActiveImage(index), position); } + + [ApiEndpoint("text.position", "Move a text widget to the given coordinates")] + public static void PositionText(int index, Vector3 position) + { + _PositionWidget(_GetActiveTextWidget(index), position); + } + + [ApiEndpoint("text.setText", "Changes the text on a text widget")] + public static void ChangeTextContent(int index, string text) + { + _GetActiveTextWidget(index).Text = text; + } + + [ApiEndpoint("text.setColor", "Changes the color on a text widget")] + public static void ChangeTextColor(int index, Vector3 color) + { + _GetActiveTextWidget(index).TextColor = new Color(color.x, color.y, color.z); + } // WIP // [ApiEndpoint("video.import", "Imports a video given a url or a filename in Media Library\\Videos")] diff --git a/Assets/Scripts/Commands/CreateWidgetCommand.cs b/Assets/Scripts/Commands/CreateWidgetCommand.cs index 22c82e0d82..537b79b06b 100644 --- a/Assets/Scripts/Commands/CreateWidgetCommand.cs +++ b/Assets/Scripts/Commands/CreateWidgetCommand.cs @@ -95,6 +95,7 @@ protected override void OnRedo() m_Widget.transform.position = m_SpawnXf.translation; // Widget type specific initialization. + // Should we have a default case here? Would need testing. if (m_Widget is StencilWidget) { m_Widget.transform.parent = m_Canvas.transform; @@ -110,6 +111,11 @@ protected override void OnRedo() m_Widget.transform.parent = m_Canvas.transform; m_Widget.Show(true); } + else if (m_Widget is TextWidget) + { + m_Widget.transform.parent = m_Canvas.transform; + m_Widget.Show(true); + } else if (m_Widget is VideoWidget) { m_Widget.transform.parent = m_Canvas.transform; diff --git a/Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs b/Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs new file mode 100644 index 0000000000..e006fac62d --- /dev/null +++ b/Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs @@ -0,0 +1,59 @@ +// Copyright 2023 The Open Brush Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.IO; +using UnityEngine; + +namespace TiltBrush +{ + + class SketchbookMenuPopUpWindow : MenuPopUpWindow + { + public override void SetPopupCommandParameters(int iCommandParam, int iCommandParam2) + { + // TODO : Fix this hangnail. + OptionButton[] optionButtons = GetComponentsInChildren(); + foreach (OptionButton button in optionButtons) + { + if (iCommandParam == 0) + { + button.SetButtonAvailable(false); + } + else + { + button.SetCommandParameters(iCommandParam, iCommandParam2); + } + } + + // The rename button should only be enabled for categories that support renaming + var renameButton = GetComponentInChildren(); + SketchSetType sketchSetType = (SketchSetType)iCommandParam2; + renameButton.SetButtonAvailable(sketchSetType == SketchSetType.User); + } + + public void SetInitialKeyboardText(KeyboardPopupButton btn) + { + SketchSetType sketchSetType = (SketchSetType)btn.m_CommandParam2; + var sketchSet = SketchCatalog.m_Instance.GetSet(SketchSetType.User) as FileSketchSet; + var sceneFileInfo = sketchSet.GetSketchSceneFileInfo(btn.m_CommandParam); + var currentName = Path.GetFileName(sceneFileInfo.FullPath); + if (currentName.EndsWith(SaveLoadScript.TILT_SUFFIX)) + { + currentName = currentName.Substring(0, currentName.Length - SaveLoadScript.TILT_SUFFIX.Length); + } + KeyboardPopUpWindow.m_InitialText = currentName; + } + } + +} // namespace TiltBrush diff --git a/Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs.meta b/Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs.meta new file mode 100644 index 0000000000..b022f44c1e --- /dev/null +++ b/Assets/Scripts/GUI/SketchbookMenuPopUpWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1bbca9ea9d044b7d8eed27d87c0e27f4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tools/TextTool.cs b/Assets/Scripts/Tools/TextTool.cs new file mode 100644 index 0000000000..529152902f --- /dev/null +++ b/Assets/Scripts/Tools/TextTool.cs @@ -0,0 +1,124 @@ +// Copyright 2021 The Open Brush Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.EnhancedTouch; +using Touch = UnityEngine.InputSystem.EnhancedTouch.Touch; + +namespace TiltBrush +{ + public class TextTool : BaseTool + { + private PopUpWindow m_PopUpPrefab; + private PopUpWindow m_ActivePopUp; + + override public void EnableTool(bool bEnable) + { + base.EnableTool(bEnable); + + if (bEnable) + { + EatInput(); + } + + // Make sure our UI reticle isn't active. + SketchControlsScript.m_Instance.ForceShowUIReticle(false); + } + + float BoundsRadius + { + get + { + return SceneSettings.m_Instance.HardBoundsRadiusMeters_SS; + } + } + + override public void UpdateTool() + { + base.UpdateTool(); + + Transform rAttachPoint = InputManager.m_Instance.GetBrushControllerAttachPoint(); + + if (InputManager.m_Instance.GetCommandDown(InputManager.SketchCommands.Activate)) + { + TextWidget nearestWidget = WidgetManager.m_Instance.GetNearestTextWidget(rAttachPoint.position, 0.1f); + if (!nearestWidget) + { + var tr = TrTransform.TR( + rAttachPoint.position, + rAttachPoint.rotation + ); + + var cmd = new CreateWidgetCommand( + WidgetManager.m_Instance.TextWidgetPrefab, tr, null, true + ); + + SketchMemoryScript.m_Instance.PerformAndRecordCommand(cmd); + + var textWidget = cmd.Widget as TextWidget; + if (textWidget != null) + { + textWidget.Text = "Text Widget"; + textWidget.Show(true); + cmd.SetWidgetCost(textWidget.GetTiltMeterCost()); + } + + WidgetManager.m_Instance.WidgetsDormant = false; + SketchControlsScript.m_Instance.EatGazeObjectInput(); + SelectionManager.m_Instance.RemoveFromSelection(false); + AudioManager.m_Instance.ShowHideWidget(true, transform.position); + nearestWidget = textWidget; + } + + // Create a new popup. + m_ActivePopUp = Instantiate( + m_PopUpPrefab, + rAttachPoint.position, + rAttachPoint.rotation + ); + + Vector3 vPos = rAttachPoint.position + + (rAttachPoint.forward * m_ActivePopUp.GetPopUpForwardOffset()) + + rAttachPoint.TransformVector(Vector3.forward); + m_ActivePopUp.transform.position = vPos; + m_ActivePopUp.transform.parent = rAttachPoint; + m_ActivePopUp.Init(gameObject, nearestWidget.Text); + + m_ActivePopUp.m_OnClose += () => + { + nearestWidget.Text = KeyboardPopUpWindow.m_LastInput; + }; + m_EatInput = !m_ActivePopUp.IsLongPressPopUp(); + } + PointerManager.m_Instance.SetMainPointerPosition(rAttachPoint.position); + } + + override public void LateUpdateTool() + { + base.LateUpdateTool(); + UpdateTransformsFromControllers(); + } + + private void UpdateTransformsFromControllers() + { + Transform rAttachPoint = InputManager.m_Instance.GetBrushControllerAttachPoint(); + transform.position = rAttachPoint.position; + transform.rotation = rAttachPoint.rotation; + } + } +} diff --git a/Assets/Scripts/Tools/TextTool.cs.meta b/Assets/Scripts/Tools/TextTool.cs.meta new file mode 100644 index 0000000000..6de41e767c --- /dev/null +++ b/Assets/Scripts/Tools/TextTool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 79236c9b5a85413493e75b7d56ad5f51 +timeCreated: 1693131972 \ No newline at end of file diff --git a/Assets/Scripts/WidgetManager.cs b/Assets/Scripts/WidgetManager.cs index 52e69f60ae..bd82e5a8bf 100644 --- a/Assets/Scripts/WidgetManager.cs +++ b/Assets/Scripts/WidgetManager.cs @@ -105,6 +105,7 @@ public class WidgetManager : MonoBehaviour [SerializeField] GameObject m_WidgetPinPrefab; [SerializeField] ImageWidget m_ImageWidgetPrefab; [SerializeField] VideoWidget m_VideoWidgetPrefab; + [SerializeField] TextWidget m_TextWidgetPrefab; [SerializeField] CameraPathWidget m_CameraPathWidgetPrefab; [SerializeField] private GameObject m_CameraPathPositionKnotPrefab; [SerializeField] private GameObject m_CameraPathRotationKnotPrefab; @@ -143,6 +144,7 @@ public class WidgetManager : MonoBehaviour private List> m_ModelWidgets; private List> m_StencilWidgets; private List> m_ImageWidgets; + private List> m_TextWidgets; private List> m_VideoWidgets; private List> m_CameraPathWidgets; @@ -299,6 +301,7 @@ public void Init() m_ModelWidgets = new List>(); m_StencilWidgets = new List>(); m_ImageWidgets = new List>(); + m_TextWidgets = new List>(); m_VideoWidgets = new List>(); m_CameraPathWidgets = new List>(); @@ -326,6 +329,7 @@ public void Init() public ModelWidget ModelWidgetPrefab { get { return m_ModelWidgetPrefab; } } public ImageWidget ImageWidgetPrefab { get { return m_ImageWidgetPrefab; } } public VideoWidget VideoWidgetPrefab { get { return m_VideoWidgetPrefab; } } + public TextWidget TextWidgetPrefab { get { return m_TextWidgetPrefab; } } public CameraPathWidget CameraPathWidgetPrefab { get { return m_CameraPathWidgetPrefab; } } public GameObject CameraPathPositionKnotPrefab { get { return m_CameraPathPositionKnotPrefab; } } public GameObject CameraPathRotationKnotPrefab { get { return m_CameraPathRotationKnotPrefab; } } @@ -376,6 +380,13 @@ private IEnumerable GetAllActiveGrabWidgets() yield return m_ImageWidgets[i]; } } + for (int i = 0; i < m_TextWidgets.Count; ++i) + { + if (m_TextWidgets[i].m_WidgetObject.activeSelf) + { + yield return m_TextWidgets[i]; + } + } for (int i = 0; i < m_VideoWidgets.Count; ++i) { if (m_VideoWidgets[i].m_WidgetObject.activeSelf) @@ -597,7 +608,10 @@ public bool CameraPathsVisible public bool HasSelectableWidgets() { - return (m_ModelWidgets.Count > 0) || (m_ImageWidgets.Count > 0) || (m_VideoWidgets.Count > 0) || + return m_ModelWidgets.Count > 0 || + m_ImageWidgets.Count > 0 || + m_TextWidgets.Count > 0 || + m_VideoWidgets.Count > 0 || (!m_StencilsDisabled && m_StencilWidgets.Count > 0); } @@ -1027,6 +1041,7 @@ public List GetAllUnselectedActiveWidgets() List widgets = new List(); GetUnselectedActiveWidgetsInList(m_ModelWidgets); GetUnselectedActiveWidgetsInList(m_ImageWidgets); + GetUnselectedActiveWidgetsInList(m_TextWidgets); GetUnselectedActiveWidgetsInList(m_VideoWidgets); if (!m_StencilsDisabled) { @@ -1057,6 +1072,7 @@ public void RefreshPinAndUnpinLists() RefreshPinUnpinWidgetList(m_ModelWidgets); RefreshPinUnpinWidgetList(m_ImageWidgets); + RefreshPinUnpinWidgetList(m_TextWidgets); RefreshPinUnpinWidgetList(m_VideoWidgets); RefreshPinUnpinWidgetList(m_StencilWidgets); @@ -1131,6 +1147,10 @@ public void RegisterGrabWidget(GameObject rWidget) { m_ImageWidgets.Add(new TypedWidgetData(image)); } + else if (generic is TextWidget textWidget) + { + m_TextWidgets.Add(new TypedWidgetData(textWidget)); + } else if (generic is VideoWidget video) { m_VideoWidgets.Add(new TypedWidgetData(video)); @@ -1184,11 +1204,40 @@ public void UnregisterGrabWidget(GameObject rWidget) if (RemoveFrom(m_ModelWidgets, rWidget)) { return; } if (RemoveFrom(m_StencilWidgets, rWidget)) { return; } if (RemoveFrom(m_ImageWidgets, rWidget)) { return; } + if (RemoveFrom(m_TextWidgets, rWidget)) { return; } if (RemoveFrom(m_VideoWidgets, rWidget)) { return; } if (RemoveFrom(m_CameraPathWidgets, rWidget)) { return; } RemoveFrom(m_GrabWidgets, rWidget); } + public TextWidget GetNearestTextWidget(Vector3 pos, float maxDepth) + { + var widgetList = ActiveTextWidgets.Select(x => x.m_WidgetScript); + return GetNearestGrabWidget(pos, maxDepth, widgetList) as TextWidget; + } + + public GrabWidget GetNearestGrabWidget(Vector3 pos, float maxDepth, IEnumerable widgetList) + { + GrabWidget bestWidget = null; + float leastDistance = float.MaxValue; + foreach (var widget in widgetList) + { + Vector3 dropper_QS; + Vector3 dropper_GS = pos; + Matrix4x4 xfQuadFromGlobal = widget.transform.worldToLocalMatrix; + dropper_QS = xfQuadFromGlobal.MultiplyPoint3x4(dropper_GS); + if (Mathf.Abs(dropper_QS.z) < leastDistance + && Mathf.Abs(dropper_QS.x) <= 0.5f + && Mathf.Abs(dropper_QS.y) <= 0.5f + && Mathf.Abs(dropper_QS.z) <= maxDepth / Mathf.Abs(widget.GetSignedWidgetSize())) + { + bestWidget = widget; + leastDistance = Mathf.Abs(dropper_QS.z); + } + } + return bestWidget; + } + public ImageWidget GetNearestImage(Vector3 pos, float maxDepth, ref Vector3 sampleLoc) { ImageWidget bestImage = null; @@ -1330,6 +1379,7 @@ public void DestroyAllWidgets() { DestroyWidgetList(m_ModelWidgets); DestroyWidgetList(m_ImageWidgets); + DestroyWidgetList(m_TextWidgets); DestroyWidgetList(m_VideoWidgets); DestroyWidgetList(m_StencilWidgets); DestroyWidgetList(m_CameraPathWidgets, false); @@ -1494,6 +1544,8 @@ public void TossNearestWidget() public List> ActiveImageWidgets => m_ImageWidgets.Where(w => w.WidgetScript.gameObject.activeSelf).ToList(); + public List> ActiveTextWidgets => + m_TextWidgets.Where(w => w.WidgetScript.gameObject.activeSelf).ToList(); public List> ActiveModelWidgets => m_ModelWidgets.Where(w => w.WidgetScript.gameObject.activeSelf).ToList(); public List> ActiveVideoWidgets => diff --git a/Assets/Scripts/Widgets/TextWidget.cs b/Assets/Scripts/Widgets/TextWidget.cs new file mode 100644 index 0000000000..e4cf0d480e --- /dev/null +++ b/Assets/Scripts/Widgets/TextWidget.cs @@ -0,0 +1,71 @@ +// Copyright 2023 The Open Brush Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using TMPro; +using UnityEngine; + +namespace TiltBrush +{ + public class TextWidget : Media2dWidget + { + public TextMeshPro m_TextMeshPro; + + public override float? AspectRatio => + m_TextMeshPro.renderedWidth / m_TextMeshPro.renderedHeight; + + public string Text + { + get => m_TextMeshPro.text; + set => m_TextMeshPro.text = value; + } + + public Color TextColor + { + get => m_TextMeshPro.color; + set => m_TextMeshPro.color = value; + } + + public override GrabWidget Clone() + { + return Clone(transform.position, transform.rotation, m_Size); + } + + override public GrabWidget Clone(Vector3 position, Quaternion rotation, float size) + { + TextWidget clone = Instantiate(WidgetManager.m_Instance.TextWidgetPrefab); + clone.m_PreviousCanvas = m_PreviousCanvas; + clone.transform.position = position; + clone.transform.rotation = rotation; + // We're obviously not loading from a sketch. This is to prevent the intro animation. + // TODO: Change variable name to something more explicit of what this flag does. + clone.m_LoadingFromSketch = true; + // We also want to lie about our intro transition amount. + // TODO: I think this is an old concept and redundant with other intro anim members. + clone.m_TransitionScale = 1.0f; + clone.Show(true, false); + clone.transform.parent = transform.parent; + clone.SetSignedWidgetSize(size); + HierarchyUtils.RecursivelySetLayer(clone.transform, gameObject.layer); + TiltMeterScript.m_Instance.AdjustMeterWithWidget(clone.GetTiltMeterCost(), up: true); + clone.CloneInitialMaterials(this); + clone.TrySetCanvasKeywordsFromObject(transform); + return clone; + } + + public override string GetExportName() + { + return $"Text: {m_TextMeshPro.text}"; + } + } +} // namespace TiltBrush diff --git a/Assets/Scripts/Widgets/TextWidget.cs.meta b/Assets/Scripts/Widgets/TextWidget.cs.meta new file mode 100644 index 0000000000..c59e42c046 --- /dev/null +++ b/Assets/Scripts/Widgets/TextWidget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a4076c5e23f394f42b64d6a6b6ccebd4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 1b42886809c4f880b7be1010b9ecab43e2aacd7a Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Thu, 31 Aug 2023 09:57:13 +0200 Subject: [PATCH 02/12] WIP - generate png textures for text widget on export --- Assets/Scripts/Export/ExportCollector.cs | 109 +++++++++++++++++++++-- Assets/Scripts/Export/ExportGlTF.cs | 5 +- Assets/Scripts/Export/ExportStl.cs | 6 +- Assets/Scripts/Export/ExportVrml.cs | 6 +- Assets/Scripts/WidgetManager.cs | 2 +- ProjectSettings/TagManager.asset | 2 +- 6 files changed, 120 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/Export/ExportCollector.cs b/Assets/Scripts/Export/ExportCollector.cs index 7516c554a4..0703f0c04d 100644 --- a/Assets/Scripts/Export/ExportCollector.cs +++ b/Assets/Scripts/Export/ExportCollector.cs @@ -39,7 +39,7 @@ class ExportCollector public static SceneStatePayload GetExportPayload( AxisConvention axes, bool includeLocalMediaContent = false, - string temporaryDirectory = null) + string temporaryDirectory = null, string outputDirectory = null) { UnityEngine.Profiling.Profiler.BeginSample("GetSceneStatePayload"); @@ -101,9 +101,57 @@ bool IsImageExportable(ImageWidget w) payload.imageQuads.Add(BuildImageQuadPayload(payload, image, material, idx)); } } - - BuildEmptyXforms(payload, notImages); BuildEmptyXforms(payload, notExportable); + + // Text Widgets + var (textWidgets, notTextOrImage) = notImages.Partition(w => w is TextWidget); + foreach (var (widget, idx) in textWidgets.WithIndex()) + { + var tw = (TextWidget)widget; + var textMesh = tw.m_TextMeshPro; + var guid = MakeDeterministicUniqueName(kPbrTransparentGuid, tw, 0); + string texturePath = $"{outputDirectory}/{guid}.png"; + + int width = Mathf.RoundToInt(textMesh.renderedWidth * 256); + int height = Mathf.RoundToInt(textMesh.renderedHeight * 256); + + Camera tempCamera = new GameObject("TempCamera").AddComponent(); + RenderTexture renderTexture = new RenderTexture(width, height, 24); + tempCamera.targetTexture = renderTexture; + + // Adjust camera's position and rotation to capture the text mesh + tempCamera.orthographic = true; + tempCamera.orthographicSize = textMesh.renderedHeight; + tempCamera.aspect = tw.AspectRatio.Value; + tempCamera.transform.position = textMesh.transform.position + textMesh.transform.forward * -1; + tempCamera.transform.forward = textMesh.transform.forward; + + // Set the camera's culling mask to only render the temp layer + // int tmpLayer = LayerMask.NameToLayer("TempRenderTex"); + var prevLayer = textMesh.gameObject.layer; + // textMesh.gameObject.layer = tmpLayer; + // tempCamera.cullingMask = 1 << tmpLayer; + + // Capture the image + tempCamera.Render(); + + RenderTexture.active = renderTexture; + Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false); + tex.ReadPixels(new Rect(0, 0, width, height), 0, 0); + tex.Apply(); + + byte[] bytes = tex.EncodeToPNG(); + File.WriteAllBytes(texturePath, bytes); + + // Cleanup + textMesh.gameObject.layer = prevLayer; + UnityEngine.Object.DestroyImmediate(tex); + UnityEngine.Object.DestroyImmediate(tempCamera); + + var material = CreateImageQuadMaterial(tw, texturePath, guid); + payload.imageQuads.Add(BuildImageQuadPayload(payload, widget, material, idx)); + } + BuildEmptyXforms(payload, notTextOrImage); } UnityEngine.Profiling.Profiler.EndSample(); @@ -323,6 +371,11 @@ static Guid MakeDeterministicUniqueName(Guid descriptor, ReferenceImage ri, int { return GuidUtils.Uuid5(descriptor, string.Format("{0}_{1}", ri.FileFullPath, id)); } + + static Guid MakeDeterministicUniqueName(Guid descriptor, TextWidget tw, int id) + { + return GuidUtils.Uuid5(descriptor, string.Format("{0}_{1}", tw.Text, id)); + } static DynamicExportableMaterial CreateImageQuadMaterial(ReferenceImage ri) { @@ -338,12 +391,27 @@ static DynamicExportableMaterial CreateImageQuadMaterial(ReferenceImage ri) MetallicFactor = kRefimageMetallicFactor }; } + + static DynamicExportableMaterial CreateImageQuadMaterial(TextWidget tw, string path, Guid guid) + { + BrushDescriptor desc = BrushCatalog.m_Instance.GetBrush(kPbrTransparentGuid); + return new DynamicExportableMaterial( + parent: desc, + // GetExportName() not totally guaranteed to be unique; maybe we should detect collisions? + durableName: $"text_{tw.GetExportName()}", + uniqueName: guid, + uriBase: Path.GetDirectoryName(path)) + { + BaseColorTex = Path.GetFileName(path), + MetallicFactor = kRefimageMetallicFactor + }; + } // widget.ReferenceImage must be != null // Never returns null // id is an instance id static ImageQuadPayload BuildImageQuadPayload( - SceneStatePayload payload, ImageWidget widget, DynamicExportableMaterial material, int id) + SceneStatePayload payload, Media2dWidget widget, DynamicExportableMaterial material, int id) { string nodeName = $"image_{widget.GetExportName()}_{id}"; @@ -366,7 +434,16 @@ static ImageQuadPayload BuildImageQuadPayload( // Create pool and bake in the leftover non-uniform scale GeometryPool pool = new GeometryPool(); pool.Layout = material.VertexLayout; - pool.Append(widgetChild.GetComponent().sharedMesh, fallbackColor: Color.white); + Mesh mesh; + if (false) // TODO (widget is TextWidget) + { + mesh = CreateQuad(((TextWidget)widget).AspectRatio.Value); + } + else + { + mesh = widgetChild.GetComponent().sharedMesh; + } + pool.Append(mesh, fallbackColor: Color.white); pool.ApplyTransform( Matrix4x4.Scale(localScale), Matrix4x4.identity, 1f, 0, pool.NumVerts); @@ -394,6 +471,28 @@ static ImageQuadPayload BuildImageQuadPayload( exportableMaterial = material, }; } + + private static Mesh CreateQuad(float aspect) + { + float width = aspect / 2f; + var mesh = new Mesh(); + mesh.vertices = new[] + { + new Vector3(-width, 0.5f, 0), + new Vector3(width, 0.5f, 0), + new Vector3(width, -0.5f, 0), + new Vector3(-width, -0.5f, 0) + }; + mesh.triangles = new[] + { + 0, 1, 3, + 1, 2, 3 + }; + mesh.RecalculateBounds(); + mesh.RecalculateNormals(); + mesh.RecalculateTangents(); + return new Mesh(); + } // -------------------------------------------------------------------------------------------- // // Model Meshes diff --git a/Assets/Scripts/Export/ExportGlTF.cs b/Assets/Scripts/Export/ExportGlTF.cs index 13867449fc..258d9b9ae5 100644 --- a/Assets/Scripts/Export/ExportGlTF.cs +++ b/Assets/Scripts/Export/ExportGlTF.cs @@ -78,10 +78,13 @@ public ExportResults ExportBrushStrokes( bool includeLocalMediaContent, int gltfVersion, bool selfContained = false) { + Debug.Log($"outputFile: {outputFile}"); var payload = ExportCollector.GetExportPayload( axes, includeLocalMediaContent: includeLocalMediaContent, - temporaryDirectory: Path.Combine(Application.temporaryCachePath, "exportgltf")); + temporaryDirectory: Path.Combine(Application.temporaryCachePath, "exportgltf"), + Path.GetDirectoryName(outputFile) + ); return ExportHelper(payload, outputFile, binary, doExtras: doExtras, gltfVersion: gltfVersion, allowHttpUri: !selfContained); } diff --git a/Assets/Scripts/Export/ExportStl.cs b/Assets/Scripts/Export/ExportStl.cs index 35022fdf16..47d0081596 100644 --- a/Assets/Scripts/Export/ExportStl.cs +++ b/Assets/Scripts/Export/ExportStl.cs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.IO; using System.Text; using UnityEngine; @@ -24,7 +25,10 @@ public static void Export(string outputFile) { float scale = 100f; - ExportUtils.SceneStatePayload payload = ExportCollector.GetExportPayload(AxisConvention.kStl); + ExportUtils.SceneStatePayload payload = ExportCollector.GetExportPayload( + AxisConvention.kStl, + outputDirectory: Path.GetDirectoryName(outputFile) + ); var buffer = new StringBuilder(); foreach (var group in payload.groups) diff --git a/Assets/Scripts/Export/ExportVrml.cs b/Assets/Scripts/Export/ExportVrml.cs index ab5b9a249a..3a398b22b1 100644 --- a/Assets/Scripts/Export/ExportVrml.cs +++ b/Assets/Scripts/Export/ExportVrml.cs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.IO; using System.Text; using UnityEngine; @@ -46,7 +47,10 @@ public static class ExportVrml { public static bool Export(string outputFile) { - ExportUtils.SceneStatePayload payload = ExportCollector.GetExportPayload(AxisConvention.kVrml); + ExportUtils.SceneStatePayload payload = ExportCollector.GetExportPayload( + AxisConvention.kVrml, + outputDirectory: Path.GetDirectoryName(outputFile) + ); var buffer = new StringBuilder("#VRML V2.0 utf8\n"); AppendSceneHeader(ref buffer); diff --git a/Assets/Scripts/WidgetManager.cs b/Assets/Scripts/WidgetManager.cs index bd82e5a8bf..368bb38c61 100644 --- a/Assets/Scripts/WidgetManager.cs +++ b/Assets/Scripts/WidgetManager.cs @@ -408,7 +408,7 @@ public IEnumerable MediaWidgets get { IEnumerable ret = m_ModelWidgets; - return ret.Concat(m_ImageWidgets).Concat(m_VideoWidgets); + return ret.Concat(m_ImageWidgets).Concat(m_VideoWidgets).Concat(m_TextWidgets); } } diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index f4a231f125..9b632ab20e 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -31,7 +31,7 @@ TagManager: - GpuIntersection - PinnedStencilObject - Overlay - - + - TempRenderTex - - - From 3d9e29a2972c90b1ca661eb6f5bb6e7d1ff5573a Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Thu, 31 Aug 2023 15:38:38 +0100 Subject: [PATCH 03/12] Add a button (just a placeholder for now) --- .../Prefabs/Panels/AdvancedToolsPanel.prefab | 162 +++++++++++++++++- .../Strings/Strings Shared Data.asset | 4 + .../Localization/Strings/Strings_en.asset | 6 +- 3 files changed, 165 insertions(+), 7 deletions(-) diff --git a/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab b/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab index 3aa3afd171..560937d2ce 100644 --- a/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab +++ b/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab @@ -458,7 +458,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4067220476156272} - m_RootOrder: 12 + m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &33463444720997118 MeshFilter: @@ -1090,7 +1090,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4067220476156272} - m_RootOrder: 13 + m_RootOrder: 14 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &33527498822042428 MeshFilter: @@ -1130,7 +1130,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4067220476156272} - m_RootOrder: 11 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!65 &65439514599846630 BoxCollider: @@ -1179,7 +1179,7 @@ Transform: m_Children: - {fileID: 4099180057378294} m_Father: {fileID: 4067220476156272} - m_RootOrder: 14 + m_RootOrder: 15 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &33827995805926138 MeshFilter: @@ -1361,6 +1361,7 @@ Transform: - {fileID: 5132072297439473359} - {fileID: 5566995999782226336} - {fileID: 2329771398596852252} + - {fileID: 4502523064090158760} - {fileID: 4487744745540934} - {fileID: 4913046734195790} - {fileID: 4084186664612276} @@ -2365,7 +2366,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5664627563248376400} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.211, y: -0.634, z: 0.05} + m_LocalPosition: {x: -0.422, y: -0.634, z: 0.05} m_LocalScale: {x: 0.35, y: 0.35, z: 0.35} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2486,6 +2487,155 @@ MonoBehaviour: references: version: 2 RefIds: [] +--- !u!1 &6535217432110762182 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4502523064090158760} + - component: {fileID: 4679399731301646499} + - component: {fileID: 364446193627975246} + - component: {fileID: 1319175746123658152} + - component: {fileID: 7156252261596179870} + m_Layer: 16 + m_Name: Button_Join (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4502523064090158760 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6535217432110762182} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.422, y: -0.634, z: 0.05} + m_LocalScale: {x: 0.35, y: 0.35, z: 0.35} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4067220476156272} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &4679399731301646499 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6535217432110762182} + m_Mesh: {fileID: 4300000, guid: 5501f437160666942ae970f3648fbeb8, type: 3} +--- !u!23 &364446193627975246 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6535217432110762182} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 40d29de2bdc11f04dbfa25059165916e, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &1319175746123658152 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6535217432110762182} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 0.01} + m_Center: {x: 0, y: 0, z: -0.05} +--- !u!114 &7156252261596179870 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6535217432110762182} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 962894c5495cabc458506a8548e8a1e2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_DescriptionType: 0 + m_DescriptionYOffset: 0 + m_DescriptionText: ADVANCEDTOOLS_PANEL_BUTTON_TEXT + m_LocalizedDescription: + m_TableReference: + m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86 + m_TableEntryReference: + m_KeyId: 140585981667180544 + m_Key: + m_FallbackState: 0 + m_WaitForCompletion: 0 + m_LocalVariables: [] + m_DescriptionTextExtra: + m_LocalizedDescriptionExtra: + m_TableReference: + m_TableCollectionName: + m_TableEntryReference: + m_KeyId: 0 + m_Key: + m_FallbackState: 0 + m_WaitForCompletion: 0 + m_LocalVariables: [] + m_DescriptionActivateSpeed: 12 + m_DescriptionZScale: 1 + m_ButtonTexture: {fileID: 2800000, guid: 6da5cd89204da99468e34a61cc7ad99d, type: 3} + m_AtlasTexture: 1 + m_ToggleButton: 1 + m_LongPressReleaseButton: 0 + m_ButtonHasPressedAudio: 1 + m_ZAdjustHover: -0.02 + m_ZAdjustClick: 0.05 + m_HoverScale: 1.1 + m_HoverBoxColliderGrow: 0.2 + m_AddOverlay: 0 + m_Tool: 11001 + m_EatGazeInputOnPress: 0 + references: + version: 2 + RefIds: [] --- !u!1 &7793811069088501246 GameObject: m_ObjectHideFlags: 0 @@ -2514,7 +2664,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7793811069088501246} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0.211, y: -0.634, z: 0.05} + m_LocalPosition: {x: 0, y: -0.634, z: 0.05} m_LocalScale: {x: 0.35, y: 0.35, z: 0.35} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/Settings/Localization/Strings/Strings Shared Data.asset b/Assets/Settings/Localization/Strings/Strings Shared Data.asset index 64baa09705..b76144462c 100644 --- a/Assets/Settings/Localization/Strings/Strings Shared Data.asset +++ b/Assets/Settings/Localization/Strings/Strings Shared Data.asset @@ -3243,6 +3243,10 @@ MonoBehaviour: m_Key: WEBCAM_PANEL_NEXT_DEVICE m_Metadata: m_Items: [] + - m_Id: 140585981667180544 + m_Key: ADVANCEDTOOLS_PANEL_BUTTON_TEXT + m_Metadata: + m_Items: [] m_Metadata: m_Items: [] m_KeyGenerator: diff --git a/Assets/Settings/Localization/Strings/Strings_en.asset b/Assets/Settings/Localization/Strings/Strings_en.asset index 0408f475d4..9bb0de89f5 100644 --- a/Assets/Settings/Localization/Strings/Strings_en.asset +++ b/Assets/Settings/Localization/Strings/Strings_en.asset @@ -3101,7 +3101,7 @@ MonoBehaviour: m_Metadata: m_Items: [] - m_Id: 106429517453328384 - m_Localized: "Background Images" + m_Localized: Background Images m_Metadata: m_Items: [] - m_Id: 95221400803737600 @@ -3432,6 +3432,10 @@ MonoBehaviour: m_Localized: Next Device m_Metadata: m_Items: [] + - m_Id: 140585981667180544 + m_Localized: Text + m_Metadata: + m_Items: [] references: version: 2 RefIds: [] From c31504ae10869b9bc5c89d0520dab0d0cad95064 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Thu, 14 Sep 2023 11:59:57 +0100 Subject: [PATCH 04/12] wip --- .../Prefabs/Panels/AdvancedToolsPanel.prefab | 9 +- Assets/Prefabs/TextTool.prefab | 301 ++++++++++++++++++ Assets/Prefabs/TextTool.prefab.meta | 7 + Assets/Prefabs/TextWidget.prefab | 12 +- Assets/Scenes/Main.unity | 78 ++++- Assets/Scripts/GUI/TextToolButton.cs | 33 ++ Assets/Scripts/GUI/TextToolButton.cs.meta | 11 + Assets/Scripts/SketchControlsScript.cs | 6 +- Assets/Scripts/Tools/BaseTool.cs | 3 +- Assets/Scripts/Tools/TextTool.cs | 36 +-- Assets/Scripts/Widgets/TextWidget.cs | 20 +- 11 files changed, 476 insertions(+), 40 deletions(-) create mode 100644 Assets/Prefabs/TextTool.prefab create mode 100644 Assets/Prefabs/TextTool.prefab.meta create mode 100644 Assets/Scripts/GUI/TextToolButton.cs create mode 100644 Assets/Scripts/GUI/TextToolButton.cs.meta diff --git a/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab b/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab index 560937d2ce..430c757eff 100644 --- a/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab +++ b/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab @@ -814,6 +814,9 @@ MonoBehaviour: - m_PopUpPrefab: {fileID: 1887799951535888, guid: a600c48c5f105874e8e750977bb95d4b, type: 3} m_Command: 11500 + - m_PopUpPrefab: {fileID: 8644332587479430734, guid: bdb7d2ac05cca8346b210c2b576878cb, + type: 3} + m_Command: 12001 m_PanelDescription: ADVANCEDTOOLS_PANEL_DESCRIPTION m_LocalizedPanelDescription: m_TableReference: @@ -2501,7 +2504,7 @@ GameObject: - component: {fileID: 1319175746123658152} - component: {fileID: 7156252261596179870} m_Layer: 16 - m_Name: Button_Join (1) + m_Name: Button_Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2594,7 +2597,7 @@ MonoBehaviour: m_GameObject: {fileID: 6535217432110762182} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 962894c5495cabc458506a8548e8a1e2, type: 3} + m_Script: {fileID: 11500000, guid: f924f0ff57b618b44aaef2d9484ee7af, type: 3} m_Name: m_EditorClassIdentifier: m_DescriptionType: 0 @@ -2631,7 +2634,7 @@ MonoBehaviour: m_HoverScale: 1.1 m_HoverBoxColliderGrow: 0.2 m_AddOverlay: 0 - m_Tool: 11001 + m_Tool: 5400 m_EatGazeInputOnPress: 0 references: version: 2 diff --git a/Assets/Prefabs/TextTool.prefab b/Assets/Prefabs/TextTool.prefab new file mode 100644 index 0000000000..08f3f81024 --- /dev/null +++ b/Assets/Prefabs/TextTool.prefab @@ -0,0 +1,301 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8463577212548165003 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8463577212548165002} + - component: {fileID: 8463577212548165001} + m_Layer: 14 + m_Name: TextTool + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &8463577212548165002 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8463577212548165003} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.49999997, y: 0.5, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 8463577212721617487} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8463577212548165001 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8463577212548165003} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 79236c9b5a85413493e75b7d56ad5f51, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Type: 5400 + m_ShowTransformGizmo: 0 + m_ExitOnAbortCommand: 1 + m_ScalingSupported: 0 + m_PopUpPrefab: {fileID: 3095268576859284452, guid: bdb7d2ac05cca8346b210c2b576878cb, + type: 3} +--- !u!1 &8463577212721617472 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8463577212721617487} + m_Layer: 14 + m_Name: BadTeleportIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8463577212721617487 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8463577212721617472} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 8463577212531524173} + - {fileID: 8463577213261396087} + m_Father: {fileID: 8463577212548165002} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &8463577213261396072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8463577213261396087} + - component: {fileID: 8463577213261396086} + m_Layer: 14 + m_Name: Line + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8463577213261396087 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8463577213261396072} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8463577212721617487} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!120 &8463577213261396086 +LineRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8463577213261396072} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6418e904d805fbf44886e90b2158285a, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Positions: + - {x: 0, y: 0, z: 0} + - {x: 0, y: 0, z: 1} + m_Parameters: + serializedVersion: 3 + widthMultiplier: 1 + widthCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.02 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0.02 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + numCornerVertices: 0 + numCapVertices: 0 + alignment: 0 + textureMode: 0 + shadowBias: 0 + generateLightingData: 0 + m_UseWorldSpace: 0 + m_Loop: 0 +--- !u!1001 &8463577212531923149 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8463577212721617487} + m_Modifications: + - target: {fileID: 100000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_Name + value: X + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalScale.x + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalScale.y + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalScale.z + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalPosition.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalPosition.z + value: 1.168 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_CastShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_ReceiveShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 03f3b4747259a364b800508ac27e1c17, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, type: 3} +--- !u!4 &8463577212531524173 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: 7d1776294cb9ac042b975b59dd2bbd4b, + type: 3} + m_PrefabInstance: {fileID: 8463577212531923149} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/TextTool.prefab.meta b/Assets/Prefabs/TextTool.prefab.meta new file mode 100644 index 0000000000..ffce65507e --- /dev/null +++ b/Assets/Prefabs/TextTool.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 057ad9cf6c77278419e3f7c95edc17e0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/TextWidget.prefab b/Assets/Prefabs/TextWidget.prefab index 8798b26aea..dc7448c78d 100644 --- a/Assets/Prefabs/TextWidget.prefab +++ b/Assets/Prefabs/TextWidget.prefab @@ -25,7 +25,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 104792} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 2.146, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -124,7 +124,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 20, y: 5} + m_SizeDelta: {x: 5, y: 5} m_Pivot: {x: 0.5, y: 0.5} --- !u!23 &2357204 MeshRenderer: @@ -215,8 +215,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 36 - m_fontSizeBase: 36 + m_fontSize: 12 + m_fontSizeBase: 12 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -231,7 +231,7 @@ MonoBehaviour: m_lineSpacingMax: 0 m_paragraphSpacing: 0 m_charWidthMaxAdj: 0 - m_enableWordWrapping: 1 + m_enableWordWrapping: 0 m_wordWrappingRatios: 0.4 m_overflowMode: 0 m_linkedTextComponent: {fileID: 0} @@ -448,7 +448,7 @@ Transform: m_GameObject: {fileID: 135062} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0.005} - m_LocalScale: {x: 1, y: 1, z: 0.00125} + m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2887450827974332392} diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 4b1062ad1c..76504e1236 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -3484,7 +3484,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_FakeCommandLineArgsInEditor: m_PlatformConfig: {fileID: 11400000, guid: 0764a106823cbec4e8d75b2816f3cbd3, type: 2} - m_SdkMode: 0 + m_SdkMode: 1 m_AutoProfile: 0 m_AutoProfileWaitTime: 10 Secrets: {fileID: 11400000, guid: 2f5f8e93c6bc7be49a5023148b50e7a0, type: 2} @@ -9403,6 +9403,7 @@ Transform: - {fileID: 8282789105019930893} - {fileID: 402490430} - {fileID: 1804317401} + - {fileID: 1404596589} m_Father: {fileID: 1796800572} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -18702,6 +18703,12 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!4 &1404596589 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + m_PrefabInstance: {fileID: 8463577213852081383} + m_PrefabAsset: {fileID: 0} --- !u!1 &1412532061 GameObject: m_ObjectHideFlags: 0 @@ -35612,6 +35619,75 @@ PrefabInstance: objectReference: {fileID: 94678610} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: e26dd31bb70849e4da9f0b1230a62278, type: 3} +--- !u!1001 &8463577213852081383 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 593121476} + m_Modifications: + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_RootOrder + value: 21 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165002, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8463577212548165003, guid: 057ad9cf6c77278419e3f7c95edc17e0, + type: 3} + propertyPath: m_Name + value: TextTool + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 057ad9cf6c77278419e3f7c95edc17e0, type: 3} --- !u!4 &9123593761565215834 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/GUI/TextToolButton.cs b/Assets/Scripts/GUI/TextToolButton.cs new file mode 100644 index 0000000000..84421d10df --- /dev/null +++ b/Assets/Scripts/GUI/TextToolButton.cs @@ -0,0 +1,33 @@ +// Copyright 2023 The Open Brush Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using UnityEngine; + +namespace TiltBrush +{ + + public class TextToolButton : ToolButton + { + override protected void OnButtonPressed() + { + base.OnButtonPressed(); + BasePanel panel = m_Manager.GetPanelForPopUps(); + panel.CreatePopUp(SketchControlsScript.GlobalCommands.OpenTextInputPopup, -1, -1, "Hello"); + // panel.PanelPopUp.m_OnClose += () => + // { + // TextTool.m_CurrentWidget.Text = KeyboardPopUpWindow.m_LastInput; + // }; + } + } +} // namespace TiltBrush diff --git a/Assets/Scripts/GUI/TextToolButton.cs.meta b/Assets/Scripts/GUI/TextToolButton.cs.meta new file mode 100644 index 0000000000..ee8b2e51ff --- /dev/null +++ b/Assets/Scripts/GUI/TextToolButton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f924f0ff57b618b44aaef2d9484ee7af +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SketchControlsScript.cs b/Assets/Scripts/SketchControlsScript.cs index 7b9ce363df..399a9f6016 100644 --- a/Assets/Scripts/SketchControlsScript.cs +++ b/Assets/Scripts/SketchControlsScript.cs @@ -154,7 +154,8 @@ public enum GlobalCommands ChangeSnapAngle = 8000, MergeBrushStrokes = 10000, RepaintOptions = 11500, - OpenNumericInputPopup = 12000 + OpenNumericInputPopup = 12000, + OpenTextInputPopup = 12001 } public enum ControlsType @@ -4936,7 +4937,8 @@ public void IssueGlobalCommand(GlobalCommands rEnum, int iParam1 = -1, OpenUrl($"http://localhost:{App.HttpServer.HttpPort}/examplescripts"); break; case GlobalCommands.RepaintOptions: break; // Intentionally blank. - case GlobalCommands.Null: break; // Intentionally blank. + case GlobalCommands.OpenTextInputPopup: break; // Intentionally blank. + case GlobalCommands.Null: break; // Intentionally blank. default: Debug.LogError($"Unrecognized command {rEnum}"); break; diff --git a/Assets/Scripts/Tools/BaseTool.cs b/Assets/Scripts/Tools/BaseTool.cs index fb52e9c17c..bf8b385206 100644 --- a/Assets/Scripts/Tools/BaseTool.cs +++ b/Assets/Scripts/Tools/BaseTool.cs @@ -47,8 +47,9 @@ public enum ToolType EmptyTool, CameraPathTool, FlyTool, + TextTool = 5400, SnipTool = 11000, - JoinTool = 11001 + JoinTool = 11001, } public ToolType m_Type; diff --git a/Assets/Scripts/Tools/TextTool.cs b/Assets/Scripts/Tools/TextTool.cs index 529152902f..8006939747 100644 --- a/Assets/Scripts/Tools/TextTool.cs +++ b/Assets/Scripts/Tools/TextTool.cs @@ -24,9 +24,9 @@ namespace TiltBrush { public class TextTool : BaseTool { - private PopUpWindow m_PopUpPrefab; - private PopUpWindow m_ActivePopUp; - + + public static TextWidget m_CurrentWidget; + override public void EnableTool(bool bEnable) { base.EnableTool(bEnable); @@ -56,8 +56,8 @@ override public void UpdateTool() if (InputManager.m_Instance.GetCommandDown(InputManager.SketchCommands.Activate)) { - TextWidget nearestWidget = WidgetManager.m_Instance.GetNearestTextWidget(rAttachPoint.position, 0.1f); - if (!nearestWidget) + m_CurrentWidget = WidgetManager.m_Instance.GetNearestTextWidget(rAttachPoint.position, 0.1f); + if (!m_CurrentWidget) { var tr = TrTransform.TR( rAttachPoint.position, @@ -82,28 +82,12 @@ override public void UpdateTool() SketchControlsScript.m_Instance.EatGazeObjectInput(); SelectionManager.m_Instance.RemoveFromSelection(false); AudioManager.m_Instance.ShowHideWidget(true, transform.position); - nearestWidget = textWidget; + m_CurrentWidget = textWidget; } - - // Create a new popup. - m_ActivePopUp = Instantiate( - m_PopUpPrefab, - rAttachPoint.position, - rAttachPoint.rotation - ); - - Vector3 vPos = rAttachPoint.position + - (rAttachPoint.forward * m_ActivePopUp.GetPopUpForwardOffset()) + - rAttachPoint.TransformVector(Vector3.forward); - m_ActivePopUp.transform.position = vPos; - m_ActivePopUp.transform.parent = rAttachPoint; - m_ActivePopUp.Init(gameObject, nearestWidget.Text); - - m_ActivePopUp.m_OnClose += () => - { - nearestWidget.Text = KeyboardPopUpWindow.m_LastInput; - }; - m_EatInput = !m_ActivePopUp.IsLongPressPopUp(); + } + if (m_CurrentWidget != null) + { + m_CurrentWidget.Text = KeyboardPopUpWindow.m_LastInput; } PointerManager.m_Instance.SetMainPointerPosition(rAttachPoint.position); } diff --git a/Assets/Scripts/Widgets/TextWidget.cs b/Assets/Scripts/Widgets/TextWidget.cs index e4cf0d480e..59fefcf2d0 100644 --- a/Assets/Scripts/Widgets/TextWidget.cs +++ b/Assets/Scripts/Widgets/TextWidget.cs @@ -23,11 +23,29 @@ public class TextWidget : Media2dWidget public override float? AspectRatio => m_TextMeshPro.renderedWidth / m_TextMeshPro.renderedHeight; + + protected override void UpdateScale() + { + base.UpdateScale(); + UpdateCollider(); + } public string Text { get => m_TextMeshPro.text; - set => m_TextMeshPro.text = value; + set + { + m_TextMeshPro.text = value; + UpdateCollider(); + } + } + + private void UpdateCollider() + { + m_TextMeshPro.ForceMeshUpdate(); + var size = m_TextMeshPro.GetRenderedValues(true); + // No idea why the 1.3 and 0.9 is necessary, but it is. + m_BoxCollider.transform.localScale = new Vector3(size.x * 1.3f, size.y * 0.9f, m_BoxCollider.transform.localScale.z); } public Color TextColor From 583826d00e7024d5902b7435b6bb59087d545318 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Thu, 28 Sep 2023 16:34:37 +0100 Subject: [PATCH 05/12] Initial save/load support WIP --- Assets/Scripts/Save/MetadataUtils.cs | 21 ++++++++++++++++++ Assets/Scripts/Save/SaveLoadScript.cs | 4 ++++ Assets/Scripts/Save/SketchMetadata.cs | 17 ++++++++++++++ Assets/Scripts/WidgetManager.cs | 19 ++++++++++++++++ Assets/Scripts/Widgets/TextWidget.cs | 32 +++++++++++++++++++++++++++ 5 files changed, 93 insertions(+) diff --git a/Assets/Scripts/Save/MetadataUtils.cs b/Assets/Scripts/Save/MetadataUtils.cs index a0873b4ed0..3f933105aa 100644 --- a/Assets/Scripts/Save/MetadataUtils.cs +++ b/Assets/Scripts/Save/MetadataUtils.cs @@ -141,6 +141,27 @@ public static TiltModels75[] GetTiltModels(GroupIdMapping groupIdMapping) .OrderBy(ByModelLocation).ToArray(); } + public static TiltText[] GetTiltText(GroupIdMapping groupIdMapping) + { + return WidgetManager.m_Instance.TextWidgets.Where(x => x.gameObject.activeSelf).Select(x => ConvertTextWidgetToTiltText(x)).ToArray(); + + TiltText ConvertTextWidgetToTiltText(TextWidget widget) + { + TiltText text = new TiltText + { + Transform = widget.SaveTransform, + Text = widget.Text, + FillColor = widget.TextColor, + Pinned = widget.Pinned, + GroupId = groupIdMapping.GetId(widget.Group), + StrokeColor = widget.StrokeColor, + Font = "Oswald-Regular", // Not currently used + ExtrudeDepth = 0 // Not currently used + }; + return text; + } + } + public static TiltVideo[] GetTiltVideos(GroupIdMapping groupIdMapping) { return WidgetManager.m_Instance.VideoWidgets.Where(x => x.gameObject.activeSelf).Select(x => ConvertVideoToTiltVideo(x)).ToArray(); diff --git a/Assets/Scripts/Save/SaveLoadScript.cs b/Assets/Scripts/Save/SaveLoadScript.cs index d7f9c34cf0..51f98937b0 100644 --- a/Assets/Scripts/Save/SaveLoadScript.cs +++ b/Assets/Scripts/Save/SaveLoadScript.cs @@ -760,6 +760,10 @@ public bool Load(SceneFileInfo fileInfo, bool bAdditive = false) { WidgetManager.m_Instance.SetDataFromTilt(jsonData.Videos); } + if (jsonData.TextWidgets != null) + { + WidgetManager.m_Instance.SetDataFromTilt(jsonData.TextWidgets); + } } if (jsonData.Mirror != null) { diff --git a/Assets/Scripts/Save/SketchMetadata.cs b/Assets/Scripts/Save/SketchMetadata.cs index d4c1fc3e41..19909d0e46 100644 --- a/Assets/Scripts/Save/SketchMetadata.cs +++ b/Assets/Scripts/Save/SketchMetadata.cs @@ -656,6 +656,20 @@ public class Mirror public TrTransform Transform { get; set; } } + [Serializable] + public class TiltText + { + public TrTransform Transform { get; set; } + public string Text { get; set; } + public Color FillColor { get; set; } + public Color StrokeColor { get; set; } + public string Font { get; set; } + public float ExtrudeDepth { get; set; } + public bool Pinned { get; set; } + public uint GroupId { get; set; } + public int LayerId { get; set; } + } + [Serializable] public class TiltVideo { @@ -791,5 +805,8 @@ public TiltImages75b[] Images public string ApplicationName { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string ApplicationVersion { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public TiltText[] TextWidgets { get; set; } } } // namespace TiltBrush diff --git a/Assets/Scripts/WidgetManager.cs b/Assets/Scripts/WidgetManager.cs index 368bb38c61..8add2f4fae 100644 --- a/Assets/Scripts/WidgetManager.cs +++ b/Assets/Scripts/WidgetManager.cs @@ -726,6 +726,15 @@ public void SetDataFromTilt(CameraPathMetadata[] cameraPaths) } } + public void SetDataFromTilt(TiltText[] tiltText) + { + for (int i = 0; i < tiltText.Length; ++i) + { + TextWidget.FromTiltText(tiltText[i]); + } + } + + public void SetDataFromTilt(TiltVideo[] value) { m_loadingTiltVideos = value; @@ -984,6 +993,16 @@ public IEnumerable VideoWidgets } } + public IEnumerable TextWidgets + { + get + { + return m_TextWidgets + .Select(w => w == null ? null : w.WidgetScript) + .Where(w => w != null); + } + } + public IEnumerable NonExportableModelWidgets { get diff --git a/Assets/Scripts/Widgets/TextWidget.cs b/Assets/Scripts/Widgets/TextWidget.cs index 59fefcf2d0..ea7256c4c2 100644 --- a/Assets/Scripts/Widgets/TextWidget.cs +++ b/Assets/Scripts/Widgets/TextWidget.cs @@ -54,6 +54,12 @@ public Color TextColor set => m_TextMeshPro.color = value; } + public Color StrokeColor + { + get => m_TextMeshPro.outlineColor; + set => m_TextMeshPro.outlineColor = value; + } + public override GrabWidget Clone() { return Clone(transform.position, transform.rotation, m_Size); @@ -81,6 +87,32 @@ override public GrabWidget Clone(Vector3 position, Quaternion rotation, float si return clone; } + public static void FromTiltText(TiltText tiltText) + { + TextWidget textWidget = Instantiate(WidgetManager.m_Instance.TextWidgetPrefab); + textWidget.m_LoadingFromSketch = true; + textWidget.transform.parent = App.Instance.m_CanvasTransform; + textWidget.transform.localScale = Vector3.one; + + textWidget.Text = tiltText.Text; + textWidget.SetSignedWidgetSize(tiltText.Transform.scale); + textWidget.Show(bShow: true, bPlayAudio: false); + textWidget.transform.localPosition = tiltText.Transform.translation; + textWidget.transform.localRotation = tiltText.Transform.rotation; + if (tiltText.Pinned) + { + textWidget.PinFromSave(); + } + textWidget.TextColor = tiltText.FillColor; + textWidget.StrokeColor = tiltText.StrokeColor; + textWidget.Text = tiltText.Text; + textWidget.Group = App.GroupManager.GetGroupFromId(tiltText.GroupId); + textWidget.SetCanvas(App.Scene.GetOrCreateLayer(tiltText.LayerId)); + + TiltMeterScript.m_Instance.AdjustMeterWithWidget(textWidget.GetTiltMeterCost(), up: true); + textWidget.UpdateScale(); + } + public override string GetExportName() { return $"Text: {m_TextMeshPro.text}"; From 98e0f7a7e073ce5d389f4a6785e42cf66644f5d7 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Sat, 30 Sep 2023 16:00:10 +0100 Subject: [PATCH 06/12] Fix saving --- Assets/Scripts/Save/SketchSnapshot.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Scripts/Save/SketchSnapshot.cs b/Assets/Scripts/Save/SketchSnapshot.cs index 3276b8284e..179ce740c5 100644 --- a/Assets/Scripts/Save/SketchSnapshot.cs +++ b/Assets/Scripts/Save/SketchSnapshot.cs @@ -128,6 +128,7 @@ public SketchMetadata GetSketchMetadata() ModelIndex = MetadataUtils.GetTiltModels(m_GroupIdMapping), ImageIndex = MetadataUtils.GetTiltImages(m_GroupIdMapping), Videos = MetadataUtils.GetTiltVideos(m_GroupIdMapping), + TextWidgets = MetadataUtils.GetTiltText(m_GroupIdMapping), Mirror = PointerManager.m_Instance.SymmetryWidgetToMirror(), GuideIndex = MetadataUtils.GetGuideIndex(m_GroupIdMapping), Palette = CustomColorPaletteStorage.m_Instance.GetPaletteForSaving(), From 59628b47e23a5ab8bf3fbbdee356177dd9e0b44d Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Wed, 20 Dec 2023 10:40:30 +0000 Subject: [PATCH 07/12] dotnet-format --- Assets/Scripts/WidgetManager.cs | 2 +- Assets/Scripts/Widgets/TextWidget.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/WidgetManager.cs b/Assets/Scripts/WidgetManager.cs index 8add2f4fae..630d84cbbc 100644 --- a/Assets/Scripts/WidgetManager.cs +++ b/Assets/Scripts/WidgetManager.cs @@ -1256,7 +1256,7 @@ public GrabWidget GetNearestGrabWidget(Vector3 pos, float maxDepth, IEnumerable< } return bestWidget; } - + public ImageWidget GetNearestImage(Vector3 pos, float maxDepth, ref Vector3 sampleLoc) { ImageWidget bestImage = null; diff --git a/Assets/Scripts/Widgets/TextWidget.cs b/Assets/Scripts/Widgets/TextWidget.cs index ea7256c4c2..ceeadbe6e4 100644 --- a/Assets/Scripts/Widgets/TextWidget.cs +++ b/Assets/Scripts/Widgets/TextWidget.cs @@ -29,7 +29,7 @@ protected override void UpdateScale() base.UpdateScale(); UpdateCollider(); } - + public string Text { get => m_TextMeshPro.text; From 529c058e908363d23d1f43e67328b177d2b96655 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Wed, 20 Dec 2023 11:21:52 +0000 Subject: [PATCH 08/12] dotnet-format --- Assets/Scripts/API/ApiMethods.Utils.cs | 2 +- Assets/Scripts/API/ApiMethods.cs | 12 ++++++------ Assets/Scripts/Export/ExportCollector.cs | 16 ++++++++-------- Assets/Scripts/Export/ExportVrml.cs | 2 +- Assets/Scripts/Save/SketchMetadata.cs | 2 +- Assets/Scripts/Tools/TextTool.cs | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Assets/Scripts/API/ApiMethods.Utils.cs b/Assets/Scripts/API/ApiMethods.Utils.cs index 14278b3a0e..1709950031 100644 --- a/Assets/Scripts/API/ApiMethods.Utils.cs +++ b/Assets/Scripts/API/ApiMethods.Utils.cs @@ -127,7 +127,7 @@ private static ImageWidget _GetActiveImage(int index) index = _NegativeIndexing(index, WidgetManager.m_Instance.ActiveImageWidgets); return WidgetManager.m_Instance.ActiveImageWidgets[index].WidgetScript; } - + private static TextWidget _GetActiveTextWidget(int index) { index = _NegativeIndexing(index, WidgetManager.m_Instance.ActiveImageWidgets); diff --git a/Assets/Scripts/API/ApiMethods.cs b/Assets/Scripts/API/ApiMethods.cs index a75ee7af46..4907714138 100644 --- a/Assets/Scripts/API/ApiMethods.cs +++ b/Assets/Scripts/API/ApiMethods.cs @@ -357,7 +357,7 @@ private static ReferenceImage _LoadReferenceImage(string location) image.SynchronousLoad(); return image; } - + [ApiEndpoint("text.add", "Adds a text widget to the sketch")] public static void AddText(string text) { @@ -365,13 +365,13 @@ public static void AddText(string text) ApiManager.Instance.BrushPosition, ApiManager.Instance.BrushRotation ); - + var cmd = new CreateWidgetCommand( WidgetManager.m_Instance.TextWidgetPrefab, tr, null, true ); SketchMemoryScript.m_Instance.PerformAndRecordCommand(cmd); - + var textWidget = cmd.Widget as TextWidget; if (textWidget != null) { @@ -504,19 +504,19 @@ public static void PositionImage(int index, Vector3 position) { _PositionWidget(_GetActiveImage(index), position); } - + [ApiEndpoint("text.position", "Move a text widget to the given coordinates")] public static void PositionText(int index, Vector3 position) { _PositionWidget(_GetActiveTextWidget(index), position); } - + [ApiEndpoint("text.setText", "Changes the text on a text widget")] public static void ChangeTextContent(int index, string text) { _GetActiveTextWidget(index).Text = text; } - + [ApiEndpoint("text.setColor", "Changes the color on a text widget")] public static void ChangeTextColor(int index, Vector3 color) { diff --git a/Assets/Scripts/Export/ExportCollector.cs b/Assets/Scripts/Export/ExportCollector.cs index 2dcad1514c..2c37c22105 100644 --- a/Assets/Scripts/Export/ExportCollector.cs +++ b/Assets/Scripts/Export/ExportCollector.cs @@ -132,27 +132,27 @@ bool IsImageExportable(ImageWidget w) var textMesh = tw.m_TextMeshPro; var guid = MakeDeterministicUniqueName(kPbrTransparentGuid, tw, 0); string texturePath = $"{outputDirectory}/{guid}.png"; - + int width = Mathf.RoundToInt(textMesh.renderedWidth * 256); int height = Mathf.RoundToInt(textMesh.renderedHeight * 256); - + Camera tempCamera = new GameObject("TempCamera").AddComponent(); RenderTexture renderTexture = new RenderTexture(width, height, 24); tempCamera.targetTexture = renderTexture; - + // Adjust camera's position and rotation to capture the text mesh tempCamera.orthographic = true; tempCamera.orthographicSize = textMesh.renderedHeight; tempCamera.aspect = tw.AspectRatio.Value; tempCamera.transform.position = textMesh.transform.position + textMesh.transform.forward * -1; tempCamera.transform.forward = textMesh.transform.forward; - + // Set the camera's culling mask to only render the temp layer // int tmpLayer = LayerMask.NameToLayer("TempRenderTex"); var prevLayer = textMesh.gameObject.layer; // textMesh.gameObject.layer = tmpLayer; // tempCamera.cullingMask = 1 << tmpLayer; - + // Capture the image tempCamera.Render(); @@ -394,7 +394,7 @@ static Guid MakeDeterministicUniqueName(Guid descriptor, ReferenceImage ri, int { return GuidUtils.Uuid5(descriptor, string.Format("{0}_{1}", ri.FileFullPath, id)); } - + static Guid MakeDeterministicUniqueName(Guid descriptor, TextWidget tw, int id) { return GuidUtils.Uuid5(descriptor, string.Format("{0}_{1}", tw.Text, id)); @@ -414,7 +414,7 @@ static DynamicExportableMaterial CreateImageQuadMaterial(ReferenceImage ri) MetallicFactor = kRefimageMetallicFactor }; } - + static DynamicExportableMaterial CreateImageQuadMaterial(TextWidget tw, string path, Guid guid) { BrushDescriptor desc = BrushCatalog.m_Instance.GetBrush(kPbrTransparentGuid); @@ -494,7 +494,7 @@ static ImageQuadPayload BuildImageQuadPayload( exportableMaterial = material, }; } - + private static Mesh CreateQuad(float aspect) { float width = aspect / 2f; diff --git a/Assets/Scripts/Export/ExportVrml.cs b/Assets/Scripts/Export/ExportVrml.cs index 3a398b22b1..6b048d908d 100644 --- a/Assets/Scripts/Export/ExportVrml.cs +++ b/Assets/Scripts/Export/ExportVrml.cs @@ -48,7 +48,7 @@ public static class ExportVrml public static bool Export(string outputFile) { ExportUtils.SceneStatePayload payload = ExportCollector.GetExportPayload( - AxisConvention.kVrml, + AxisConvention.kVrml, outputDirectory: Path.GetDirectoryName(outputFile) ); diff --git a/Assets/Scripts/Save/SketchMetadata.cs b/Assets/Scripts/Save/SketchMetadata.cs index 19909d0e46..2366dcbd42 100644 --- a/Assets/Scripts/Save/SketchMetadata.cs +++ b/Assets/Scripts/Save/SketchMetadata.cs @@ -805,7 +805,7 @@ public TiltImages75b[] Images public string ApplicationName { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string ApplicationVersion { get; set; } - + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public TiltText[] TextWidgets { get; set; } } diff --git a/Assets/Scripts/Tools/TextTool.cs b/Assets/Scripts/Tools/TextTool.cs index 8006939747..a61a429751 100644 --- a/Assets/Scripts/Tools/TextTool.cs +++ b/Assets/Scripts/Tools/TextTool.cs @@ -51,7 +51,7 @@ float BoundsRadius override public void UpdateTool() { base.UpdateTool(); - + Transform rAttachPoint = InputManager.m_Instance.GetBrushControllerAttachPoint(); if (InputManager.m_Instance.GetCommandDown(InputManager.SketchCommands.Activate)) @@ -91,7 +91,7 @@ override public void UpdateTool() } PointerManager.m_Instance.SetMainPointerPosition(rAttachPoint.position); } - + override public void LateUpdateTool() { base.LateUpdateTool(); From db6c0f726755465e614d65acc7fb2b684df46dd6 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Wed, 28 Feb 2024 12:54:38 +0000 Subject: [PATCH 09/12] Fix l10n strings after merge --- .../Strings/Strings Shared Data.asset | 27 +++++++++++++++++++ .../Localization/Strings/Strings_en.asset | 4 +++ 2 files changed, 31 insertions(+) diff --git a/Assets/Settings/Localization/Strings/Strings Shared Data.asset b/Assets/Settings/Localization/Strings/Strings Shared Data.asset index 815df5e6fa..69ae30c4d3 100644 --- a/Assets/Settings/Localization/Strings/Strings Shared Data.asset +++ b/Assets/Settings/Localization/Strings/Strings Shared Data.asset @@ -3299,6 +3299,33 @@ MonoBehaviour: m_Key: POPUP_UPLOAD_COMPLETE_MOBILE_DESCRIPTION m_Metadata: m_Items: [] + - m_Id: 151470525216034816 + m_Key: KEYBOARD_PANEL_DESCRIPTION + m_Metadata: + m_Items: [] + m_EditorClassIdentifier: + m_Metadata: + m_Items: [] + - m_Id: 188791089062830080 + m_Key: ENVIRONMENT_PANEL_RESET_CANVAS + m_Metadata: + m_Items: [] + - m_Id: 188791266398003200 + m_Key: ENVIRONMENT_PANEL_LOCK_CANVAS + m_Metadata: + m_Items: [] + - m_Id: 188792931159203840 + m_Key: ENVIRONMENT_PANEL_UNLOCK_CANVAS + m_Metadata: + m_Items: [] + - m_Id: 189087250755706880 + m_Key: POPUP_UPLOAD_COMPLETE_MOBILE_DESCRIPTION + m_Metadata: + m_Items: [] + - m_Id: 151470525216034816 + m_Key: KEYBOARD_PANEL_DESCRIPTION + m_Metadata: + m_Items: [] m_Metadata: m_Items: [] m_KeyGenerator: diff --git a/Assets/Settings/Localization/Strings/Strings_en.asset b/Assets/Settings/Localization/Strings/Strings_en.asset index 5688bbf31b..b013770674 100644 --- a/Assets/Settings/Localization/Strings/Strings_en.asset +++ b/Assets/Settings/Localization/Strings/Strings_en.asset @@ -3493,6 +3493,10 @@ MonoBehaviour: m_Localized: Unlock Canvas Position m_Metadata: m_Items: [] + - m_Id: 151470525216034816 + m_Localized: "Enter text" + m_Metadata: + m_Items: [] references: version: 2 RefIds: [] From 3b053172bf5464618f1892f25588325be7f8415c Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Wed, 28 Feb 2024 12:56:16 +0000 Subject: [PATCH 10/12] Fix typo --- Assets/Scripts/GUI/KeyboardPopUpWindow.cs | 2 +- Assets/ThirdParty/UltimateXR Keyboard/KeyboardUI.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/GUI/KeyboardPopUpWindow.cs b/Assets/Scripts/GUI/KeyboardPopUpWindow.cs index 5297a6a5d0..db463b7af3 100644 --- a/Assets/Scripts/GUI/KeyboardPopUpWindow.cs +++ b/Assets/Scripts/GUI/KeyboardPopUpWindow.cs @@ -61,7 +61,7 @@ private void KeyPressed(object sender, KeyboardKeyEventArgs e) if (m_SanitizeFilename) { - m_KeyboardUI.SantizeFilename(); + m_KeyboardUI.SanitizeFilename(); } } } diff --git a/Assets/ThirdParty/UltimateXR Keyboard/KeyboardUI.cs b/Assets/ThirdParty/UltimateXR Keyboard/KeyboardUI.cs index c0fb7bb0fd..cf5b6cd0f0 100644 --- a/Assets/ThirdParty/UltimateXR Keyboard/KeyboardUI.cs +++ b/Assets/ThirdParty/UltimateXR Keyboard/KeyboardUI.cs @@ -113,7 +113,7 @@ public bool CapsLockEnabled /// public string ConsoleContent { get; private set; } - public void SantizeFilename() + public void SanitizeFilename() { string invalidChars = System.Text.RegularExpressions.Regex.Escape(new string(System.IO.Path.GetInvalidFileNameChars())); string invalidRegStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars); From 7a2f5b91df4a82b247585f517a7c4e1827f21938 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Sun, 5 May 2024 10:18:26 +0100 Subject: [PATCH 11/12] Update text api endpoints --- Assets/Scripts/API/ApiMethods.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/API/ApiMethods.cs b/Assets/Scripts/API/ApiMethods.cs index bc25f3902b..a1d7cfb51c 100644 --- a/Assets/Scripts/API/ApiMethods.cs +++ b/Assets/Scripts/API/ApiMethods.cs @@ -544,7 +544,19 @@ public static void RotateLight(int index, Vector3 rotation) [ApiEndpoint("text.position", "Move a text widget to the given coordinates")] public static void PositionText(int index, Vector3 position) { - _PositionWidget(_GetActiveTextWidget(index), position); + _SetWidgetPosition(_GetActiveTextWidget(index), position); + } + + [ApiEndpoint("text.rotation", "Set a text widget's rotation to the given angles")] + public static void RotateText(int index, Vector3 rotation) + { + _SetWidgetRotation(_GetActiveTextWidget(index), rotation); + } + + [ApiEndpoint("text.scale", "Set a text widget's scale")] + public static void ScaleText(int index, float scale) + { + _SetWidgetScale(_GetActiveTextWidget(index), scale); } [ApiEndpoint("text.setText", "Changes the text on a text widget")] From b4091e949c4f5252345d314c6029a6b65dd16314 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Sun, 5 May 2024 13:06:51 +0100 Subject: [PATCH 12/12] WIP changes --- .../Prefabs/Panels/AdvancedToolsPanel.prefab | 3 - Assets/Prefabs/Panels/KeyboardPanel.prefab | 1180 +++++++++++++++++ .../Prefabs/Panels/KeyboardPanel.prefab.meta | 7 + Assets/Scripts/GUI/BasePanel.cs | 1 + Assets/Scripts/GUI/KeyboardPanel.cs | 66 + Assets/Scripts/GUI/KeyboardPanel.cs.meta | 11 + Assets/Scripts/GUI/PanelManager.cs | 7 +- Assets/Scripts/GUI/TextToolButton.cs | 10 - Assets/Scripts/Tools/TextTool.cs | 5 +- Assets/Scripts/Widgets/TextWidget.cs | 3 +- 10 files changed, 1277 insertions(+), 16 deletions(-) create mode 100644 Assets/Prefabs/Panels/KeyboardPanel.prefab create mode 100644 Assets/Prefabs/Panels/KeyboardPanel.prefab.meta create mode 100644 Assets/Scripts/GUI/KeyboardPanel.cs create mode 100644 Assets/Scripts/GUI/KeyboardPanel.cs.meta diff --git a/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab b/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab index 3aae875043..f7ca05e81a 100644 --- a/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab +++ b/Assets/Prefabs/Panels/AdvancedToolsPanel.prefab @@ -814,9 +814,6 @@ MonoBehaviour: - m_PopUpPrefab: {fileID: 1887799951535888, guid: a600c48c5f105874e8e750977bb95d4b, type: 3} m_Command: 11500 - - m_PopUpPrefab: {fileID: 8644332587479430734, guid: bdb7d2ac05cca8346b210c2b576878cb, - type: 3} - m_Command: 12001 m_PanelDescription: ADVANCEDTOOLS_PANEL_DESCRIPTION m_LocalizedPanelDescription: m_TableReference: diff --git a/Assets/Prefabs/Panels/KeyboardPanel.prefab b/Assets/Prefabs/Panels/KeyboardPanel.prefab new file mode 100644 index 0000000000..8673fe221f --- /dev/null +++ b/Assets/Prefabs/Panels/KeyboardPanel.prefab @@ -0,0 +1,1180 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1027666980516482 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4159606566656768} + - component: {fileID: 65772034241514116} + m_Layer: 16 + m_Name: MeshCollider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4159606566656768 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1027666980516482} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4232412870837608} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!65 &65772034241514116 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1027666980516482} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 3.73, y: 2.11, z: 0.02} + m_Center: {x: 0, y: -0.0020278692, z: 0} +--- !u!1 &1077557619903986 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4223803146443412} + - component: {fileID: 33955959752836372} + - component: {fileID: 23947092074022216} + m_Layer: 16 + m_Name: _Bounds(inactive) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &4223803146443412 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1077557619903986} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 3.69, y: 2.26, z: 2.4} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4197185823870920} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &33955959752836372 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1077557619903986} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &23947092074022216 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1077557619903986} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 0 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1129504163572690 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4232412870837608} + m_Layer: 16 + m_Name: Mesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4232412870837608 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1129504163572690} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4159606566656768} + - {fileID: 3112100912687040387} + - {fileID: 3112100915314745213} + - {fileID: 5868215225218266869} + - {fileID: 8534043170305903825} + - {fileID: 3066725512322480512} + m_Father: {fileID: 4197185823870920} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1272310558547734 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4197185823870920} + - component: {fileID: 114137448250961176} + - component: {fileID: 114695644258670246} + - component: {fileID: 114306850044095870} + m_Layer: 16 + m_Name: KeyboardPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4197185823870920 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1272310558547734} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 11.681803, y: -0.47926903, z: 26.083145} + m_LocalScale: {x: 1.2, y: 1.2, z: 1.2} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4223803146443412} + - {fileID: 4322589350354290} + - {fileID: 4232412870837608} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 37.184097, y: 63.1294, z: 0} +--- !u!114 &114137448250961176 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1272310558547734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe417b0b17287b94fb1e98c8c6832b9d, type: 3} + m_Name: + m_EditorClassIdentifier: + m_PanelType: 5400 + m_Collider: {fileID: 5669076789858699262} + m_Mesh: {fileID: 1129504163572690} + m_Border: {fileID: 3129971866951249607} + m_MeshCollider: {fileID: 65772034241514116} + m_ParticleBounds: {x: 1.2, y: 0.8, z: 0} + m_PanelPopUpMap: [] + m_PanelDescription: KEYBOARD_PANEL_DESCRIPTION + m_LocalizedPanelDescription: + m_TableReference: + m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86 + m_TableEntryReference: + m_KeyId: 151470525216034816 + m_Key: + m_FallbackState: 0 + m_WaitForCompletion: 0 + m_LocalVariables: [] + m_PanelDescriptionPrefab: {fileID: 160918, guid: 3491f4f01ba6cac47b1633f36d7c6c84, + type: 3} + m_PanelDescriptionOffset: {x: 1.15, y: 0.6, z: 0} + m_PanelDescriptionColor: {r: 1, g: 1, b: 1, a: 1} + m_PanelFlairPrefab: {fileID: 0} + m_PanelFlairOffset: {x: 0, y: 0, z: 0} + m_DescriptionSpringK: 4 + m_DescriptionSpringDampen: 0.2 + m_DescriptionClosedAngle: -90 + m_DescriptionOpenAngle: 0 + m_DescriptionAlphaDistance: 90 + m_Decor: [] + m_GazeHighlightScaleMultiplier: 1.1 + m_BorderMeshWidth: 0.02 + m_BorderMeshAdvWidth: 0.01 + m_PanelSensitivity: 0.1 + m_ClampToBounds: 1 + m_ReticleBounds: {x: 1.35, y: 1.9, z: 0} + m_BorderSphereHighlightRadius: 2.5 + m_PositioningSpheresBounds: {x: 1, y: 1} + m_PositioningSphereRadius: 0.4 + m_UseGazeRotation: 1 + m_MaxGazeRotation: 20 + m_GazeActivateSpeed: 8 + m_InitialSpawnPos: {x: 8, y: 14, z: 5.34} + m_InitialSpawnRotEulers: {x: 37.18, y: 63.12, z: 0} + m_WandAttachAngle: 240 + m_WandAttachYOffset: -0.6 + m_WandAttachHalfHeight: 0.6 + m_BeginFixed: 0 + m_CanBeFixedToWand: 0 + m_CanBeDetachedFromWand: 0 + m_PopUpGazeDuration: 0.2 + m_PromoBorders: + - {fileID: 3129971866951249607} + m_SanitizeFilename: 0 + references: + version: 2 + RefIds: [] +--- !u!114 &114695644258670246 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1272310558547734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6311d8a25dba6a443be8afe87803c545, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowDuration: 0.25 + m_GrabDistance: 1.4 + m_CollisionRadius: 0.8 + m_AllowTwoHandGrab: 0 + m_DestroyOnHide: 0 + m_AllowHideWithToss: 1 + m_DisableDrift: 0 + m_RecordMovements: 0 + m_AllowSnapping: 0 + m_SnapDisabledDelay: 0.2 + m_AllowPinning: 0 + m_AllowDormancy: 1 + m_TossDuration: 0 + m_TintableMeshes: + - {fileID: 3129971866951249607} + m_SpawnPlacementOffset: {x: 3.5, y: 0, z: 1.5} + m_IntroAnimSpinAmount: 360 + m_BoxCollider: {fileID: 5669076789858699262} + m_Mesh: {fileID: 4197185823870920} + m_HighlightMeshXfs: + - {fileID: 5868215225218266869} + m_ValidSnapRotationStickyAngle: 0 + m_SnapGhostMaterial: {fileID: 0} + m_Border: {fileID: 3112100915314745213} + m_GrabFixedMaxFacingAngle: 70 +--- !u!114 &114306850044095870 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1272310558547734} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 739d5b1996234d64992a2ae60c3723e9, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1406911291435214 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4322589350354290} + - component: {fileID: 5669076789858699262} + m_Layer: 16 + m_Name: Collider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4322589350354290 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1406911291435214} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4197185823870920} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!65 &5669076789858699262 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1406911291435214} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 3.77, y: 2.28, z: 0.01} + m_Center: {x: 0, y: 0, z: -0.01} +--- !u!1 &754463336429302764 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4279202952451910568} + - component: {fileID: 3928791201640712769} + - component: {fileID: 3373334784687721890} + m_Layer: 16 + m_Name: Mesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4279202952451910568 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 754463336429302764} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.65, y: 0.65, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3066725512322480512} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3928791201640712769 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 754463336429302764} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &3373334784687721890 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 754463336429302764} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 0d7eb02b18ffb4c419fb75924cb900dc, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &2368666109973548068 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5868215225218266869} + - component: {fileID: 2711234215798759003} + m_Layer: 16 + m_Name: HighlightMesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5868215225218266869 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2368666109973548068} + m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 150, y: 150, z: 150} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4232412870837608} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!33 &2711234215798759003 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2368666109973548068} + m_Mesh: {fileID: 4300002, guid: 3efe5b86b55995545a231ce66a53b402, type: 3} +--- !u!1 &3043647719914574414 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3066725512322480512} + - component: {fileID: 8316971817601708650} + - component: {fileID: 1835225137940551866} + - component: {fileID: 8159777670046732871} + - component: {fileID: 7346641792813494307} + m_Layer: 16 + m_Name: Button_ClosePanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3066725512322480512 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3043647719914574414} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 1.8765004, y: -1.1, z: -0.027000109} + m_LocalScale: {x: 0.45000002, y: 0.45000002, z: 0.45000002} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4279202952451910568} + - {fileID: 4347623921554382463} + m_Father: {fileID: 4232412870837608} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &8316971817601708650 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3043647719914574414} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &1835225137940551866 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3043647719914574414} + m_Enabled: 0 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 3c8ca511828182747a0b79564892ec57, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &8159777670046732871 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3043647719914574414} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1.0000001, y: 1, z: 0.01} + m_Center: {x: 0, y: 0, z: -0.01} +--- !u!114 &7346641792813494307 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3043647719914574414} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dbae3ff4457df6f4ea3af0389871cb9c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_DescriptionType: 0 + m_DescriptionYOffset: 0 + m_DescriptionText: Close + m_LocalizedDescription: + m_TableReference: + m_TableCollectionName: + m_TableEntryReference: + m_KeyId: 0 + m_Key: + m_FallbackState: 0 + m_WaitForCompletion: 0 + m_LocalVariables: [] + m_DescriptionTextExtra: + m_LocalizedDescriptionExtra: + m_TableReference: + m_TableCollectionName: + m_TableEntryReference: + m_KeyId: 0 + m_Key: + m_FallbackState: 0 + m_WaitForCompletion: 0 + m_LocalVariables: [] + m_DescriptionActivateSpeed: 12 + m_DescriptionZScale: 1 + m_ButtonTexture: {fileID: 0} + m_AtlasTexture: 1 + m_ToggleButton: 0 + m_LongPressReleaseButton: 0 + m_ButtonHasPressedAudio: 1 + m_ZAdjustHover: -0.02 + m_ZAdjustClick: 0.03 + m_HoverScale: 1.1 + m_HoverBoxColliderGrow: 0.2 + m_AddOverlay: 0 + m_SelectionTexture: {fileID: 0} + m_ButtonType: 3 + m_GotoPage: 0 + m_InactiveColor: {r: 0, g: 0, b: 0, a: 0} + references: + version: 2 + RefIds: [] +--- !u!1 &3115891941519918011 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3112100912687040387} + - component: {fileID: 3119710182113228969} + - component: {fileID: 3129971865628673197} + m_Layer: 16 + m_Name: PopupBg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3112100912687040387 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3115891941519918011} + m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 150, y: 150, z: 150} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4232412870837608} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!33 &3119710182113228969 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3115891941519918011} + m_Mesh: {fileID: 4300002, guid: 3efe5b86b55995545a231ce66a53b402, type: 3} +--- !u!23 &3129971865628673197 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3115891941519918011} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: db0305ff9081c3b448ac79e85d26e5d4, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &3115891942638002001 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3112100915314745213} + - component: {fileID: 3119710181549167069} + - component: {fileID: 3129971866951249607} + m_Layer: 16 + m_Name: Border + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3112100915314745213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3115891942638002001} + m_LocalRotation: {x: -0.7071068, y: -0, z: -0, w: 0.7071067} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 150, y: 150, z: 150} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4232412870837608} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3119710181549167069 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3115891942638002001} + m_Mesh: {fileID: 4300000, guid: 3efe5b86b55995545a231ce66a53b402, type: 3} +--- !u!23 &3129971866951249607 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3115891942638002001} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 77dd4ff8b1158a84397aba783cd0af05, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &8397375704647155074 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4347623921554382463} + - component: {fileID: 8929379519300781800} + - component: {fileID: 4293909911532176797} + m_Layer: 16 + m_Name: MeshBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4347623921554382463 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8397375704647155074} + m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0.025} + m_LocalScale: {x: 0.79999995, y: 0.02, z: 0.8} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3066725512322480512} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!33 &8929379519300781800 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8397375704647155074} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &4293909911532176797 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8397375704647155074} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 77dd4ff8b1158a84397aba783cd0af05, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1001 &8463054664953308031 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 4232412870837608} + m_Modifications: + - target: {fileID: 1934243545717122, guid: ef7eb6dda2db50c4bbf6c682e4a21736, type: 3} + propertyPath: m_Name + value: Keyboard + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_SizeDelta.x + value: 2700 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_SizeDelta.y + value: 1080 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalScale.x + value: 0.00135 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalScale.y + value: 0.00135 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalScale.z + value: 0.00135 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalPosition.z + value: -0.014999707 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5277493517320569316, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493517320569316, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493517320569316, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493517390459847, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493517390459847, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493517390459847, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493517766971825, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493517766971825, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493517766971825, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493517836040783, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493517836040783, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493517836040783, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493518090577653, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493518090577653, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493518090577653, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493518340769154, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493518340769154, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493518340769154, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493518477428480, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493518477428480, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493518477428480, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493518960887007, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493518960887007, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493518960887007, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493519053288274, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493519053288274, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493519053288274, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + - target: {fileID: 5277493519190116170, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} + - target: {fileID: 5277493519190116170, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontSize + value: 36 + objectReference: {fileID: 0} + - target: {fileID: 5277493519190116170, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + propertyPath: m_fontColor32.rgba + value: 4294770430 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ef7eb6dda2db50c4bbf6c682e4a21736, type: 3} +--- !u!224 &8534043170305903825 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 224560323429904302, guid: ef7eb6dda2db50c4bbf6c682e4a21736, + type: 3} + m_PrefabInstance: {fileID: 8463054664953308031} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Panels/KeyboardPanel.prefab.meta b/Assets/Prefabs/Panels/KeyboardPanel.prefab.meta new file mode 100644 index 0000000000..438bffeee0 --- /dev/null +++ b/Assets/Prefabs/Panels/KeyboardPanel.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d9f060dc4293beb41b61fb3de19fffae +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GUI/BasePanel.cs b/Assets/Scripts/GUI/BasePanel.cs index 5868bc41c7..f9e6561427 100644 --- a/Assets/Scripts/GUI/BasePanel.cs +++ b/Assets/Scripts/GUI/BasePanel.cs @@ -107,6 +107,7 @@ public enum PanelType CameraPath, BrushLab, WebcamPanel = 5200, + Keyboard = 5400, Scripts = 6000, SnapSettings = 8000, StencilSettings = 20200, diff --git a/Assets/Scripts/GUI/KeyboardPanel.cs b/Assets/Scripts/GUI/KeyboardPanel.cs new file mode 100644 index 0000000000..e10a364f81 --- /dev/null +++ b/Assets/Scripts/GUI/KeyboardPanel.cs @@ -0,0 +1,66 @@ +// Copyright 2023 The Open Brush Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Localization; +using TMPro; + +namespace TiltBrush +{ + public class KeyboardPanel : BasePanel + { + private KeyboardUI m_KeyboardUI; + [NonSerialized] public static string m_InitialText; + [NonSerialized] public static string m_LastInput; + [NonSerialized] public Action m_OnClose; + + public bool m_SanitizeFilename; + + protected override void Awake() + { + base.Awake(); + m_KeyboardUI = GetComponentInChildren(); + m_KeyboardUI.KeyPressed += KeyPressed; + m_KeyboardUI.AddConsoleContent(m_InitialText); + m_LastInput = m_InitialText; + } + + private void OnDestroy() + { + m_OnClose?.Invoke(this); + m_KeyboardUI.KeyPressed -= KeyPressed; + } + + private void KeyPressed(object sender, KeyboardKeyEventArgs e) + { + switch (e.Key.KeyType) + { + case KeyboardKeyType.Enter: + // Logic will been to be updated if we ever have a multi-line keyboard + m_LastInput = m_KeyboardUI.ConsoleContent; + PanelManager.m_Instance.DismissNonCorePanel(PanelType.Keyboard); + SketchControlsScript.m_Instance.EatGazeObjectInput(); + break; + } + + if (m_SanitizeFilename) + { + m_KeyboardUI.SanitizeFilename(); + } + } + + } +} // namespace TiltBrush diff --git a/Assets/Scripts/GUI/KeyboardPanel.cs.meta b/Assets/Scripts/GUI/KeyboardPanel.cs.meta new file mode 100644 index 0000000000..d93f98cd0a --- /dev/null +++ b/Assets/Scripts/GUI/KeyboardPanel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe417b0b17287b94fb1e98c8c6832b9d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GUI/PanelManager.cs b/Assets/Scripts/GUI/PanelManager.cs index 7bcea47238..e7675508e5 100644 --- a/Assets/Scripts/GUI/PanelManager.cs +++ b/Assets/Scripts/GUI/PanelManager.cs @@ -2323,8 +2323,9 @@ public bool IsAffectedByCollision(PanelData data) data.m_Widget.gameObject.activeSelf && data.m_Widget.IsAvailable(); } - public void OpenPanel(BasePanel.PanelType type, TrTransform trSpawnXf) + public BasePanel OpenPanel(BasePanel.PanelType type, TrTransform trSpawnXf) { + var openedPanels = new List(); if ((type != BasePanel.PanelType.SketchSurface && type != BasePanel.PanelType.Color && type != BasePanel.PanelType.Brush)) @@ -2353,10 +2354,14 @@ public void OpenPanel(BasePanel.PanelType type, TrTransform trSpawnXf) } PrimeCollisionSimForWidgets(m_AllPanels[i].m_Widget); + openedPanels.Add(m_AllPanels[i].m_Panel); } } } } + // Would we ever open multiple panels of the same type? + // I am assuming not at this stage + return openedPanels.FirstOrDefault(); } public bool IsPanelOpen(BasePanel.PanelType type) diff --git a/Assets/Scripts/GUI/TextToolButton.cs b/Assets/Scripts/GUI/TextToolButton.cs index 84421d10df..70354fb4f5 100644 --- a/Assets/Scripts/GUI/TextToolButton.cs +++ b/Assets/Scripts/GUI/TextToolButton.cs @@ -19,15 +19,5 @@ namespace TiltBrush public class TextToolButton : ToolButton { - override protected void OnButtonPressed() - { - base.OnButtonPressed(); - BasePanel panel = m_Manager.GetPanelForPopUps(); - panel.CreatePopUp(SketchControlsScript.GlobalCommands.OpenTextInputPopup, -1, -1, "Hello"); - // panel.PanelPopUp.m_OnClose += () => - // { - // TextTool.m_CurrentWidget.Text = KeyboardPopUpWindow.m_LastInput; - // }; - } } } // namespace TiltBrush diff --git a/Assets/Scripts/Tools/TextTool.cs b/Assets/Scripts/Tools/TextTool.cs index a61a429751..c9542a5e3d 100644 --- a/Assets/Scripts/Tools/TextTool.cs +++ b/Assets/Scripts/Tools/TextTool.cs @@ -74,6 +74,7 @@ override public void UpdateTool() if (textWidget != null) { textWidget.Text = "Text Widget"; + textWidget.TextColor = PointerManager.m_Instance.PointerColor; textWidget.Show(true); cmd.SetWidgetCost(textWidget.GetTiltMeterCost()); } @@ -83,11 +84,13 @@ override public void UpdateTool() SelectionManager.m_Instance.RemoveFromSelection(false); AudioManager.m_Instance.ShowHideWidget(true, transform.position); m_CurrentWidget = textWidget; + var panel = (KeyboardPanel)PanelManager.m_Instance.OpenPanel(BasePanel.PanelType.Keyboard, tr); + panel.m_OnClose = _ => textWidget.Text = KeyboardPanel.m_LastInput; } } if (m_CurrentWidget != null) { - m_CurrentWidget.Text = KeyboardPopUpWindow.m_LastInput; + m_CurrentWidget.Text = KeyboardPanel.m_LastInput; } PointerManager.m_Instance.SetMainPointerPosition(rAttachPoint.position); } diff --git a/Assets/Scripts/Widgets/TextWidget.cs b/Assets/Scripts/Widgets/TextWidget.cs index ceeadbe6e4..53df80a8e2 100644 --- a/Assets/Scripts/Widgets/TextWidget.cs +++ b/Assets/Scripts/Widgets/TextWidget.cs @@ -45,7 +45,8 @@ private void UpdateCollider() m_TextMeshPro.ForceMeshUpdate(); var size = m_TextMeshPro.GetRenderedValues(true); // No idea why the 1.3 and 0.9 is necessary, but it is. - m_BoxCollider.transform.localScale = new Vector3(size.x * 1.3f, size.y * 0.9f, m_BoxCollider.transform.localScale.z); + // m_BoxCollider.transform.localScale = new Vector3(size.x * 1.3f, size.y * 0.9f, m_BoxCollider.transform.localScale.z); + m_BoxCollider.transform.localScale = new Vector3(size.x, size.y, m_BoxCollider.transform.localScale.z); } public Color TextColor