コード例 #1
0
ファイル: MeshSyncMenu.cs プロジェクト: FrogsInSpace/MeshSync
        static void LiveEditInBlender()
        {
            var selectedAsset = Selection.objects[0];

            var servers = UnityEngine.Object.FindObjectsOfType <MeshSyncServer>();

            MeshSyncServer server = null;

            foreach (var serverInScene in servers)
            {
                if (serverInScene.enabled)
                {
                    server = serverInScene;
                    break;
                }
            }

            if (server == null)
            {
                server = CreateMeshSyncServerMenu(null);
            }

            server.DCCAsset = selectedAsset;

            MeshSyncServerInspectorUtils.OpenDCCAsset(server);
        }
コード例 #2
0
        static void DrawDCCToolInfo(MeshSyncServer server)
        {
            if (server != null)
            {
                GUILayout.BeginHorizontal();

                var newAsset = EditorGUILayout.ObjectField("DCC asset file:",
                                                           server.DCCAsset,
                                                           typeof(UnityEngine.Object), true);

                if (newAsset != server.DCCAsset)
                {
                    server.DCCAsset     = newAsset;
                    server.m_DCCInterop = MeshSyncServerInspectorUtils.GetLauncherForAsset(server.DCCAsset);
                }

                if (server.DCCAsset != null)
                {
                    if (GUILayout.Button("Live Edit"))
                    {
                        GUILayout.EndHorizontal();
                        MeshSyncServerInspectorUtils.OpenDCCAsset(server);
                        return;
                    }
                }

                GUILayout.EndHorizontal();

                if (server.m_DCCInterop == null)
                {
                    server.m_DCCInterop = MeshSyncServerInspectorUtils.GetLauncherForAsset(server.DCCAsset);
                }

                server.m_DCCInterop?.DrawDCCMenu(server);
            }
        }