{"action":"opened","number":158,"pull_request":{"url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/158","id":35733068,"html_url":"https://github.com/helix-toolkit/helix-toolkit/pull/158","diff_url":"https://github.com/helix-toolkit/helix-toolkit/pull/158.diff","patch_url":"https://github.com/helix-toolkit/helix-toolkit/pull/158.patch","issue_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/issues/158","number":158,"state":"open","locked":false,"title":"Allow model to be loaded on different thread","user":{"login":"garyjohnson","id":1094704,"avatar_url":"https://avatars.githubusercontent.com/u/1094704?v=3","gravatar_id":"","url":"https://api.github.com/users/garyjohnson","html_url":"https://github.com/garyjohnson","followers_url":"https://api.github.com/users/garyjohnson/followers","following_url":"https://api.github.com/users/garyjohnson/following{/other_user}","gists_url":"https://api.github.com/users/garyjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/garyjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyjohnson/subscriptions","organizations_url":"https://api.github.com/users/garyjohnson/orgs","repos_url":"https://api.github.com/users/garyjohnson/repos","events_url":"https://api.github.com/users/garyjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/garyjohnson/received_events","type":"User","site_admin":false},"body":"It was important for me to be able to load models on non-UI threads. The main blocker on that was Material / PhongMaterial being DependencyObjects and having thread affinity. I believe I was able to accomplish the same thing by implementing INotifyPropertyChanged in chose classes instead. I couldn't find anything that specifically relied on Material being a DependencyObject.\r\n\r\nWith this change I am now able to run ObjReader.Read on another thread and dispatch the results back to the UI thread. Excuse the ugly code:\r\n\r\n```\r\nvar thread = new Thread(modelPath => {\r\n    var objReader = new ObjReader();\r\n    var loadedObjects = objReader.Read((string)modelPath);\r\n\r\n    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action<object> (object3Ds => {\r\n        foreach (var obj3D in (IEnumerable<Object3D>) object3Ds) {\r\n            var mesh = new MeshGeometryModel3D {\r\n                Name = obj3D.Name,\r\n                Geometry = obj3D.Geometry,\r\n                Material = obj3D.Material,\r\n                Transform = ConvertMatrixTransform(obj3D.Transform)\r\n            };\r\n            Models.Add(mesh);\r\n        }\r\n    }), loadedObjects);\r\n\r\n});\r\nthread.SetApartmentState(ApartmentState.STA);\r\nthread.Start(@\"C:\\test.obj\");\r\n```","created_at":"2015-05-19T14:01:30Z","updated_at":"2015-05-19T14:01:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/158/commits","review_comments_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/158/comments","review_comment_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/issues/158/comments","statuses_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/statuses/4cd2f9645dbb24dfae45788c1b9670cef78045c8","head":{"label":"leandog:material_across_threads","ref":"material_across_threads","sha":"4cd2f9645dbb24dfae45788c1b9670cef78045c8","user":{"login":"leandog","id":387604,"avatar_url":"https://avatars.githubusercontent.com/u/387604?v=3","gravatar_id":"","url":"https://api.github.com/users/leandog","html_url":"https://github.com/leandog","followers_url":"https://api.github.com/users/leandog/followers","following_url":"https://api.github.com/users/leandog/following{/other_user}","gists_url":"https://api.github.com/users/leandog/gists{/gist_id}","starred_url":"https://api.github.com/users/leandog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leandog/subscriptions","organizations_url":"https://api.github.com/users/leandog/orgs","repos_url":"https://api.github.com/users/leandog/repos","events_url":"https://api.github.com/users/leandog/events{/privacy}","received_events_url":"https://api.github.com/users/leandog/received_events","type":"Organization","site_admin":false},"repo":{"id":34682993,"name":"helix-toolkit","full_name":"leandog/helix-toolkit","owner":{"login":"leandog","id":387604,"avatar_url":"https://avatars.githubusercontent.com/u/387604?v=3","gravatar_id":"","url":"https://api.github.com/users/leandog","html_url":"https://github.com/leandog","followers_url":"https://api.github.com/users/leandog/followers","following_url":"https://api.github.com/users/leandog/following{/other_user}","gists_url":"https://api.github.com/users/leandog/gists{/gist_id}","starred_url":"https://api.github.com/users/leandog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leandog/subscriptions","organizations_url":"https://api.github.com/users/leandog/orgs","repos_url":"https://api.github.com/users/leandog/repos","events_url":"https://api.github.com/users/leandog/events{/privacy}","received_events_url":"https://api.github.com/users/leandog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/leandog/helix-toolkit","description":"","fork":true,"url":"https://api.github.com/repos/leandog/helix-toolkit","forks_url":"https://api.github.com/repos/leandog/helix-toolkit/forks","keys_url":"https://api.github.com/repos/leandog/helix-toolkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leandog/helix-toolkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leandog/helix-toolkit/teams","hooks_url":"https://api.github.com/repos/leandog/helix-toolkit/hooks","issue_events_url":"https://api.github.com/repos/leandog/helix-toolkit/issues/events{/number}","events_url":"https://api.github.com/repos/leandog/helix-toolkit/events","assignees_url":"https://api.github.com/repos/leandog/helix-toolkit/assignees{/user}","branches_url":"https://api.github.com/repos/leandog/helix-toolkit/branches{/branch}","tags_url":"https://api.github.com/repos/leandog/helix-toolkit/tags","blobs_url":"https://api.github.com/repos/leandog/helix-toolkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leandog/helix-toolkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leandog/helix-toolkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/leandog/helix-toolkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leandog/helix-toolkit/statuses/{sha}","languages_url":"https://api.github.com/repos/leandog/helix-toolkit/languages","stargazers_url":"https://api.github.com/repos/leandog/helix-toolkit/stargazers","contributors_url":"https://api.github.com/repos/leandog/helix-toolkit/contributors","subscribers_url":"https://api.github.com/repos/leandog/helix-toolkit/subscribers","subscription_url":"https://api.github.com/repos/leandog/helix-toolkit/subscription","commits_url":"https://api.github.com/repos/leandog/helix-toolkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/leandog/helix-toolkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/leandog/helix-toolkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/leandog/helix-toolkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/leandog/helix-toolkit/contents/{+path}","compare_url":"https://api.github.com/repos/leandog/helix-toolkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leandog/helix-toolkit/merges","archive_url":"https://api.github.com/repos/leandog/helix-toolkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leandog/helix-toolkit/downloads","issues_url":"https://api.github.com/repos/leandog/helix-toolkit/issues{/number}","pulls_url":"https://api.github.com/repos/leandog/helix-toolkit/pulls{/number}","milestones_url":"https://api.github.com/repos/leandog/helix-toolkit/milestones{/number}","notifications_url":"https://api.github.com/repos/leandog/helix-toolkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leandog/helix-toolkit/labels{/name}","releases_url":"https://api.github.com/repos/leandog/helix-toolkit/releases{/id}","created_at":"2015-04-27T18:15:51Z","updated_at":"2015-04-28T15:34:05Z","pushed_at":"2015-05-19T13:17:56Z","git_url":"git://github.com/leandog/helix-toolkit.git","ssh_url":"git@github.com:leandog/helix-toolkit.git","clone_url":"https://github.com/leandog/helix-toolkit.git","svn_url":"https://github.com/leandog/helix-toolkit","homepage":null,"size":30663,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"helix-toolkit:master","ref":"master","sha":"fc1ed36bd706665f7cca7b8fb865e75596963502","user":{"login":"helix-toolkit","id":8432523,"avatar_url":"https://avatars.githubusercontent.com/u/8432523?v=3","gravatar_id":"","url":"https://api.github.com/users/helix-toolkit","html_url":"https://github.com/helix-toolkit","followers_url":"https://api.github.com/users/helix-toolkit/followers","following_url":"https://api.github.com/users/helix-toolkit/following{/other_user}","gists_url":"https://api.github.com/users/helix-toolkit/gists{/gist_id}","starred_url":"https://api.github.com/users/helix-toolkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helix-toolkit/subscriptions","organizations_url":"https://api.github.com/users/helix-toolkit/orgs","repos_url":"https://api.github.com/users/helix-toolkit/repos","events_url":"https://api.github.com/users/helix-toolkit/events{/privacy}","received_events_url":"https://api.github.com/users/helix-toolkit/received_events","type":"Organization","site_admin":false},"repo":{"id":23380867,"name":"helix-toolkit","full_name":"helix-toolkit/helix-toolkit","owner":{"login":"helix-toolkit","id":8432523,"avatar_url":"https://avatars.githubusercontent.com/u/8432523?v=3","gravatar_id":"","url":"https://api.github.com/users/helix-toolkit","html_url":"https://github.com/helix-toolkit","followers_url":"https://api.github.com/users/helix-toolkit/followers","following_url":"https://api.github.com/users/helix-toolkit/following{/other_user}","gists_url":"https://api.github.com/users/helix-toolkit/gists{/gist_id}","starred_url":"https://api.github.com/users/helix-toolkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helix-toolkit/subscriptions","organizations_url":"https://api.github.com/users/helix-toolkit/orgs","repos_url":"https://api.github.com/users/helix-toolkit/repos","events_url":"https://api.github.com/users/helix-toolkit/events{/privacy}","received_events_url":"https://api.github.com/users/helix-toolkit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/helix-toolkit/helix-toolkit","description":"","fork":false,"url":"https://api.github.com/repos/helix-toolkit/helix-toolkit","forks_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/forks","keys_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/teams","hooks_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/hooks","issue_events_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/issues/events{/number}","events_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/events","assignees_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/assignees{/user}","branches_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/branches{/branch}","tags_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/tags","blobs_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/statuses/{sha}","languages_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/languages","stargazers_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/stargazers","contributors_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/contributors","subscribers_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/subscribers","subscription_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/subscription","commits_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/contents/{+path}","compare_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/merges","archive_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/downloads","issues_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/issues{/number}","pulls_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls{/number}","milestones_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/milestones{/number}","notifications_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/labels{/name}","releases_url":"https://api.github.com/repos/helix-toolkit/helix-toolkit/releases{/id}","created_at":"2014-08-27T07:28:47Z","updated_at":"2015-05-18T07:24:05Z","pushed_at":"2015-05-19T09:57:44Z","git_url":"git://github.com/helix-toolkit/helix-toolkit.git","ssh_url":"git@github.com:helix-toolkit/helix-toolkit.git","clone_url":"https://github.com/helix-toolkit/helix-toolkit.git","svn_url":"https://github.com/helix-toolkit/helix-toolkit","homepage":null,"size":32036,"stargazers_count":104,"watchers_count":104,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":63,"mirror_url":null,"open_issues_count":80,"forks":63,"open_issues":80,"watchers":104,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/158"},"html":{"href":"https://github.com/helix-toolkit/helix-toolkit/pull/158"},"issue":{"href":"https://api.github.com/repos/helix-toolkit/helix-toolkit/issues/158"},"comments":{"href":"https://api.github.com/repos/helix-toolkit/helix-toolkit/issues/158/comments"},"review_comments":{"href":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/158/comments"},"review_comment":{"href":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/helix-toolkit/helix-toolkit/pulls/158/commits"},"statuses":{"href":"https://api.github.com/repos/helix-toolkit/helix-toolkit/statuses/4cd2f9645dbb24dfae45788c1b9670cef78045c8"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":84,"deletions":83,"changed_files":2}}