66 Commits

Author SHA1 Message Date
Claire Kuang 82555b7307 Merge pull request #99 from specklesystems/clairekuang-patch-1
Update README.md
2024-11-01 18:31:15 +00:00
Claire Kuang 44c0b46080 Update README.md 2024-11-01 18:31:00 +00:00
Claire Kuang d2981b7b69 Merge pull request #98 from specklesystems/claire/cnx-699-update-github-links-to-point-to-v3
Update README.md to align with main github page
2024-11-01 18:29:44 +00:00
Claire Kuang 7b3e2b31bb Update README.md to align with main github page 2024-11-01 18:29:11 +00:00
Alan Rynne 719fe8d8d5 fix(CXPLA-100): use v1 for tag links (#97) 2024-10-11 17:42:24 +02:00
Iain Sproat 1906d2b4c5 chore(domains): update latest.speckle.dev to latest.speckle.systems (#95) 2024-07-18 17:23:51 +02:00
Jedd Morgan bf54d78024 Fix build (#94) 2024-05-09 16:54:46 +01:00
Jedd Morgan c783fc6f75 Update README.md (#93) 2024-05-09 15:32:21 +01:00
Jedd Morgan 3848791e4e Added support for Unreal 5.4 (#92)
* Bump to 2.19.0

* Bumped uplugin and added 5.4

* Added 5.4 to CI
2024-05-08 14:34:58 +01:00
Jedd Morgan baa57b83fb changed default server to app.speckle.systems (#91) 2024-05-08 14:34:46 +01:00
Jedd Morgan 87e5281a5e Merge pull request #90 from specklesystems/CNX-9353-Add-support-for-Unreal-5.4
Fixed warning for UE5.4 - converted string literals to  TEXT macro
2024-05-08 14:34:34 +01:00
Jedd Morgan 54a6c8bdb6 Added text macro to all string literals 2024-05-07 22:52:14 +01:00
Jedd Morgan cb236ad0c7 Merge pull request #89 from specklesystems/JR-Morgan-patch-1
Update README.md
2023-09-12 19:40:39 +01:00
Jedd Morgan e76b50a157 Update README.md 2023-09-12 19:40:28 +01:00
Jedd Morgan c91f5e12ce Merge pull request #88 from specklesystems/jrm/5.3
Added marketplace build ci for UE 5.3
2023-09-12 19:25:01 +01:00
Jedd Morgan fd71dd41ca Added 5.3 ci 2023-09-12 19:21:10 +01:00
Jedd Morgan caa56039e7 Merge pull request #87 from specklesystems/jrm/converter/collections
Support for receiving Collections and various other Bug fixes
2023-08-31 20:29:15 +01:00
Jedd Morgan c1f5476f77 Resolved warning with uninitialized struct members 2023-08-30 23:15:37 +01:00
Jedd Morgan 3c55f31a58 Removed baking mesh transforms from deserialization process 2023-08-30 22:49:43 +01:00
Jedd Morgan fce06cba20 Fixed build issue with UE5.3 Preview 1 2023-08-30 21:38:42 +01:00
Jedd Morgan 2b6ab16b22 Removed EditCondition for Branch and Commit selection 2023-08-30 20:34:20 +01:00
Jedd Morgan a60d4fef56 Added support for receiving collections 2023-08-30 18:33:36 +01:00
Jedd Morgan 6aa4afbd84 Merge pull request #86 from specklesystems/jrm/blueprint-type-fix
fix(bp): exposed SpeckleConverter as a BP type
2023-07-18 23:32:43 +01:00
Jedd Morgan b5f465e1a3 fix(bp): exposed SpeckleConverter as a BP type 2023-07-18 23:31:47 +01:00
Jedd Morgan 80b7cd886a Merge pull request #85 from specklesystems/no-bom
Removed BOM headers from files
2023-07-06 21:21:34 +01:00
Jedd Morgan f57ee4658e Merge remote-tracking branch 'origin/main' into no-bom 2023-07-06 21:20:47 +01:00
Jedd Morgan af61b08fa2 fix(ci): added line to remove BOM headers before applying copyright info 2023-07-06 21:20:28 +01:00
Jedd Morgan a6b5a09efa Merge pull request #84 from specklesystems/no-bom
fix(ci): added line to remove BOM headers before applying copyright info
2023-07-06 21:11:27 +01:00
Jedd Morgan f07eb732da fix(ci): added line to remove BOM headers before applying copyright info 2023-07-06 21:10:21 +01:00
Jedd Morgan 68cb85e029 Merge pull request #83 from specklesystems/activeUser
Updated user requests to use the new activeUser query
2023-07-06 17:32:14 +01:00
Jedd Morgan 067d66ae16 Removed marketplace publishing for UE 4.26 2023-07-06 17:22:27 +01:00
Jedd Morgan 4b4eae32a2 chore(api): user -> activeUser 2023-07-06 17:15:43 +01:00
Jedd Morgan 72738bb01b Merge pull request #81 from specklesystems/2.15
Fixes for build issues
2023-06-29 23:18:03 +01:00
Jedd Morgan 42b525107f fix(build): Added missing inlcudes to fix issue with non-unity builds 2023-06-29 23:16:56 +01:00
Jedd Morgan e5a06c8c4c fix: Additional fix for requests with empty authtokens 2023-06-29 12:52:06 +01:00
Jedd Morgan 8205c40e53 Merge pull request #80 from specklesystems/2.15
Added CI for UE5.2
2023-06-16 02:02:50 +01:00
Jedd Morgan f903742449 Added CI for UE5.2 2023-06-16 02:01:56 +01:00
Jedd Morgan 5af3717239 Merge pull request #79 from specklesystems/2.15
Bumped appolo headers
2023-06-16 01:58:14 +01:00
Jedd Morgan 761c7a28f8 Bumped appolo headers 2023-06-16 01:56:39 +01:00
Jedd Morgan 2c0564da64 Merge pull request #78 from specklesystems/2.14
Added support for new revit instances, and added support for UE5.2
2023-06-16 01:49:31 +01:00
Jedd Morgan e0eecdfb38 Update README.md 2023-06-16 01:48:47 +01:00
Jedd Morgan feae0da6c6 Added support for UE 5.2 2023-06-16 01:24:29 +01:00
Jedd Morgan ee8963535b Merge remote-tracking branch 'origin/main' into 2.14 2023-06-16 01:04:39 +01:00
Jedd Morgan b11c041a4e feat: Added support for new instances 2023-06-16 00:58:09 +01:00
Jedd Morgan f9bdd24bc9 Merge pull request #76 from specklesystems/gergo/ciContextUpdate
add circleci context to the publish job
2023-06-15 15:33:31 +01:00
Jedd Morgan 8c67c81cc1 Merge pull request #77 from moihack/main
Fixed crash when overriding material by Name
2023-06-15 14:27:08 +01:00
moihack b5d09a1f2f Fixed crash when overriding material by Name 2023-05-18 20:11:12 +03:00
Alan Rynne 25cda6e272 ci: Updated github actions to use new actions repo 2023-01-09 20:53:09 +01:00
Gergő Jedlicska 9fd8ef90c9 add circleci context to the publish job 2023-01-06 11:58:14 +01:00
Jedd Morgan 582dfe217d Merge pull request #75 from specklesystems/ue5.1
feat: Added support for UE 5.1
2022-11-30 22:38:43 +00:00
Jedd Morgan a4d452b9be feat: Added support for UE 5.1 2022-11-30 22:29:41 +00:00
Jedd Morgan 96861937e1 Merge pull request #74 from specklesystems/jrm/ue5.1-fix
Buiding on UE5.1-preview 2 now works.
2022-10-25 23:52:43 +01:00
JR-Morgan e25f56eca9 Fix(editor): Fixed issue with REINST blueprint converter classes in UE5.1 2022-10-25 23:39:19 +01:00
Jedd Morgan dcc14bf826 Merge pull request #71 from specklesystems/userid-fix
user id fix
2022-09-02 14:59:37 +01:00
JR-Morgan 5a65dd7759 fix: Fixed issue with events incorrectly tracking UserID 2022-09-02 14:53:01 +01:00
Jedd Morgan d42bfd584a Update README.md 2022-09-01 17:53:29 +01:00
Jedd Morgan 70fc6a717e Merge pull request #70 from specklesystems/apollo-headers
feat(core): Added apollo headers to graphQL requests
2022-09-01 17:44:03 +01:00
JR-Morgan 552b47b312 feat(core): Added apollo headers to graphQL requests 2022-09-01 17:40:13 +01:00
Jedd Morgan 6180e40537 Merge pull request #69 from moihack/main
Fixed triangle order in ProceduralMeshConverter
2022-09-01 17:13:47 +01:00
moihack dab56d331a Fixed triangle order in ProceduralMeshConverter 2022-08-24 11:32:13 +03:00
Jedd Morgan 2d848aa452 Merge pull request #67 from specklesystems/copyright-ci
Copyright notice to be applied through CI
2022-08-08 16:04:41 +01:00
JR-Morgan 016e31c5a4 Copyright notice to be applied through CI 2022-08-07 18:03:00 +01:00
JR-Morgan a41081a7db Added copyright notice to build files 2022-08-02 17:36:34 +01:00
JR-Morgan 13d44abe21 Ignored licence for marketplace deploy 2022-08-02 17:33:06 +01:00
JR-Morgan 753170f50e Circle CI manual deployment 2022-08-02 17:12:25 +01:00
JR-Morgan dc4638eb1a Fixed issue with .circleci being incorrectly included in git archive 2022-08-02 17:01:51 +01:00
101 changed files with 902 additions and 474 deletions
+45 -36
View File
@@ -3,6 +3,11 @@ version: 2.1
orbs:
aws-s3: circleci/aws-s3@2.0.0
parameters:
marketplace-deploy:
type: boolean
default: false
commands:
zip-source:
parameters:
@@ -19,6 +24,23 @@ commands:
stashName=`git stash create`;
git archive -o "<<parameters.outputdir>>/speckle-unreal-UE<<parameters.target>>.zip" --worktree-attributes --prefix="speckle-unreal/" $stashName
add-source-copyright:
parameters:
copyright-string:
type: string
steps:
- run: #Remove BOM header, then add copyright comment
name: "Add copyright notice to source files"
command: |
shopt -s globstar
for file in Source/**/*.{cpp,hpp,c,h,cs};
do if [ -f $file ]; then
sed -i '1s/^\xEF\xBB\xBF//' $file;
sed -i '1s/^/\/\/ <<parameters.copyright-string>>\n/' $file;
echo "added copyright notice to $file";
fi;
done;
jobs:
generate-source-zip:
docker:
@@ -28,6 +50,8 @@ jobs:
type: string
steps:
- checkout
- add-source-copyright:
copyright-string: "Copyright AEC SYSTEMS 2023"
- zip-source:
target: <<parameters.target>>
outputdir: "output/unreal/<<parameters.target>>"
@@ -55,48 +79,33 @@ jobs:
workflows:
marketplace-publish:
when: <<pipeline.parameters.marketplace-deploy>>
jobs:
- generate-source-zip:
name: "Generate Source Archive UE4.26"
target: "4.26"
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(\/all)?$/
- generate-source-zip:
name: "Generate Source Archive UE4.27"
target: "4.27"
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(\/all)?$/
- generate-source-zip:
name: "Generate Source Archive UE5.0"
target: "5.0"
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(\/all)?$/
- hold:
type: approval
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(\/all)?$/
requires:
- "Generate Source Archive UE4.26"
- "Generate Source Archive UE4.27"
- "Generate Source Archive UE5.0"
- generate-source-zip:
name: "Generate Source Archive UE5.1"
target: "5.1"
- generate-source-zip:
name: "Generate Source Archive UE5.2"
target: "5.2"
- generate-source-zip:
name: "Generate Source Archive UE5.3"
target: "5.3"
- generate-source-zip:
name: "Generate Source Archive UE5.4"
target: "5.4"
- marketplace-deploy:
name: "Deploy to marketplace"
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(\/all)?$/
requires:
- hold
context: do-spaces-speckle-releases
requires:
- "Generate Source Archive UE4.27"
- "Generate Source Archive UE5.0"
- "Generate Source Archive UE5.1"
- "Generate Source Archive UE5.2"
- "Generate Source Archive UE5.3"
- "Generate Source Archive UE5.4"
-3
View File
@@ -1,4 +1 @@
.gitattributes export-ignore
.github/* export-ignore
.circleci/* export-ignore
.pluginconfig/* export-ignore
+4 -70
View File
@@ -6,73 +6,7 @@ on:
jobs:
update_issue:
runs-on: ubuntu-latest
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ORGANIZATION: specklesystems
PROJECT_NUMBER: 9
run: |
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
settings
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
echo "$PROJECT_ID"
echo "$STATUS_FIELD_ID"
echo 'DONE_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .settings | fromjson | .options[] | select(.name== "Done") | .id' project_data.json) >> $GITHUB_ENV
echo "$DONE_ID"
- name: Add Issue to project #it's already in the project, but we do this to get its node id!
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
item_id="$( gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
mutation($project:ID!, $id:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $id}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f id=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
- name: Update Status
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
mutation($project:ID!, $status:ID!, $id:ID!, $value:String!) {
set_status: updateProjectNextItemField(
input: {
projectId: $project
itemId: $id
fieldId: $status
value: $value
}
) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f status=$STATUS_FIELD_ID -f id=$ITEM_ID -f value=${{ env.DONE_ID }}
uses: specklesystems/github-actions/.github/workflows/project-add-issue.yml@main
secrets: inherit
with:
issue-id: ${{ github.event.issue.node_id }}
+4 -42
View File
@@ -6,45 +6,7 @@ on:
jobs:
track_issue:
runs-on: ubuntu-latest
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ORGANIZATION: specklesystems
PROJECT_NUMBER: 9
run: |
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
settings
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
- name: Add Issue to project
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
item_id="$( gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
mutation($project:ID!, $id:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $id}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f id=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
uses: specklesystems/github-actions/.github/workflows/project-add-issue.yml@main
secrets: inherit
with:
issue-id: ${{ github.event.issue.node_id }}
+6
View File
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.github/* export-ignore
.circleci/* export-ignore
.circleci/ export-ignore
.pluginconfig/* export-ignore
LICENSE export-ignore
+1 -1
View File
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.7.0",
"VersionName": "2.19.0",
"FriendlyName": "Speckle Unreal",
"Description": "Speckle is an open source data platform for Architecture, Engineering, and Construction. It has been open sourced under the Apache License 2.0, is customizable, and available in the cloud or via a self-hosted server. It allows users to exchange data between various AEC modelling and content creation platforms.",
"Category": "AEC",
+6
View File
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.github/* export-ignore
.circleci/* export-ignore
.circleci/ export-ignore
.pluginconfig/* export-ignore
LICENSE export-ignore
+1 -1
View File
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.7.0",
"VersionName": "2.19.0",
"FriendlyName": "Speckle Unreal",
"Description": "Speckle is an open source data platform for Architecture, Engineering, and Construction. It has been open sourced under the Apache License 2.0, is customizable, and available in the cloud or via a self-hosted server. It allows users to exchange data between various AEC modelling and content creation platforms.",
"Category": "AEC",
+6
View File
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.github/* export-ignore
.circleci/* export-ignore
.circleci/ export-ignore
.pluginconfig/* export-ignore
LICENSE export-ignore
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.7.0",
"VersionName": "2.19.0",
"FriendlyName": "Speckle Unreal",
"Description": "Speckle is an open source data platform for Architecture, Engineering, and Construction. It has been open sourced under the Apache License 2.0, is customizable, and available in the cloud or via a self-hosted server. It allows users to exchange data between various AEC modelling and content creation platforms.",
"Category": "AEC",
@@ -14,7 +14,7 @@
"IsBetaVersion": true,
"IsExperimentalVersion": false,
"Installed": false,
"EngineVersion": "4.26",
"EngineVersion": "5.1",
"Modules": [
{
"Name": "SpeckleUnreal",
+6
View File
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.github/* export-ignore
.circleci/* export-ignore
.circleci/ export-ignore
.pluginconfig/* export-ignore
LICENSE export-ignore
+42
View File
@@ -0,0 +1,42 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.19.0",
"FriendlyName": "Speckle Unreal",
"Description": "Speckle is an open source data platform for Architecture, Engineering, and Construction. It has been open sourced under the Apache License 2.0, is customizable, and available in the cloud or via a self-hosted server. It allows users to exchange data between various AEC modelling and content creation platforms.",
"Category": "AEC",
"CreatedBy": "Speckle",
"CreatedByURL": "https://speckle.systems/",
"DocsURL": "https://github.com/specklesystems/speckle-unreal",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/98770ce9d4f143de8dd7882a707a6f81",
"SupportURL": "https://speckle.community/",
"CanContainContent": true,
"IsBetaVersion": true,
"IsExperimentalVersion": false,
"Installed": false,
"EngineVersion": "5.2",
"Modules": [
{
"Name": "SpeckleUnreal",
"Type": "Runtime",
"LoadingPhase": "Default",
"WhitelistPlatforms": [ "Win64", "Linux", "Mac" ]
},
{
"Name": "SpeckleUnrealEditor",
"Type": "Editor",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [ "Win64", "Linux", "Mac" ]
}
],
"Plugins": [
{
"Name": "ProceduralMeshComponent",
"Enabled": true
},
{
"Name": "LidarPointCloud",
"Enabled": true
}
]
}
+6
View File
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.github/* export-ignore
.circleci/* export-ignore
.circleci/ export-ignore
.pluginconfig/* export-ignore
LICENSE export-ignore
+42
View File
@@ -0,0 +1,42 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.19.0",
"FriendlyName": "Speckle Unreal",
"Description": "Speckle is an open source data platform for Architecture, Engineering, and Construction. It has been open sourced under the Apache License 2.0, is customizable, and available in the cloud or via a self-hosted server. It allows users to exchange data between various AEC modelling and content creation platforms.",
"Category": "AEC",
"CreatedBy": "Speckle",
"CreatedByURL": "https://speckle.systems/",
"DocsURL": "https://github.com/specklesystems/speckle-unreal",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/98770ce9d4f143de8dd7882a707a6f81",
"SupportURL": "https://speckle.community/",
"CanContainContent": true,
"IsBetaVersion": true,
"IsExperimentalVersion": false,
"Installed": false,
"EngineVersion": "5.3",
"Modules": [
{
"Name": "SpeckleUnreal",
"Type": "Runtime",
"LoadingPhase": "Default",
"WhitelistPlatforms": [ "Win64", "Linux", "Mac" ]
},
{
"Name": "SpeckleUnrealEditor",
"Type": "Editor",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [ "Win64", "Linux", "Mac" ]
}
],
"Plugins": [
{
"Name": "ProceduralMeshComponent",
"Enabled": true
},
{
"Name": "LidarPointCloud",
"Enabled": true
}
]
}
+6
View File
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.github/* export-ignore
.circleci/* export-ignore
.circleci/ export-ignore
.pluginconfig/* export-ignore
LICENSE export-ignore
+42
View File
@@ -0,0 +1,42 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.19.0",
"FriendlyName": "Speckle Unreal",
"Description": "Speckle is an open source data platform for Architecture, Engineering, and Construction. It has been open sourced under the Apache License 2.0, is customizable, and available in the cloud or via a self-hosted server. It allows users to exchange data between various AEC modelling and content creation platforms.",
"Category": "AEC",
"CreatedBy": "Speckle",
"CreatedByURL": "https://speckle.systems/",
"DocsURL": "https://github.com/specklesystems/speckle-unreal",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/98770ce9d4f143de8dd7882a707a6f81",
"SupportURL": "https://speckle.community/",
"CanContainContent": true,
"IsBetaVersion": true,
"IsExperimentalVersion": false,
"Installed": false,
"EngineVersion": "5.4",
"Modules": [
{
"Name": "SpeckleUnreal",
"Type": "Runtime",
"LoadingPhase": "Default",
"WhitelistPlatforms": [ "Win64", "Linux", "Mac" ]
},
{
"Name": "SpeckleUnrealEditor",
"Type": "Editor",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [ "Win64", "Linux", "Mac" ]
}
],
"Plugins": [
{
"Name": "ProceduralMeshComponent",
"Enabled": true
},
{
"Name": "LidarPointCloud",
"Enabled": true
}
]
}
+2
View File
@@ -0,0 +1,2 @@
[CoreRedirects]
+FunctionRedirects=(OldName="/Script/SpeckleUnreal.ObjectModelRegistry.FindClosestType",NewName="/Script/SpeckleUnreal.ObjectModelRegistry.GetAtomicType")
+1 -2
View File
@@ -1,3 +1,2 @@
[FilterPlugin]
/README.md
/LICENSE
/README.md
Binary file not shown.
Binary file not shown.
Binary file not shown.
+22 -18
View File
@@ -1,23 +1,24 @@
# Speckle for Unreal Engine
<h1 align="center">
<img src="https://user-images.githubusercontent.com/2679513/131189167-18ea5fe1-c578-47f6-9785-3748178e4312.png" width="150px"/><br/>
Speckle | Unreal
</h1>
[![Twitter Follow](https://img.shields.io/twitter/follow/SpeckleSystems?style=social)](https://twitter.com/SpeckleSystems) [![Community forum users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fspeckle.community&style=flat-square&logo=discourse&logoColor=white)](https://speckle.community) [![website](https://img.shields.io/badge/https://-speckle.systems-royalblue?style=flat-square)](https://speckle.systems) [![docs](https://img.shields.io/badge/docs-speckle.guide-orange?style=flat-square&logo=read-the-docs&logoColor=white)](https://speckle.guide/user/unreal.html)
<p align="center"><a href="https://twitter.com/SpeckleSystems"><img src="https://img.shields.io/twitter/follow/SpeckleSystems?style=social" alt="Twitter Follow"></a> <a href="https://speckle.community"><img src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fspeckle.community&amp;style=flat-square&amp;logo=discourse&amp;logoColor=white" alt="Community forum users"></a> <a href="https://speckle.systems"><img src="https://img.shields.io/badge/https://-speckle.systems-royalblue?style=flat-square" alt="website"></a> <a href="https://speckle.guide/dev/"><img src="https://img.shields.io/badge/docs-speckle.guide-orange?style=flat-square&amp;logo=read-the-docs&amp;logoColor=white" alt="docs"></a></p>
Speckle makes integrating Unreal Engine with your 3D workflows even easier. </br>
This plugin connects Unreal Engine to Speckle, allowing you to receive your versioned 3D data from Speckle inside Unreal Engine,
enabling interoperable collaboration between Unreal and other Speckle connectors (Revit, Rhino, Blender, Sketchup, Unity, AutoCAD, [and more!](https://speckle.systems/features/connectors/))
> Speckle is the first AEC data hub that connects with your favorite AEC tools. Speckle exists to overcome the challenges of working in a fragmented industry where communication, creative workflows, and the exchange of data are often hindered by siloed software and processes. It is here to make the industry better.
<h3 align="center">
Speckle Connector for Unreal Engine
</h3>
https://user-images.githubusercontent.com/45512892/181620836-9c7e6a7f-4f18-48e5-a574-5eebc2abd35f.mp4
Checkout our dedicated [Tutorials and Docs](https://speckle.systems/tag/unreal/).
If you are enjoying using Speckle, don't forget to ⭐ our [GitHub repositories](https://github.com/specklesystems),
and [join our community forum](https://speckle.community/) where you can post any questions, suggestions, and discuss exciting projects!
> [!WARNING]
> This is a legacy repo! A new next generation connector will be coming soon. In the meantime, check out our active next generation repos here 👇<br/>
> [`speckle-sharp-connectors`](https://github.com/specklesystems/speckle-sharp-connectors): our .NET next generation connectors and desktop UI<br/>
> [`speckle-sharp-sdk`](https://github.com/specklesystems/speckle-sharp-sdk): our .NET SDK, Tests, and Objects
## Notice
We support Unreal Engine 4.26, 4.27, 5.0
We officially support Unreal Engine 4.27, 5.0-5.4
**Features**:
- [Receiving Speckle geometry as Actors in editor and standalone runtime](https://speckle.systems/tutorials/getting-started-with-speckle-for-unreal/).
@@ -32,8 +33,9 @@ We support Unreal Engine 4.26, 4.27, 5.0
| ---: | :---: | :--- |
| [`Objects.Geometry.Mesh`](https://github.com/specklesystems/speckle-sharp/blob/main/Objects/Objects/Geometry/Mesh.cs) | → | [Static Mesh Component](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Components/UStaticMeshComponent/) /<br/> [Procedural Mesh Component](https://docs.unrealengine.com/4.27/en-US/API/Plugins/ProceduralMeshComponent/UProceduralMeshComponent/) |
| [`Objects.Geometry.PointCloud`](https://github.com/specklesystems/speckle-sharp/blob/main/Objects/Objects/Geometry/Pointcloud.cs) | → | [LiDAR Point Cloud](https://docs.unrealengine.com/4.27/en-US/WorkingWithContent/LidarPointCloudPlugin/LidarPointCloudPluginReference/) |
| [`Objects.Other.BlockInstance`](https://github.com/specklesystems/speckle-sharp/blob/main/Objects/Objects/Other/Block.cs) | → | Actor with Transform |
| [`Objects.Other.Instance`](https://github.com/specklesystems/speckle-sharp/blob/main/Objects/Objects/Other/Instance.cs) | → | Actor with Transform |
| [`Objects.BuiltElements.View`](https://github.com/specklesystems/speckle-sharp/blob/main/Objects/Objects/BuiltElements/View.cs) | → | [Camera](https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Framework/Camera/) |
| [`Speckle.Core.Models.Collection`](https://github.com/specklesystems/speckle-sharp/blob/main/Core/Core/Models/Collection.cs) | → | Empty Actor |
**Supported platforms**: Windows, Linux, MacOS
*Other platforms may work, but currently untested*.
@@ -43,13 +45,15 @@ We support Unreal Engine 4.26, 4.27, 5.0
- Currently no support for sending Unreal geometry to Speckle.
- Does not use the .NET or Python SDK, or the Speckle Kit based workflow, all code is in native C++/BP.
- Does not use our shared [Desktop UI 2](https://speckle.guide/user/ui2.html), only a simple editor UI is currently provided.
- Does not fetch [accounts from Speckle Manager](https://speckle.guide/user/manager.html#logging-in-adding-accounts), you must generate a [personal access token (auth token)](https://speckle.guide/dev/tokens.html#personal-access-tokens) to receive non-public streams.
## How to install
<!--- Soon to be!
Speckle for Unreal Engine can be installed through the [Unreal Engine Marketplace](com.epicgames.launcher://ue/marketplace/product/98770ce9d4f143de8dd7882a707a6f81).
**Speckle for Unreal Engine** can be installed through the [Unreal Engine Marketplace](https://www.unrealengine.com/marketplace/en-US/product/speckle-for-unreal-engine).
Alternatively, developers may prefer to install manually.-->
---
Alternatively, developers may prefer to install manually.
1. Git clone [this repo](https://github.com/specklesystems/speckle-unreal) (or download and extract the [archive zip](https://github.com/specklesystems/speckle-unreal/archive/refs/heads/main.zip)) into your project's `Plugins` directory (created as needed)
2. Open/Restart your Unreal project. This will build the plugin for your environment.
+11 -9
View File
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "API/ClientAPI.h"
@@ -28,7 +27,7 @@ void FClientAPI::MakeGraphQLRequest(const FString& ServerUrl, const FString& Aut
if(!GetResponseAsJSON(Response, RequestLogName, Obj, OnError)) return;
const TSharedPtr<FJsonObject>* DataObjectPtr;
if(!Obj->TryGetObjectField("data", DataObjectPtr))
if(!Obj->TryGetObjectField(TEXT("data"), DataObjectPtr))
{
OnError(TEXT("%s responce was invalid, expected to find a \"data\" property in response"));
return;
@@ -90,7 +89,7 @@ void FClientAPI::MakeGraphQLRequest(const FString& ServerUrl, const FString& Aut
UE_LOG(LogSpeckle, Warning, TEXT("POST Request %s to %s failed to send"), *RequestLogName, *Request->GetURL() );
}
FAnalytics::TrackEvent(Request->GetURL(), "NodeRun", TMap<FString, FString> { {"name", __FUNCTION__}});
FAnalytics::TrackEvent(Request->GetURL(), TEXT("NodeRun"), TMap<FString, FString> { {TEXT("name"), __FUNCTION__}});
}
@@ -125,11 +124,14 @@ FHttpRequestRef FClientAPI::CreatePostRequest(const FString& ServerUrl, const FS
{
FHttpRequestRef Request = FHttpModule::Get().CreateRequest();
Request->SetURL(ServerUrl + "/graphql");
Request->SetURL(ServerUrl + TEXT("/graphql"));
Request->SetVerb(TEXT("POST"));
Request->SetHeader("Accept-Encoding", Encoding);
Request->SetHeader("Content-Type", TEXT("application/json"));
Request->SetHeader("Authorization", "Bearer " + AuthToken);
Request->SetHeader(TEXT("Accept-Encoding"), Encoding);
Request->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
if(!AuthToken.IsEmpty())
Request->SetHeader(TEXT("Authorization"), FString::Printf(TEXT("Bearer %s"), *AuthToken));
Request->SetHeader(TEXT("apollographql-client-name"), TEXT("Unreal Engine"));
Request->SetHeader(TEXT("apollographql-client-version"), SPECKLE_CONNECTOR_VERSION);
Request->SetContentAsString(PostPayload);
return Request;
@@ -176,10 +178,10 @@ bool FClientAPI::CheckForOperationErrors(const TSharedPtr<FJsonObject> GraphQLRe
FString Message;
const TSharedPtr<FJsonObject>* ErrorObject;
bool HadMessage = e->TryGetObject(ErrorObject)
&& (*ErrorObject)->TryGetStringField("message", Message);
&& (*ErrorObject)->TryGetStringField(TEXT("message"), Message);
if(!HadMessage)
{
Message = "An operation error occured but had no message!\n";
Message = TEXT("An operation error occured but had no message!\n");
UE_LOG(LogSpeckle, Warning, TEXT("%s"), *Message);
}
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "API/Operations/ReceiveOperation.h"
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "API/Operations/SpeckleStreamAPIOperation.h"
@@ -1,6 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "API/SpeckleAPIFunctions.h"
@@ -1,9 +1,9 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "API/SpeckleSerializer.h"
#include "Objects/Base.h"
#include "LogSpeckle.h"
#include "Objects/DisplayValueElement.h"
#include "Objects/Utils/SpeckleObjectUtils.h"
#include "Objects/ObjectModelRegistry.h"
#include "Templates/SubclassOf.h"
@@ -24,18 +24,20 @@ UBase* USpeckleSerializer::DeserializeBase(const TSharedPtr<FJsonObject> Obj,
}
FString SpeckleType;
if (!Obj->TryGetStringField("speckle_type", SpeckleType)) return nullptr;
if (!Obj->TryGetStringField(TEXT("speckle_type"), SpeckleType)) return nullptr;
FString ObjectId = "";
Obj->TryGetStringField("id", ObjectId);
Obj->TryGetStringField(TEXT("id"), ObjectId);
TSubclassOf<UBase> BaseType;
FString WorkingType(SpeckleType);
int32 Tries = 1000;
FString WorkingType{};
FString Remainder = FString(SpeckleType);
int32 Tries = 200;
while(ensure(Tries-- > 0))
{
//Try and deserialize
const bool IsLastChance = !UObjectModelRegistry::SplitSpeckleType(Remainder, Remainder, WorkingType);
if(UObjectModelRegistry::TryGetRegisteredType(WorkingType, BaseType))
{
UBase* Base = NewObject<UBase>(GetTransientPackage(), BaseType);
@@ -43,20 +45,30 @@ UBase* USpeckleSerializer::DeserializeBase(const TSharedPtr<FJsonObject> Obj,
return Base;
}
//If we couldn't even deserialize this to a Base
if(WorkingType == "Base" || BaseType == UBase::StaticClass())
if(IsLastChance)
{
//Try a fallback displayValue object
UBase* Base = NewObject<UBase>(GetTransientPackage(), UDisplayValueElement::StaticClass());
if(Base->Parse(Obj, ReadTransport))
return Base;
//If not, try a regular Base
Base = NewObject<UBase>(GetTransientPackage(), UBase::StaticClass());
if(Base->Parse(Obj, ReadTransport))
return Base;
UE_LOG(LogSpeckle, Warning, TEXT("Skipping deserilization of %s id: %s - object could not be deserilaized to Base"), *SpeckleType, *ObjectId );
return nullptr;
}
//If we couldn't even deserialize this to a Base, something is quite wrong...
if(WorkingType == TEXT("Base") || BaseType == UBase::StaticClass())
{
UE_LOG(LogSpeckle, Warning, TEXT("Skipping deserilization of %s id: %s - object could not be deserilaized to Base"), *SpeckleType, *ObjectId );
return nullptr;
}
//Try the next type
if(!UObjectModelRegistry::ParentType(WorkingType, WorkingType))
{
WorkingType = "Base";
UE_LOG(LogSpeckle, Verbose, TEXT("Unrecognised SpeckleType %s - Object id: %s Will be deserialized as Base"), *SpeckleType, *ObjectId );
}
}
return nullptr;
}
+6 -13
View File
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Mixpanel.h"
@@ -7,8 +6,8 @@
#include "Kismet/GameplayStatics.h"
#include "LogSpeckle.h"
#include "Interfaces/IHttpResponse.h"
#include "Launch/Resources/Version.h"
#include "Misc/Base64.h"
#include "Runtime/Launch/Resources/Version.h"
#include "Policies/CondensedJsonPrintPolicy.h"
#include "Serialization/JsonSerializerMacros.h"
#include "Serialization/JsonWriter.h"
@@ -19,31 +18,26 @@ const FString FAnalytics::VersionedApplicationName = FString::Printf(TEXT("Unrea
void FAnalytics::TrackEvent(const FString& Server, const FString& EventName)
{
#if !SUPPRESS_SPECKLE_ANALYTICS
const TMap<FString, FString> CustomProperties;
TrackEvent( Server, EventName, CustomProperties);
#endif
}
void FAnalytics::TrackEvent(const FString& Server, const FString& EventName, const TMap<FString, FString>& CustomProperties)
{
#if !SUPPRESS_SPECKLE_ANALYTICS
//Since we don't have access to users email address, we will hash the system user name instead (better than not tracking users at all)
const FString Email = FString(FGenericPlatformProcess::ComputerName()) + FString(FGenericPlatformProcess::UserName());
TrackEvent(Email, Server, EventName, CustomProperties);
#endif
const FString UserID = FString(FPlatformProcess::ComputerName()) + FString(FPlatformProcess::UserName());
TrackEvent(UserID, Server, EventName, CustomProperties);
}
void FAnalytics::TrackEvent(const FString& Email, const FString& Server, const FString& EventName, const TMap<FString, FString>& CustomProperties)
void FAnalytics::TrackEvent(const FString& UserID, const FString& Server, const FString& EventName, const TMap<FString, FString>& CustomProperties)
{
#if !SUPPRESS_SPECKLE_ANALYTICS
FString HashedEmail = "@" + Hash(Email); //prepending an @ so we distinguish logged and non-logged users
FString HashedUserID = "@" + Hash(UserID); //prepending an @ so we distinguish logged and non-logged users
FString HashedServer = Hash(Server);
TMap<FString, FString> Properties
{
{ "distinct_id", HashedEmail },
{ "distinct_id", HashedUserID },
{ "server_id", HashedServer },
{ "token", MixpanelToken },
{ "hostApp", "Unreal Engine" },
@@ -87,7 +81,6 @@ void FAnalytics::TrackEvent(const FString& Email, const FString& Server, const F
{
UE_LOG(LogSpeckle, Log, TEXT("Failed to send Mixpanel event to %s"), *MixpanelServer);
}
#endif
}
FString FAnalytics::Hash(const FString& Input)
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/Converters/AggregateConverter.h"
@@ -1,14 +1,15 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/Converters/BlockConverter.h"
#include "Objects/Other/BlockInstance.h"
#include "Objects/Utils/SpeckleObjectUtils.h"
#include "Engine/World.h"
#include "Objects/Other/RevitInstance.h"
UBlockConverter::UBlockConverter()
{
SpeckleTypes.Add(UBlockInstance::StaticClass());
SpeckleTypes.Add(URevitInstance::StaticClass());
BlockInstanceActorType = AActor::StaticClass();
ActorMobility = EComponentMobility::Static;
@@ -16,13 +17,13 @@ UBlockConverter::UBlockConverter()
UObject* UBlockConverter::ConvertToNative_Implementation(const UBase* SpeckleBase, UWorld* World, TScriptInterface<ISpeckleConverter>&)
{
const UBlockInstance* Block = Cast<UBlockInstance>(SpeckleBase);
const UInstance* Block = Cast<UInstance>(SpeckleBase);
if(Block == nullptr) return nullptr;
return BlockToNative(Block, World);
}
AActor* UBlockConverter::BlockToNative(const UBlockInstance* Block, UWorld* World)
AActor* UBlockConverter::BlockToNative(const UInstance* Block, UWorld* World)
{
AActor* BlockActor = CreateEmptyActor(World, USpeckleObjectUtils::CreateTransform(Block->Transform));
//Return the block actor as is,
@@ -0,0 +1,53 @@
#include "Conversion/Converters/CollectionConverter.h"
#include "Objects/Collection.h"
UCollectionConverter::UCollectionConverter()
{
SpeckleTypes.Add(UCollection::StaticClass());
ActorType = AActor::StaticClass();
ActorMobility = EComponentMobility::Static;
}
UObject* UCollectionConverter::ConvertToNative_Implementation(const UBase* SpeckleBase, UWorld* World,
TScriptInterface<ISpeckleConverter>& AvailableConverters )
{
const UCollection* p = Cast<UCollection>(SpeckleBase);
if(p == nullptr) return nullptr;
return CollectionToNative(p, World);
}
AActor* UCollectionConverter::CollectionToNative(const UCollection*, UWorld* World)
{
AActor* MeshActor = CreateEmptyActor(World);
return MeshActor;
}
AActor* UCollectionConverter::CreateEmptyActor(UWorld* World, const FActorSpawnParameters& SpawnParameters)
{
AActor* Actor = World->SpawnActor<AActor>(ActorType, SpawnParameters);
USceneComponent* Scene = NewObject<USceneComponent>(Actor, "Root");
Actor->SetRootComponent(Scene);
Scene->RegisterComponent();
Scene->SetMobility(ActorMobility);
return Actor;
}
UBase* UCollectionConverter::ConvertToSpeckle_Implementation(const UObject* Object)
{
return nullptr; //TODO implement ToSpeckle function
}
UCollection* UCollectionConverter::CollectionToSpeckle(const AActor* Object)
{
return nullptr; //TODO implement ToSpeckle function
}
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/Converters/MaterialConverter.h"
@@ -7,12 +6,15 @@
#include "Materials/MaterialInstanceDynamic.h"
#include "Objects/Other/RenderMaterial.h"
#include "UObject/ConstructorHelpers.h"
#include "Materials/MaterialInterface.h"
#include "Misc/Paths.h"
#include "UObject/Package.h"
UMaterialConverter::UMaterialConverter()
{
static ConstructorHelpers::FObjectFinder<UMaterial> SpeckleMaterial(TEXT("Material'/SpeckleUnreal/SpeckleMaterial.SpeckleMaterial'"));
static ConstructorHelpers::FObjectFinder<UMaterial> SpeckleGlassMaterial(TEXT("Material'/SpeckleUnreal/SpeckleGlassMaterial.SpeckleGlassMaterial'"));
static ConstructorHelpers::FObjectFinder<UMaterialInterface> SpeckleMaterial(TEXT("Material'/SpeckleUnreal/SpeckleMaterial.SpeckleMaterial'"));
static ConstructorHelpers::FObjectFinder<UMaterialInterface> SpeckleGlassMaterial(TEXT("Material'/SpeckleUnreal/SpeckleGlassMaterial.SpeckleGlassMaterial'"));
DefaultMeshMaterial = SpeckleMaterial.Object;
BaseMeshOpaqueMaterial = SpeckleMaterial.Object;
@@ -79,7 +81,7 @@ bool UMaterialConverter::TryGetOverride(const URenderMaterial* SpeckleMaterial,
{
if(ensureAlways(IsValid(Mat)) && Mat->GetName() == Name)
{
OutMaterial = MaterialOverridesById[MaterialID];
OutMaterial = *MaterialOverridesByName.Find(Mat);
return true;
}
}
@@ -1,11 +1,12 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/Converters/PointCloudConverter.h"
#include "LidarPointCloudActor.h"
#include "LidarPointCloudShared.h"
#include "LidarPointCloudComponent.h"
#include "Objects/Geometry/PointCloud.h"
#include "Engine/World.h"
#include "Runtime/Launch/Resources/Version.h"
UPointCloudConverter::UPointCloudConverter()
{
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/Converters/ProceduralMeshConverter.h"
@@ -67,19 +66,19 @@ AActor* UProceduralMeshConverter::MeshToNative(const UMesh* SpeckleMesh,
if (n == 3) //Triangles
{
Faces.Add(SpeckleMesh->Faces[i + 3]);
Faces.Add(SpeckleMesh->Faces[i + 2]);
Faces.Add(SpeckleMesh->Faces[i + 1]);
Faces.Add(SpeckleMesh->Faces[i + 2]);
Faces.Add(SpeckleMesh->Faces[i + 3]);
}
else if(n == 4) // Quads
{
Faces.Add(SpeckleMesh->Faces[i + 1]);
Faces.Add(SpeckleMesh->Faces[i + 3]);
Faces.Add(SpeckleMesh->Faces[i + 4]);
Faces.Add(SpeckleMesh->Faces[i + 3]);
Faces.Add(SpeckleMesh->Faces[i + 1]);
Faces.Add(SpeckleMesh->Faces[i + 3]);
Faces.Add(SpeckleMesh->Faces[i + 2]);
Faces.Add(SpeckleMesh->Faces[i + 1]);
Faces.Add(SpeckleMesh->Faces[i + 2]);
Faces.Add(SpeckleMesh->Faces[i + 3]);
}
else
{
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/Converters/StaticMeshConverter.h"
@@ -16,6 +15,10 @@
#include "Objects/DisplayValueElement.h"
#include "Objects/Other/RenderMaterial.h"
#include "Objects/Utils/SpeckleObjectUtils.h"
#include "Components/StaticMeshComponent.h"
#include "Misc/Paths.h"
#include "UObject/Package.h"
#include "Materials/MaterialInterface.h"
#define LOCTEXT_NAMESPACE "FSpeckleUnrealModule"
@@ -23,6 +26,8 @@ UStaticMeshConverter::UStaticMeshConverter()
{
SpeckleTypes.Add(UMesh::StaticClass());
SpeckleTypes.Add(UDisplayValueElement::StaticClass());
HiddenTypes.Add("Objects.BuiltElements.Room");
#if WITH_EDITORONLY_DATA
UseFullBuild = true;
@@ -96,10 +101,10 @@ AActor* UStaticMeshConverter::MeshesToNativeActor(const UBase* Parent, const TAr
FMatrix Transform = FMatrix::Identity;
// For single mesh, we check for transform
//TODO figure out how to handle DisplayValueElement with transform. Maybe we just grab transform from parent unconditionally? How does this affect blocks?
if(Parent == SpeckleMeshes[0])
{
Transform = SpeckleMeshes[0]->Transform;
}
// if(Parent == SpeckleMeshes[0])
// {
// Transform = SpeckleMeshes[0]->Transform;
// }
AActor* Actor = CreateEmptyActor(World, USpeckleObjectUtils::CreateTransform(Transform));
TInlineComponentArray<UStaticMeshComponent*> Components;
@@ -116,6 +121,15 @@ AActor* UStaticMeshConverter::MeshesToNativeActor(const UBase* Parent, const TAr
}
MeshComponent->SetStaticMesh(Mesh);
for(const FString& t: HiddenTypes)
{
if(Parent->SpeckleType.Contains(t))
{
MeshComponent->SetVisibility(false);
break;
}
}
int i = 0;
for(const UMesh* DisplayMesh : SpeckleMeshes)
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/SpeckleConverterComponent.h"
@@ -6,11 +5,14 @@
#include "API/SpeckleSerializer.h"
#include "Conversion/Converters/AggregateConverter.h"
#include "Conversion/Converters/BlockConverter.h"
#include "Conversion/Converters/CollectionConverter.h"
#include "Conversion/Converters/PointCloudConverter.h"
#include "Conversion/Converters/StaticMeshConverter.h"
#include "Conversion/Converters/MaterialConverter.h"
#include "Misc/ScopedSlowTask.h"
#include "Objects/Utils/SpeckleObjectUtils.h"
#include "UObject/ConstructorHelpers.h"
#include "Dom/JsonValue.h"
#define LOCTEXT_NAMESPACE "FSpeckleUnrealModule"
@@ -21,6 +23,7 @@ USpeckleConverterComponent::USpeckleConverterComponent()
static ConstructorHelpers::FObjectFinder<UPointCloudConverter> PointCloudConverter(TEXT("PointCloudConverter'/SpeckleUnreal/Converters/DefaultPointCloudConverter.DefaultPointCloudConverter'"));
static ConstructorHelpers::FObjectFinder<UBlockConverter> BlockConverter(TEXT("BlockConverter'/SpeckleUnreal/Converters/DefaultBlockConverter.DefaultBlockConverter'"));
static ConstructorHelpers::FObjectFinder<UMaterialConverter> MaterialConverter(TEXT("MaterialConverter'/SpeckleUnreal/Converters/DefaultMaterialConverter.DefaultMaterialConverter'"));
static ConstructorHelpers::FObjectFinder<UCollectionConverter> CollectionConverter(TEXT("CollectionConverter'/SpeckleUnreal/Converters/DefaultCollectionConverter.DefaultCollectionConverter'"));
static ConstructorHelpers::FObjectFinder<UObject> CameraConverter(TEXT("CameraConverter'/SpeckleUnreal/Converters/DefaultCameraConverter.DefaultCameraConverter'"));
//static ConstructorHelpers::FObjectFinder<ULightConverter> LightConverter(TEXT("LightConverter'/SpeckleUnreal/Converters/DefaultLightConverter.DefaultLightConverter'"));
@@ -30,6 +33,7 @@ USpeckleConverterComponent::USpeckleConverterComponent()
SpeckleConverter->SpeckleConverters.Add(PointCloudConverter.Object);
SpeckleConverter->SpeckleConverters.Add(BlockConverter.Object);
SpeckleConverter->SpeckleConverters.Add(MaterialConverter.Object);
SpeckleConverter->SpeckleConverters.Add(CollectionConverter.Object);
SpeckleConverter->SpeckleConverters.Add(CameraConverter.Object);
//SpeckleConverter->SpeckleConverters.Add(LightConverter.Object);
@@ -40,8 +44,19 @@ AActor* USpeckleConverterComponent::RecursivelyConvertToNative(AActor* AOwner, c
const TScriptInterface<ITransport>& LocalTransport, bool DisplayProgressBar, TArray<AActor*>& OutActors)
{
float ObjectsToConvert{};
Base->TryGetDynamicNumber("totalChildrenCount", ObjectsToConvert);
if(Base->TotalChildrenCount > 0)
{
ObjectsToConvert = Base->TotalChildrenCount;
}
else
{
Base->TryGetDynamicNumber("totalChildrenCount", ObjectsToConvert);
}
if(ObjectsToConvert <= 1)
{
ObjectsToConvert = 99999; //A large number
}
// Progress bar
FScopedSlowTask Progress(ObjectsToConvert + 2,
LOCTEXT("SpeckleConvertoNative","Converting Speckle Objects to Native"), DisplayProgressBar);
@@ -127,12 +142,14 @@ void USpeckleConverterComponent::AttachConvertedToOwner(AActor* AOwner, const UB
{
#if WITH_EDITOR
{
FString Name;
FText _Discard;
if( !(Base->TryGetDynamicString("name", Name) && FActorEditorUtils::ValidateActorName(FText::FromString(Name), _Discard)) )
FString Name = USpeckleObjectUtils::GetFriendlyObjectName(Base);
FText NameErrors;
if(!FActorEditorUtils::ValidateActorName(FText::FromString(Name), NameErrors))
{
Name = FString::Printf(TEXT("%s - %s"), *Base->SpeckleType, *Base->Id);
Name = USpeckleObjectUtils::GetBoringObjectName(Base);
}
NativeActor->SetActorLabel(Name);
}
#endif
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "LogSpeckle.h"
#include "Logging/LogMacros.h"
@@ -0,0 +1,20 @@
#include "Objects/Collection.h"
bool UCollection::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITransport> ReadTransport)
{
if(!Super::Parse(Obj, ReadTransport)) return false;
// Parse Name property
if(!Obj->TryGetStringField(TEXT("name"), Name)) return false;
//DynamicProperties.Remove(TEXT("name")); //Don't remove from dynamic, as we pick this up to name the actor
// Parse collectionType
if(!Obj->TryGetStringField(TEXT("collectionType"), CollectionType)) return false;
DynamicProperties.Remove(TEXT("collectionType"));
return true;
}
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Objects/DisplayValueElement.h"
@@ -9,8 +8,6 @@
TArray<FString> UDisplayValueElement::DisplayValueAliasStrings = {
"displayValue",
"@displayValue",
"displayMesh"
"@displayMesh"
};
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Objects/Geometry/Mesh.h"
@@ -15,7 +14,7 @@ bool UMesh::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITra
if(USpeckleObjectUtils::TryParseTransform(Obj, Transform))
{
Transform.ScaleTranslation(FVector(ScaleFactor));
DynamicProperties.Remove("transform");
DynamicProperties.Remove(TEXT("transform"));
}
else
{
@@ -25,38 +24,38 @@ bool UMesh::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITra
//Parse Vertices
{
TArray<TSharedPtr<FJsonValue>> ObjectVertices = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField("vertices"), ReadTransport);
TArray<TSharedPtr<FJsonValue>> ObjectVertices = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField(TEXT("vertices")), ReadTransport);
const int32 NumberOfVertices = ObjectVertices.Num() / 3;
Vertices.Reserve(NumberOfVertices);
for (size_t i = 0, j = 0; i < NumberOfVertices; i++, j += 3)
{
Vertices.Add(Transform.InverseTransformPosition(FVector
Vertices.Add(FVector
(
ObjectVertices[j].Get()->AsNumber(),
-ObjectVertices[j + 1].Get()->AsNumber(),
ObjectVertices[j + 2].Get()->AsNumber()
) * ScaleFactor ));
) * ScaleFactor );
}
DynamicProperties.Remove("vertices");
DynamicProperties.Remove(TEXT("vertices"));
}
//Parse Faces
{
const TArray<TSharedPtr<FJsonValue>> FaceVertices = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField("faces"), ReadTransport);
const TArray<TSharedPtr<FJsonValue>> FaceVertices = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField(TEXT("faces")), ReadTransport);
Faces.Reserve(FaceVertices.Num());
for(const auto& VertIndex : FaceVertices)
{
Faces.Add(VertIndex->AsNumber());
}
DynamicProperties.Remove("faces");
DynamicProperties.Remove(TEXT("faces"));
}
//Parse TextureCoords
{
const TArray<TSharedPtr<FJsonValue>>* TextCoordArray;
if(Obj->TryGetArrayField("textureCoordinates", TextCoordArray))
if(Obj->TryGetArrayField(TEXT("textureCoordinates"), TextCoordArray))
{
TArray<TSharedPtr<FJsonValue>> TexCoords = USpeckleObjectUtils::CombineChunks(*TextCoordArray, ReadTransport);
@@ -70,14 +69,14 @@ bool UMesh::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITra
TexCoords[i + 1].Get()->AsNumber()
));
}
DynamicProperties.Remove("textureCoordinates");
DynamicProperties.Remove(TEXT("textureCoordinates"));
}
}
//Parse VertexColors
{
const TArray<TSharedPtr<FJsonValue>>* ColorArray;
if(Obj->TryGetArrayField("colors", ColorArray))
if(Obj->TryGetArrayField(TEXT("colors"), ColorArray))
{
TArray<TSharedPtr<FJsonValue>> Colors = USpeckleObjectUtils::CombineChunks(*ColorArray, ReadTransport);
@@ -87,16 +86,16 @@ bool UMesh::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITra
{
VertexColors.Add(FColor(Colors[i].Get()->AsNumber()));
}
DynamicProperties.Remove("colors");
DynamicProperties.Remove(TEXT("colors"));
}
}
//Parse Optional RenderMaterial
if (Obj->HasField("renderMaterial"))
if (Obj->HasField(TEXT("renderMaterial")))
{
RenderMaterial = NewObject<URenderMaterial>();
RenderMaterial->Parse(Obj->GetObjectField("renderMaterial"), ReadTransport);
DynamicProperties.Remove("renderMaterial");
RenderMaterial->Parse(Obj->GetObjectField(TEXT("renderMaterial")), ReadTransport);
DynamicProperties.Remove(TEXT("renderMaterial"));
}
AlignVerticesWithTexCoordsByIndex();
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Objects/Geometry/PointCloud.h"
@@ -13,7 +12,7 @@ bool UPointCloud::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterfac
//Parse Points
{
TArray<TSharedPtr<FJsonValue>> ObjectPoints = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField("points"), ReadTransport);
TArray<TSharedPtr<FJsonValue>> ObjectPoints = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField(TEXT("points")), ReadTransport);
Points.Reserve(ObjectPoints.Num() / 3);
for (int32 i = 2; i < ObjectPoints.Num(); i += 3)
@@ -31,7 +30,7 @@ bool UPointCloud::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterfac
//Parse Colors
{
TArray<TSharedPtr<FJsonValue>> ObjectColors = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField("colors"), ReadTransport);
TArray<TSharedPtr<FJsonValue>> ObjectColors = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField(TEXT("colors")), ReadTransport);
Colors.Reserve(ObjectColors.Num());
for (int32 i = 0; i < ObjectColors.Num(); i += 1)
@@ -43,7 +42,7 @@ bool UPointCloud::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterfac
//Parse Sizes
{
TArray<TSharedPtr<FJsonValue>> ObjectSizes = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField("sizes"), ReadTransport);
TArray<TSharedPtr<FJsonValue>> ObjectSizes = USpeckleObjectUtils::CombineChunks(Obj->GetArrayField(TEXT("sizes")), ReadTransport);
Sizes.Reserve(ObjectSizes.Num());
for (int32 i = 0; i < ObjectSizes.Num(); i += 1)
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Objects/ObjectModelRegistry.h"
@@ -22,65 +21,81 @@ void UObjectModelRegistry::GenerateTypeRegistry()
if (Class->IsChildOf(UBase::StaticClass()) &&
!Class->HasAnyClassFlags(CLASS_Abstract))
{
const FString& SpeckleType = Class->GetDefaultObject<UBase>()->SpeckleType;;
ensureAlwaysMsgf(!TypeRegistry.Contains(SpeckleType),
TEXT("Base class: %s conflicts with: %s for SpeckleType: %s"),
const FString& SpeckleType = Class->GetDefaultObject<UBase>()->SpeckleType;
const FString TypeName = GetTypeName(SpeckleType);
ensureAlwaysMsgf(!TypeRegistry.Contains(TypeName),
TEXT("Base class: %s conflicts with: %s for TypeName: %s"),
*Class->GetName(),
*TypeRegistry[SpeckleType]->GetName(),
*SpeckleType);
TypeRegistry.Add(SpeckleType, *It);
TypeRegistry.Add(TypeName, *It);
}
}
}
TSubclassOf<UBase> UObjectModelRegistry::FindClosestType(const FString& SpeckleType)
bool UObjectModelRegistry::SplitSpeckleType(const FString& SpeckleType, FString& OutRemainder, FString& OutTypeName, const FString& Split)
{
FString TypeString(SpeckleType);
TSubclassOf<UBase> Type = nullptr;
while(!TryGetRegisteredType(TypeString, Type))
if(SpeckleType.Split(Split, &OutRemainder, &OutTypeName, ESearchCase::CaseSensitive, ESearchDir::FromEnd))
{
if(!ParentType(TypeString, TypeString)) return nullptr;
return true;
}
else
{
OutTypeName = SpeckleType;
return false;
}
return Type;
}
bool UObjectModelRegistry::ParentType(const FString& Type, FString& NextType)
FString UObjectModelRegistry::GetTypeName(const FString& SpeckleType)
{
int32 DotSplitIndex;
Type.FindLastChar('.', DotSplitIndex);
int32 ColonSplitIndex;
Type.FindLastChar(':', ColonSplitIndex);
const int32 SplitIndex = FGenericPlatformMath::Max(DotSplitIndex, ColonSplitIndex);
if(SplitIndex <= 0) return false;
NextType = Type.Left(SplitIndex);
return true;
FString Discard, Ret;
SplitSpeckleType(SpeckleType, Discard, Ret);
return Ret;
}
TSubclassOf<UBase> UObjectModelRegistry::GetRegisteredType(const FString& SpeckleType)
FString UObjectModelRegistry::GetSimplifiedTypeName(const FString& SpeckleType)
{
FString Discard, Ret;
SplitSpeckleType(SpeckleType,Discard, Ret, ".");
return Ret;
}
TSubclassOf<UBase> UObjectModelRegistry::GetAtomicType(const FString& SpeckleType)
{
FString WorkingType;
FString Remainder = FString(SpeckleType);
while(SplitSpeckleType(Remainder, Remainder, WorkingType))
{
TSubclassOf<UBase> Type;
if(TryGetRegisteredType(WorkingType, Type))
{
return Type;
}
}
return UBase::StaticClass();
}
TSubclassOf<UBase> UObjectModelRegistry::GetRegisteredType(const FString& TypeName)
{
TSubclassOf<UBase> Type = nullptr;
TryGetRegisteredType(SpeckleType, Type);
TryGetRegisteredType(TypeName, Type);
return Type;
}
bool UObjectModelRegistry::TryGetRegisteredType(const FString& SpeckleType, TSubclassOf<UBase>& OutType)
bool UObjectModelRegistry::TryGetRegisteredType(const FString& TypeName, TSubclassOf<UBase>& OutType)
{
if(TypeRegistry.Num() == 0) GenerateTypeRegistry();
const bool Contains = TypeRegistry.Contains(SpeckleType);
const bool Contains = TypeRegistry.Contains(TypeName);
if(Contains)
{
OutType = *TypeRegistry.Find(SpeckleType);
OutType = *TypeRegistry.Find(TypeName);
}
return Contains;
}
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Objects/Other/BlockInstance.h"
#include "LogSpeckle.h"
@@ -16,19 +15,27 @@ bool UBlockInstance::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInte
//Transform
if(!USpeckleObjectUtils::TryParseTransform(Obj, Transform)) return false;
Transform.ScaleTranslation(FVector(ScaleFactor));
DynamicProperties.Remove("Transform");
DynamicProperties.Remove(TEXT("Transform"));
//Geometries
const TSharedPtr<FJsonObject>* BlockDefinitionPtr;
if(!Obj->TryGetObjectField("blockDefinition", BlockDefinitionPtr)) return false;
//NOTE: This logic differs greatly from sharp/py implementations
const TSharedPtr<FJsonObject>* DefPtr;
if(!(Obj->TryGetObjectField(TEXT("definition"), DefPtr) || Obj->TryGetObjectField(TEXT("blockDefinition"), DefPtr) )) return false;
const FString RefID = BlockDefinitionPtr->operator->()->GetStringField("referencedId");
const TSharedPtr<FJsonObject> BlockDefinition = ReadTransport->GetSpeckleObject(RefID);
const FString RefID = DefPtr->operator->()->GetStringField(TEXT("referencedId"));
const TSharedPtr<FJsonObject> Definition = ReadTransport->GetSpeckleObject(RefID);
if(BlockDefinition->TryGetStringField("name", Name)) DynamicProperties.Remove("Name");
if(!Obj->TryGetStringField(TEXT("name"), Name))
{
if(Definition->TryGetStringField(TEXT("name"), Name))
{
//The instance has no name, so we'll steal it from the definition
DynamicProperties.Add(TEXT("name"), Definition->TryGetField(TEXT("name")));
}
}
const auto Geometries = BlockDefinition->GetArrayField("geometry");
const auto Geometries = Definition->GetArrayField(TEXT("geometry"));
if(Geometries.Num() <= 0)
{
@@ -39,7 +46,7 @@ bool UBlockInstance::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInte
for(const auto& Geo : Geometries)
{
const TSharedPtr<FJsonObject> MeshReference = Geo->AsObject();
const FString ChildId = MeshReference->GetStringField("referencedId");
const FString ChildId = MeshReference->GetStringField(TEXT("referencedId"));
if(ReadTransport->HasObject(ChildId))
{
@@ -49,11 +56,11 @@ bool UBlockInstance::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInte
}
else UE_LOG(LogSpeckle, Warning, TEXT("Block definition references an unknown object id: %s"), *ChildId)
}
DynamicProperties.Remove("geometry");
DynamicProperties.Remove(TEXT("geometry"));
// Intentionally don't remove blockDefinition from dynamic properties,
// because we want the converter to create the child geometries for us
//DynamicProperties.Remove("blockDefinition");
//DynamicProperties.Remove(TEXT("blockDefinition"));
return true;
@@ -0,0 +1,74 @@
#include "Objects/Other/RevitInstance.h"
#include "LogSpeckle.h"
#include "API/SpeckleSerializer.h"
#include "Objects/Utils/SpeckleObjectUtils.h"
#include "Transports/Transport.h"
bool URevitInstance::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITransport> ReadTransport)
{
if(!Super::Parse(Obj, ReadTransport)) return false;
const float ScaleFactor = USpeckleObjectUtils::ParseScaleFactor(Units);
//Transform
if(!USpeckleObjectUtils::TryParseTransform(Obj, Transform)) return false;
Transform.ScaleTranslation(FVector(ScaleFactor));
DynamicProperties.Remove(TEXT("Transform"));
//Geometries
//NOTE: This logic differs greatly from sharp/py implementations
const TSharedPtr<FJsonObject>* DefPtr;
if(!Obj->TryGetObjectField(TEXT("definition"), DefPtr)) return false;
const FString RefID = DefPtr->operator->()->GetStringField(TEXT("referencedId"));
const TSharedPtr<FJsonObject> Definition = ReadTransport->GetSpeckleObject(RefID);
const FString NameKey = TEXT("name");
if(!Obj->TryGetStringField(NameKey, Name))
{
if(Definition->TryGetStringField(NameKey, Name))
{
//The instance has no name, so we'll steal it from the definition
DynamicProperties.Add(NameKey, Definition->TryGetField(NameKey));
}
}
auto Geometries = TArray<TSharedPtr<FJsonValue>>();
const TArray<TSharedPtr<FJsonValue>>* ElementsPtr;
if(Definition->TryGetArrayField(TEXT("elements"), ElementsPtr))
Geometries.Append(*ElementsPtr);
const TArray<TSharedPtr<FJsonValue>>* DisplayValuePtr;
if(Definition->TryGetArrayField(TEXT("displayValue"), DisplayValuePtr))
Geometries.Append(*DisplayValuePtr);
if(Geometries.Num() <= 0)
{
UE_LOG(LogSpeckle, Warning, TEXT("Instance definition has no geometry. id: %s"), *RefID)
return false;
}
for(const auto& Geo : Geometries)
{
const TSharedPtr<FJsonObject> MeshReference = Geo->AsObject();
const FString ChildId = MeshReference->GetStringField(TEXT("referencedId"));
if(ReadTransport->HasObject(ChildId))
{
UBase* Child = USpeckleSerializer::DeserializeBase(ReadTransport->GetSpeckleObject(ChildId), ReadTransport);
if(IsValid(Child))
Geometry.Add(Child);
}
else UE_LOG(LogSpeckle, Warning, TEXT("Block definition references an unknown object id: %s"), *ChildId)
}
DynamicProperties.Remove(TEXT("geometry"));
// Intentionally don't remove blockDefinition from dynamic properties,
// because we want the converter to create the child geometries for us
//DynamicProperties.Remove("blockDefinition");
return true;
}
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Objects/Other/View3D.h"
@@ -11,26 +10,26 @@ bool UView3D::Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<IT
const float ScaleFactor = USpeckleObjectUtils::ParseScaleFactor(Units);
// Parse optional Name property
if(Obj->TryGetStringField("name", Name)) DynamicProperties.Remove("name");
if(Obj->TryGetStringField(TEXT("name"), Name)) { }
// Parse Origin
if(!USpeckleObjectUtils::ParseVectorProperty(Obj, "origin", ReadTransport, Origin)) return false;
if(!USpeckleObjectUtils::ParseVectorProperty(Obj, TEXT("origin"), ReadTransport, Origin)) return false;
Origin *= ScaleFactor;
DynamicProperties.Remove("origin");
DynamicProperties.Remove(TEXT("origin"));
// Parse UpDirection
if(!USpeckleObjectUtils::ParseVectorProperty(Obj, "upDirection", ReadTransport, UpDirection)) return false;
UpDirection *= ScaleFactor;
DynamicProperties.Remove("upDirection");
DynamicProperties.Remove(TEXT("upDirection"));
// Parse ForwardDirection
if(!USpeckleObjectUtils::ParseVectorProperty(Obj, "forwardDirection", ReadTransport, ForwardDirection)) return false;
if(!USpeckleObjectUtils::ParseVectorProperty(Obj, TEXT("forwardDirection"), ReadTransport, ForwardDirection)) return false;
ForwardDirection *= ScaleFactor;
DynamicProperties.Remove("forwardDirection");
DynamicProperties.Remove(TEXT("forwardDirection"));
// Parse IsOrthogonal
if(!Obj->TryGetBoolField("isOrthogonal", IsOrthogonal)) return false;
DynamicProperties.Remove("isOrthogonal");
if(!Obj->TryGetBoolField(TEXT("isOrthogonal"), IsOrthogonal)) return false;
DynamicProperties.Remove(TEXT("isOrthogonal"));
return true;
}
@@ -1,12 +1,14 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Objects/Utils/SpeckleObjectUtils.h"
#include "LogSpeckle.h"
#include "API/SpeckleSerializer.h"
#include "Engine/World.h"
#include "Objects/ObjectModelRegistry.h"
#include "Objects/Geometry/Mesh.h"
#include "Transports/Transport.h"
#include "Serialization/JsonWriter.h"
#include "Serialization/JsonSerializer.h"
TArray<TSharedPtr<FJsonValue>> USpeckleObjectUtils::CombineChunks(const TArray<TSharedPtr<FJsonValue>>& ArrayField, const TScriptInterface<ITransport> Transport)
{
@@ -15,12 +17,12 @@ TArray<TSharedPtr<FJsonValue>> USpeckleObjectUtils::CombineChunks(const TArray<T
for(int32 i = 0; i < ArrayField.Num(); i++)
{
FString Index;
if(ArrayField[i]->AsObject()->TryGetStringField("referencedId", Index))
if(ArrayField[i]->AsObject()->TryGetStringField(TEXT("referencedId"), Index))
{
if(!ensureAlwaysMsgf(Transport->HasObject(Index), TEXT("Failed to Dechunk array, Could not find chunk %s in transport"), *Index))
continue;
const auto Chunk = Transport->GetSpeckleObject(Index)->GetArrayField("data");;
const auto Chunk = Transport->GetSpeckleObject(Index)->GetArrayField(TEXT("data"));;
ObjectPoints.Append(Chunk);
}
else
@@ -36,9 +38,9 @@ bool USpeckleObjectUtils::ResolveReference(const TSharedPtr<FJsonObject> Object,
FString SpeckleType;
FString ReferenceID;
if (Object->TryGetStringField("speckle_type", SpeckleType)
&& SpeckleType == "reference"
&& Object->TryGetStringField("referencedId",ReferenceID))
if (Object->TryGetStringField(TEXT("speckle_type"), SpeckleType)
&& SpeckleType == TEXT("reference")
&& Object->TryGetStringField(TEXT("referencedId"),ReferenceID))
{
check(Transport != nullptr && Transport.GetObject() != nullptr)
@@ -70,6 +72,9 @@ float USpeckleObjectUtils::ParseScaleFactor(const FString& UnitsString)
if (LUnits == "miles" || LUnits == "mile" || LUnits == "mi")
return 160934.4;
if (LUnits == "us_ft" || LUnits == "ussurveyfeet")
return 12000.0 / 3937.0;
return 100;
};
@@ -91,10 +96,10 @@ bool USpeckleObjectUtils::TryParseTransform(const TSharedPtr<FJsonObject> Speckl
const TSharedPtr<FJsonObject>* TransformObject;
const TArray<TSharedPtr<FJsonValue>>* TransformData;
if(SpeckleObject->TryGetArrayField("transform", TransformData)) //Handle transform as array
if(SpeckleObject->TryGetArrayField(TEXT("transform"), TransformData)) //Handle transform as array
{ }
else if(SpeckleObject->TryGetObjectField("transform", TransformObject)
&& (*TransformObject)->TryGetArrayField("value", TransformData)) //Handle transform as object
else if(SpeckleObject->TryGetObjectField(TEXT("transform"), TransformObject)
&& (*TransformObject)->TryGetArrayField(TEXT("matrix"), TransformData)) //Handle transform as object
{ }
else return false;
@@ -131,9 +136,9 @@ bool USpeckleObjectUtils::ParseVector(const TSharedPtr<FJsonObject> Object,
double x = 0, y = 0, z = 0;
if(!(Obj->TryGetNumberField("x", x)
&& Obj->TryGetNumberField("y", y)
&& Obj->TryGetNumberField("z", z))) return false;
if(!(Obj->TryGetNumberField(TEXT("x"), x)
&& Obj->TryGetNumberField(TEXT("y"), y)
&& Obj->TryGetNumberField(TEXT("z"), z))) return false;
OutObject = FVector(x,y,z);
//return true;
@@ -146,7 +151,7 @@ template <typename TBase>
bool USpeckleObjectUtils::ParseSpeckleObject(const TSharedPtr<FJsonObject> Object,
const TScriptInterface<ITransport> Transport, TBase*& OutObject)
{
static_assert(TIsDerivedFrom<TBase, UBase>::IsDerived, "Type TBase must inherit UBase");
static_assert(TIsDerivedFrom<TBase, UBase>::IsDerived, TEXT("Type TBase must inherit UBase"));
TSharedPtr<FJsonObject> Obj;
if(!ResolveReference(Object, Transport, Obj)) Obj = Object;
@@ -170,3 +175,23 @@ FString USpeckleObjectUtils::DisplayAsString(const FString& msg, const TSharedPt
UE_LOG(LogSpeckle, Display, TEXT("resulting jsonString from %s -> %s"), *msg, *OutputString);
return OutputString;
}
FString USpeckleObjectUtils::GetFriendlyObjectName(const UBase* SpeckleObject)
{
FString Prefix;
if(!(SpeckleObject->TryGetDynamicString(TEXT("name"), Prefix)
|| SpeckleObject->TryGetDynamicString(TEXT("Name"), Prefix)
|| SpeckleObject->TryGetDynamicString(TEXT("Family"), Prefix)))
{
Prefix = UObjectModelRegistry::GetSimplifiedTypeName(SpeckleObject->SpeckleType);
}
return FString::Printf(TEXT("%s -- %s"), *Prefix, *SpeckleObject->Id);
}
FString USpeckleObjectUtils::GetBoringObjectName(const UBase* SpeckleObject)
{
const FString Prefix = UObjectModelRegistry::GetSimplifiedTypeName(SpeckleObject->SpeckleType);
return FString::Printf(TEXT("%s -- %s"), *Prefix, *SpeckleObject->Id);
}
@@ -1,11 +1,10 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "ReceiveSelectionComponent.h"
#include "API/Models/SpeckleUser.h"
#include "API/ClientAPI.h"
#include "JsonObjectConverter.h"
#include "LogSpeckle.h"
#include "API/ClientAPI.h"
#include "API/Models/SpeckleUser.h"
#if WITH_EDITOR
void UReceiveSelectionComponent::PostEditChangeProperty(FPropertyChangedEvent& e)
@@ -216,7 +215,7 @@ void UReceiveSelectionComponent::UpdateStreams()
if(!IsAccountValid || bManualMode) return;
const FString LogName(__FUNCTION__);
const FString Payload = FString::Printf(TEXT("{\"query\": \"query{user{id streams(limit: %d){items{id name}}}}\"}"), Limit);
const FString Payload = FString::Printf(TEXT("{\"query\": \"query{activeUser{id streams(limit: %d){items{id name}}}}\"}"), Limit);
//Response Handling
auto OnComplete = [&](const FString& ResponseJson)
@@ -254,7 +253,7 @@ void UReceiveSelectionComponent::UpdateStreams()
FErrorDelegate ErrorDelegate;
ErrorDelegate.BindStatic(LogError, LogName);
FClientAPI::MakeGraphQLRequest(ServerUrl, AuthToken, "user", Payload, LogName, CompleteDelegate, ErrorDelegate);
FClientAPI::MakeGraphQLRequest(ServerUrl, AuthToken, "activeUser", Payload, LogName, CompleteDelegate, ErrorDelegate);
}
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "SpeckleUnreal.h"
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "SpeckleUnrealManager.h"
@@ -56,12 +55,12 @@ void ASpeckleUnrealManager::Receive()
const FString StreamId = ReceiveSelection->StreamId;
const FString ObjectId = ReceiveSelection->ObjectId;
FAnalytics::TrackEvent( ServerUrl, "NodeRun", TMap<FString, FString> { {"name", StaticClass()->GetName() }, {"worldType", FString::FromInt(GetWorld()->WorldType)}});
FAnalytics::TrackEvent( ServerUrl, TEXT("NodeRun"), TMap<FString, FString> { {TEXT("name"), StaticClass()->GetName() }, {TEXT("worldType"), FString::FromInt(GetWorld()->WorldType)}});
FString Message = FString::Printf(TEXT("Fetching Objects from Speckle Server: %s"), *ServerUrl);
PrintMessage(Message);
// Setup network transports
UServerTransport* ServerTransport = UServerTransport::CreateServerTransport(ServerUrl,StreamId,AuthToken);
UServerTransport* ServerTransport = UServerTransport::CreateServerTransport(ServerUrl, StreamId, AuthToken);
if(!KeepCache && LocalObjectCache)
{
@@ -105,7 +104,7 @@ void ASpeckleUnrealManager::HandleReceive(TSharedPtr<FJsonObject> RootObject, bo
else
{
FString Id;
RootObject->TryGetStringField("id", Id);
RootObject->TryGetStringField(TEXT("id"), Id);
FString Message = FString::Printf(TEXT("Failed to deserialise root object: %s"), *Id);
HandleError(Message);
}
@@ -1,5 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "LogSpeckle.h"
#include "Misc/AutomationTest.h"
@@ -56,7 +54,7 @@ bool FReceiveSelectionComponentTest::RunTest(const FString& Parameters)
s->AuthToken = TEST_AUTH_TOKEN;
s->ServerUrl = TEXT("https://latest.speckle.dev");
s->ServerUrl = TEXT("https://latest.speckle.systems");
s->bManualMode = false;
s->Refresh();
@@ -66,6 +64,7 @@ bool FReceiveSelectionComponentTest::RunTest(const FString& Parameters)
ADD_LATENT_AUTOMATION_COMMAND(FCheckValidSelection(this, s));
ADD_LATENT_AUTOMATION_COMMAND(FCheckLimitMatch(this, s));
return true;
#else
TestTrue(TEXT("TEST_AUTH_TOKEN definition exists"), false);
@@ -73,7 +72,6 @@ bool FReceiveSelectionComponentTest::RunTest(const FString& Parameters)
return false;
#endif
return true;
}
#endif
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Misc/AutomationTest.h"
#include "Objects/Base.h"
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Transports/MemoryTransport.h"
@@ -1,9 +1,9 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Transports/ServerTransport.h"
#include "LogSpeckle.h"
#include "Mixpanel.h"
#include "Runtime/Launch/Resources/Version.h"
#include "JsonObjectConverter.h"
#include "HttpModule.h"
#include "Interfaces/IHttpRequest.h"
@@ -35,7 +35,7 @@ void UServerTransport::HandleRootObjectResponse(const FString& RootObjSerialized
TSharedPtr<FJsonObject> RootObj;
if(!LoadJson(RootObjSerialized, RootObj))
{
FString Message = FString::Printf( TEXT("A Root Object %s was recieved but was invalid and could not be deserialied"), *ObjectId);
FString Message = FString::Printf(TEXT("A Root Object %s was recieved but was invalid and could not be deserialied"), *ObjectId);
InvokeOnError(Message);
return;
}
@@ -43,7 +43,7 @@ void UServerTransport::HandleRootObjectResponse(const FString& RootObjSerialized
TargetTransport->SaveObject(ObjectId, RootObj);
// Find children are not already in the target transport
const auto Closures = RootObj->GetObjectField("__closure")->Values;
const auto Closures = RootObj->GetObjectField(TEXT("__closure"))->Values;
TArray<FString> ChildrenIds;
Closures.GetKeys(ChildrenIds);
@@ -71,13 +71,21 @@ void UServerTransport::CopyObjectAndChildren(const FString& ObjectId,
// Create Request for Root Object
const FHttpRequestRef Request = FHttpModule::Get().CreateRequest();
const FString Endpoint = FString::Printf(TEXT("%s/objects/%s/%s/single"), *ServerUrl, *StreamId, *ObjectId);
Request->SetVerb("GET");
Request->SetVerb(TEXT("GET"));
Request->SetURL(Endpoint);
Request->SetHeader("Accept", TEXT("text/plain"));
Request->SetHeader("Authorization", "Bearer " + AuthToken);
Request->SetHeader(TEXT("Accept"), TEXT("text/plain"));
if(!AuthToken.IsEmpty())
Request->SetHeader(TEXT("Authorization"),FString::Printf(TEXT("Bearer %s"), *AuthToken));
Request->SetHeader(TEXT("apollographql-client-name"), TEXT("Unreal Engine"));
Request->SetHeader(TEXT("apollographql-client-version"), SPECKLE_CONNECTOR_VERSION);
// Response Callback
auto ResponseHandler = [=](FHttpRequestPtr, FHttpResponsePtr Response, bool bWasSuccessful) mutable
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3
auto ResponseHandler = [=, this](FHttpRequestPtr, FHttpResponsePtr Response, bool bWasSuccessful) mutable
#else
auto ResponseHandler = [=](FHttpRequestPtr, FHttpResponsePtr Response, bool bWasSuccessful) mutable
#endif
{
if(!bWasSuccessful)
{
@@ -151,16 +159,21 @@ void UServerTransport::FetchChildren(TScriptInterface<ITransport> TargetTranspor
const FHttpRequestRef Request = FHttpModule::Get().CreateRequest();
{
const FString EndPoint = FString::Printf(TEXT("%s/api/getobjects/%s"), *ServerUrl, *StreamId);
Request->SetVerb("POST");
Request->SetVerb(TEXT("POST"));
Request->SetURL(EndPoint);
Request->SetHeader("Accept", TEXT("text/plain"));
Request->SetHeader("Authorization", "Bearer " + AuthToken);
Request->SetHeader("Content-Type", "application/json");
Request->SetHeader(TEXT("Accept"), TEXT("text/plain"));
if(!AuthToken.IsEmpty())
Request->SetHeader(TEXT("Authorization"), FString::Printf(TEXT("Bearer %s"), *AuthToken));
Request->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
Request->SetContentAsString(Body);
}
// Response Callback
auto ResponseHandler = [=](FHttpRequestPtr, FHttpResponsePtr Response, bool bWasSuccessful) mutable
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3
auto ResponseHandler = [=, this](FHttpRequestPtr, FHttpResponsePtr Response, bool bWasSuccessful) mutable
#else
auto ResponseHandler = [=](FHttpRequestPtr, FHttpResponsePtr Response, bool bWasSuccessful) mutable
#endif
{
// Request Fail
if(!bWasSuccessful)
+1 -1
View File
@@ -1,8 +1,8 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
#include "Interfaces/IHttpRequest.h"
#include "Dom/JsonObject.h"
DECLARE_DELEGATE_OneParam(FErrorDelegate, const FString&);
DECLARE_DELEGATE_OneParam(FAPIResponceDelegate, const FString&);
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -36,7 +35,7 @@ struct FSpeckleBranches
GENERATED_BODY();
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
int32 TotalCount;
int32 TotalCount = 0;
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
FString Cursor;
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -56,7 +55,7 @@ struct FSpeckleCommits
GENERATED_BODY();
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
int32 TotalCount;
int32 TotalCount = 0;
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
FString Cursor;
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -28,7 +27,7 @@ struct FSpeckleStream
FString Description;
UPROPERTY(BlueprintReadOnly, Category="Speckle|API Models")
bool IsPublic;
bool IsPublic = false;
UPROPERTY(BlueprintReadOnly, Category="Speckle|API Models")
FString Role;
@@ -68,7 +67,7 @@ struct FSpeckleStreams
GENERATED_BODY();
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
int32 TotalCount;
int32 TotalCount = 0;
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
FString Cursor;
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -33,6 +32,9 @@ struct FSpeckleUser
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
FString Avatar;
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
bool Verified = false;
UPROPERTY(BlueprintReadWrite, Category="Speckle|API Models")
FString Role;
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,5 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -10,7 +9,7 @@
#include "BlockConverter.generated.h"
class UBlockInstance;
class UInstance;
/**
* Converts Speckle Block Instance objects empty native actors with transform.
@@ -37,7 +36,7 @@ public:
virtual UBase* ConvertToSpeckle_Implementation(const UObject* Object) override;
UFUNCTION(BlueprintCallable, Category="ToNative")
virtual AActor* BlockToNative(const UBlockInstance* Block, UWorld* World);
virtual AActor* BlockToNative(const UInstance* Block, UWorld* World);
protected:
virtual AActor* CreateEmptyActor(UWorld* World, const FTransform& Transform, const FActorSpawnParameters& SpawnParameters = FActorSpawnParameters());
@@ -0,0 +1,53 @@
#pragma once
#include "CoreMinimal.h"
#include "Conversion/SpeckleConverter.h"
#include "Engine/EngineTypes.h"
#include "Engine/World.h"
#include "CollectionConverter.generated.h"
class UCollection;
/**
* Converts Speckle Mesh objects into native actors with a procedural mesh component.
*
* Compared with the StaticMeshConverter, this converter has some serious limitations
* - Cannot convert displayValues,
* - N-gon faces will be ignored,
* - Meshes are transient, and won't persist on level reload
*/
UCLASS()
class SPECKLEUNREAL_API UCollectionConverter : public UObject, public ISpeckleConverter
{
GENERATED_BODY()
CONVERTS_SPECKLE_TYPES()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ToNative")
TSubclassOf<AActor> ActorType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ToNative")
TEnumAsByte<EComponentMobility::Type> ActorMobility;
// Sets default values for this actor's properties
UCollectionConverter();
virtual UObject* ConvertToNative_Implementation(const UBase* SpeckleBase, UWorld* World,
TScriptInterface<ISpeckleConverter>& AvailableConverters) override;
virtual UBase* ConvertToSpeckle_Implementation(const UObject* Object) override;
UFUNCTION(BlueprintCallable, Category="ToNative")
virtual AActor* CollectionToNative(const UCollection* SpeckleCollection, UWorld* World);
UFUNCTION(BlueprintCallable, Category="ToNative")
virtual UCollection* CollectionToSpeckle(const AActor* Object);
virtual AActor* CreateEmptyActor(UWorld* World, const FActorSpawnParameters& SpawnParameters = FActorSpawnParameters());
};
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -30,6 +29,9 @@ class SPECKLEUNREAL_API UStaticMeshConverter : public UObject, public ISpeckleCo
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ToNative")
TSet<FString> HiddenTypes;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ToNative")
TSubclassOf<AActor> MeshActorType;
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -10,7 +9,7 @@
#include "SpeckleConverter.generated.h"
UINTERFACE()
UINTERFACE(BlueprintType)
class SPECKLEUNREAL_API USpeckleConverter : public UInterface
{
GENERATED_BODY()
@@ -35,6 +34,7 @@ public:
UObject* ConvertToNative(const UBase* SpeckleBase, UWorld* World, UPARAM(ref) TScriptInterface<ISpeckleConverter>& AvailableConverters);
/// Tries to convert a given Actor or Component into a Speckle Base
/// NOT IMPLEMENTED!!!
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="ToSpeckle")
UBase* ConvertToSpeckle(const UObject* Object);
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -12,12 +11,13 @@ class ITransport;
class ISpeckleConverter;
class UBase;
class UAggregateConverter;
class FJsonValue;
struct FSlowTask;
/**
* An Actor Component for encapsulating recursive conversion of Speckle Objects
*/
UCLASS(ClassGroup=(Speckle), meta=(BlueprintSpawnableComponent))
UCLASS(ClassGroup=(Speckle), meta=(BlueprintSpawnableComponent), HideCategories=(Activation, Collision, Cooking, Tags))
class SPECKLEUNREAL_API USpeckleConverterComponent : public UActorComponent
{
GENERATED_BODY()
-1
View File
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
#include "CoreMinimal.h"
+1 -2
View File
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -16,6 +15,6 @@ protected:
public:
static void TrackEvent(const FString& Server, const FString& EventName);
static void TrackEvent(const FString& Server, const FString& EventName, const TMap<FString, FString>& CustomProperties);
static void TrackEvent(const FString& Email, const FString& Server, const FString& EventName, const TMap<FString, FString>& CustomProperties);
static void TrackEvent(const FString& UserID, const FString& Server, const FString& EventName, const TMap<FString, FString>& CustomProperties);
static FString Hash(const FString& Input);
};
+17 -9
View File
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -13,7 +12,7 @@ class ASpeckleUnrealManager;
/**
* Base type that all Object Models inherit from
*/
UCLASS(BlueprintType, meta=(DisplayName="Base (Speckle.Objects)"))
UCLASS(BlueprintType, meta=(DisplayName="Speckle Object (Base)"))
class SPECKLEUNREAL_API UBase : public UObject
{
public:
@@ -32,27 +31,36 @@ public:
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Speckle|Objects")
FString Id;
TMap<FString, TSharedPtr<FJsonValue>> DynamicProperties; //TODO this won't be serialised!
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Speckle|Objects")
FString Units;
int64 TotalChildrenCount = 0;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Speckle|Objects")
FString ApplicationId;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Speckle|Objects")
FString SpeckleType;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Speckle|Objects")
FString Units;
TMap<FString, TSharedPtr<FJsonValue>> DynamicProperties; //TODO this won't be serialised!
virtual bool Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITransport> ReadTransport)
{
bool IsValid = false;
DynamicProperties = Obj->Values;
if(Obj->TryGetStringField("id", Id))
if(Obj->TryGetStringField(TEXT("id"), Id))
{
IsValid = true;
DynamicProperties.Remove("id");
DynamicProperties.Remove(TEXT("id"));
}
if(Obj->TryGetStringField("units", Units)) DynamicProperties.Remove("units");
if(Obj->TryGetStringField("speckle_type", SpeckleType)) DynamicProperties.Remove("speckle_type");
if(Obj->TryGetStringField(TEXT("units"), Units)) DynamicProperties.Remove(TEXT("units"));
if(Obj->TryGetStringField(TEXT("speckle_type"), SpeckleType)) DynamicProperties.Remove(TEXT("speckle_type"));
if(Obj->TryGetStringField(TEXT("applicationId"), ApplicationId)) DynamicProperties.Remove(TEXT("applicationId"));
if(Obj->TryGetNumberField(TEXT("totalChildrenCount"), TotalChildrenCount)) DynamicProperties.Remove(TEXT("totalChildrenCount"));
return IsValid;
}
@@ -0,0 +1,28 @@
#pragma once
#include "CoreMinimal.h"
#include "Objects/Base.h"
#include "Collection.generated.h"
/**
*
*/
UCLASS()
class SPECKLEUNREAL_API UCollection : public UBase
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, Category="Speckle|Objects")
FString Name;
UPROPERTY(BlueprintReadWrite, Category="Speckle|Objects")
FString CollectionType;
UCollection() : UBase(TEXT("Speckle.Core.Models.Collection")) {}
virtual bool Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITransport> ReadTransport) override;
};
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -11,7 +10,8 @@
class UMesh;
/**
*
* This class does not exist in speckle sharp,
* This is a type to represent objects that have displayValues
*/
UCLASS()
class SPECKLEUNREAL_API UDisplayValueElement : public UBase
@@ -23,7 +23,7 @@ protected:
public:
UDisplayValueElement() : UBase(TEXT("Objects.BuiltElements")) {}
UDisplayValueElement() : UBase(TEXT("Objects.Other.DisplayValueElement")) {}
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Speckle|Objects")
TArray<UMesh*> DisplayValue;
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -24,29 +23,40 @@ private:
static void GenerateTypeRegistry();
public:
/// Attempts to find the closest registered TSubclassOf<UBase>
/// by recursively stripping away a the most specific name specifier from the given SpeckleType
/// until a UBase type is found or the FString is exhausted.
///
/// Eg. with an input of "Objects.Elements.Wall"
/// Will first look for a registered type of "Objects.Elements.Wall"
/// If one is not found, will look for "Objects.Elements" etc.
/// Returns nullptr if none found.
UFUNCTION(BlueprintCallable, Category="Speckle|Objects")
static TSubclassOf<UBase> FindClosestType(const FString& SpeckleType);
/**
* @brief Searches for a closest registered speckle type
* by recursively stripping away a the most specific name specifier from the given SpeckleType
* e.g. With an input of `"Objects.BuiltElements.Wall:Objects.BuiltElements.RevitWall"` will first search for
* Will first look for a registered type of `"Objects.BuiltElements.RevitWall"`, then if not found `"Objects.BuiltElements.Wall"`, then simply will use UBase
* @param SpeckleType The full speckle type
* @return The closest registered type
*/
UFUNCTION(BlueprintCallable, Category="Speckle|Objects")
static bool ParentType(const FString& Type, FString& NextType);
static TSubclassOf<UBase> GetAtomicType(const FString& SpeckleType);
/// Attempts to find a TSubclassOf<UBase> with a UBase::SpeckleType matching the given SpeckleType param
/// Returns nullptr if none found.
// E.g. "Objects.BuiltElements.Wall:Objects.BuiltElements.RevitWall" -> "Objects.BuiltElements.RevitWall"
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Speckle|Objects")
static FString GetTypeName(const FString& SpeckleType);
// E.g. "Objects.BuiltElements.Wall:Objects.BuiltElements.RevitWall" -> "RevitWall"
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Speckle|Objects")
static FString GetSimplifiedTypeName(const FString& SpeckleType);
UFUNCTION(BlueprintCallable, BlueprintPure, Category="Speckle|Objects")
static bool SplitSpeckleType(const FString& SpeckleType, FString& OutRemainder, FString& OutTypeName, const FString& Split = ":");
/**
* @brief Attempts to find a `TSubclassOf<UBase>` with a `UBase::SpeckleType` matching the given SpeckleType param
* @param TypeName
* @return the matching type or `nullptr` if none found.
*/
UFUNCTION(BlueprintCallable, Category="Speckle|Objects")
static TSubclassOf<UBase> GetRegisteredType(const FString& SpeckleType);
static TSubclassOf<UBase> GetRegisteredType(const FString& TypeName);
/// Attempts to find a TSubclassOf<UBase> with a UBase::SpeckleType matching the given SpeckleType param
UFUNCTION(BlueprintCallable, Category="Speckle|Objects")
static bool TryGetRegisteredType(const FString& SpeckleType, TSubclassOf<UBase>& OutType);
static bool TryGetRegisteredType(const FString& TypeName, TSubclassOf<UBase>& OutType);
};
@@ -1,9 +1,8 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
#include "CoreMinimal.h"
#include "Objects/Base.h"
#include "Instance.h"
#include "BlockInstance.generated.h"
@@ -11,22 +10,13 @@
*
*/
UCLASS()
class SPECKLEUNREAL_API UBlockInstance : public UBase
class SPECKLEUNREAL_API UBlockInstance : public UInstance
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Speckle|Objects")
FString Name;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Speckle|Objects")
TArray<UBase*> Geometry;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Speckle|Objects")
FMatrix Transform;
UBlockInstance() : UBase(TEXT("Objects.Other.BlockInstance")) {}
UBlockInstance() : UInstance(TEXT("Objects.Other.BlockInstance")) {}
virtual bool Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITransport> ReadTransport) override;
@@ -0,0 +1,32 @@
#pragma once
#include "CoreMinimal.h"
#include "Objects/Base.h"
#include "Instance.generated.h"
/**
*
*/
UCLASS(Abstract)
class SPECKLEUNREAL_API UInstance : public UBase
{
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Speckle|Objects")
FString Name;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Speckle|Objects")
TArray<UBase*> Geometry;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Speckle|Objects")
FMatrix Transform;
protected:
UInstance(const FString& SpeckleType) : UBase(SpeckleType) {}
UInstance() : UBase(TEXT("Objects.Other.BlockInstance")) {}
};
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -41,25 +40,25 @@ public:
{
if(!Super::Parse(Obj, ReadTransport)) return false;
if(Obj->TryGetStringField("name", Name)) DynamicProperties.Remove("name");
if(Obj->TryGetNumberField("opacity", Opacity)) DynamicProperties.Remove("opacity");
if(Obj->TryGetNumberField("metalness", Metalness)) DynamicProperties.Remove("metalness");
if(Obj->TryGetNumberField("roughness", Roughness)) DynamicProperties.Remove("roughness");
if(!Obj->TryGetStringField(TEXT("name"), Name)) return false;
if(Obj->TryGetNumberField(TEXT("opacity"), Opacity)) DynamicProperties.Remove(TEXT("opacity"));
if(Obj->TryGetNumberField(TEXT("metalness"), Metalness)) DynamicProperties.Remove(TEXT("metalness"));
if(Obj->TryGetNumberField(TEXT("roughness"), Roughness)) DynamicProperties.Remove(TEXT("roughness"));
bool IsValid = false;
int32 ARGB;
if(Obj->TryGetNumberField("diffuse", ARGB))
if(Obj->TryGetNumberField(TEXT("diffuse"), ARGB))
{
Diffuse = FColor(ARGB);
DynamicProperties.Remove("diffuse");
DynamicProperties.Remove(TEXT("diffuse"));
IsValid = true;
}
if(Obj->TryGetNumberField("emissive", ARGB))
if(Obj->TryGetNumberField(TEXT("emissive"), ARGB))
{
Emissive = FColor(ARGB);
DynamicProperties.Remove("emissive");
DynamicProperties.Remove(TEXT("emissive"));
}
return IsValid;
@@ -0,0 +1,23 @@
#pragma once
#include "CoreMinimal.h"
#include "Instance.h"
#include "RevitInstance.generated.h"
/**
*
*/
UCLASS()
class SPECKLEUNREAL_API URevitInstance : public UInstance
{
GENERATED_BODY()
public:
URevitInstance() : UInstance(TEXT("Objects.Other.Revit.RevitInstance")) {}
virtual bool Parse(const TSharedPtr<FJsonObject> Obj, const TScriptInterface<ITransport> ReadTransport) override;
};
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -49,6 +48,10 @@ public:
// Helper function to print a json obj to console
static FString DisplayAsString(const FString& msg, const TSharedPtr<FJsonObject> Obj);
UFUNCTION(BlueprintCallable, Category="Speckle/ObjectUtils", BlueprintPure)
static FString GetFriendlyObjectName(const UBase* SpeckleObject);
UFUNCTION(BlueprintCallable, Category="Speckle/ObjectUtils", BlueprintPure)
static FString GetBoringObjectName(const UBase* SpeckleObject);
};
@@ -1,18 +1,19 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "API/Models/SpeckleStream.h"
#include "ReceiveSelectionComponent.generated.h"
/**
* Actor component for selecting a Speckle Stream + Object
* Either by Stream Id + Object Id (Object selection mode)
* Or by Stream + Branch + Commit (Commit selection mode)
*/
UCLASS(ClassGroup=(Speckle), meta=(BlueprintSpawnableComponent))
UCLASS(ClassGroup=(Speckle), meta=(BlueprintSpawnableComponent), HideCategories=(Activation, Collision, Cooking, Tags))
class SPECKLEUNREAL_API UReceiveSelectionComponent : public UActorComponent
{
GENERATED_BODY()
@@ -21,7 +22,7 @@ public:
// URL of the speckle server
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Speckle")
FString ServerUrl = "https://speckle.xyz";
FString ServerUrl = "https://app.speckle.systems";
// A Personal Access Token can be created from your Speckle Profile page (Treat tokens like passwords, do not share publicly)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Speckle", meta=(PasswordField=true))
@@ -125,7 +126,7 @@ protected: //Internal logic for branch/stream/commit fetching and selection
#pragma endregion
#pragma region Branch
UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Category="Speckle", meta=(DisplayName="Branch", GetOptions=GetBranchOptions, EditCondition="IsStreamValid && !bManualMode", NoResetToDefault))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Category="Speckle", meta=(DisplayName="Branch", GetOptions=GetBranchOptions, EditCondition="IsAccountValid && !bManualMode", NoResetToDefault))
FString SelectedBranchText;
UPROPERTY(BlueprintReadOnly, Transient, Category="Speckle")
@@ -149,7 +150,7 @@ protected: //Internal logic for branch/stream/commit fetching and selection
#pragma endregion
#pragma region Commit
UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Category="Speckle", meta=(DisplayName="Commit", GetOptions=GetCommitOptions, EditCondition="IsCommitValid && !bManualMode", NoResetToDefault))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Category="Speckle", meta=(DisplayName="Commit", GetOptions=GetCommitOptions, EditCondition="IsAccountValid && !bManualMode", NoResetToDefault))
FString SelectedCommitText;
UPROPERTY(BlueprintReadOnly, Transient, Category="Speckle")
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -14,7 +13,7 @@ class FJsonObject;
/**
* An Actor to handle the receiving of Speckle objects into a level
*/
UCLASS(ClassGroup=(Speckle), AutoCollapseCategories=("Speckle|Conversion"), BlueprintType)
UCLASS(ClassGroup=(Speckle), AutoCollapseCategories=("Speckle|Conversion"), BlueprintType, HideCategories = (Collision, Rendering, Replication, HLOD, Physics, Networking, Input, Actor))
class SPECKLEUNREAL_API ASpeckleUnrealManager : public AActor
{
GENERATED_BODY()
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
+12 -3
View File
@@ -1,3 +1,4 @@
using UnrealBuildTool;
public class SpeckleUnreal : ModuleRules
@@ -6,9 +7,17 @@ public class SpeckleUnreal : ModuleRules
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDefinitions.Add("SUPPRESS_SPECKLE_ANALYTICS=0");
PublicIncludePaths.AddRange(
// #if UE_5_2_OR_LATER
// IWYUSupport = IWYUSupport.Full;
// #else
// bEnforceIWYU = true;
// #endif
//
// bUseUnity = false;
PublicDefinitions.Add("SPECKLE_CONNECTOR_VERSION=\"2.19.0\"");
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
@@ -1,5 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "Conversion/ConverterFactory.h"
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#include "SpeckleUnrealEditorModule.h"
@@ -34,7 +33,8 @@ void FSpeckleUnrealEditorModule::StartupModule()
// Create FConverterActions for USpeckleConverter types
if ( Class->ImplementsInterface(USpeckleConverter::StaticClass())
&& !Class->HasAnyClassFlags(CLASS_Abstract))
&& !Class->HasAnyClassFlags(CLASS_Abstract)
&& !Class->GetFName().ToString().Contains(TEXT("REINST"))) //Ignore hot-reloaded BPs
{
AssetTools.RegisterAssetTypeActions(MakeShareable(new FConverterActions(Class, SpeckleAssetCategoryBit)));
}
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,4 +1,3 @@
// Copyright 2022 AEC Systems, Licensed under the Apache License, Version 2.0
#pragma once
@@ -1,3 +1,4 @@
using UnrealBuildTool;
public class SpeckleUnrealEditor : ModuleRules

Some files were not shown because too many files have changed in this diff Show More