Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blender 3.6.2 support #391

Open
wants to merge 46 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1a94632
WIP blender 3.5 support
schinkowski Apr 7, 2023
a8bfe15
Updating docs
schinkowski Apr 18, 2023
7f19279
WIP 3.5 support
schinkowski Apr 19, 2023
d14a48b
Removing unused code.
schinkowski Apr 19, 2023
cd351fc
Upgrading to VS 2022 to fix compiler errors.
schinkowski Apr 20, 2023
ef4acf0
Removing unused code.
schinkowski Apr 21, 2023
b69b96b
Updating docs for new blender version support.
schinkowski Apr 21, 2023
234ef44
Updating docs and script for vs 2022
schinkowski Apr 25, 2023
c9c58d6
Fix for debug logs and uninitialized variable.
schinkowski Apr 27, 2023
5339544
Merge branch 'material_export_fix' of https://github.com/Unity-Techno…
schinkowski Apr 27, 2023
ed11c98
Don't do custom mirror modifier bake for instances.
schinkowski May 16, 2023
5a1f3c5
Fix for null ref.
schinkowski May 16, 2023
444f1fc
Fixes for instancing
schinkowski May 23, 2023
d48011f
Fix for nested instances, don't send duplicate instances.
schinkowski May 23, 2023
cb237a4
Fix to mark external file objects correctly.
schinkowski May 24, 2023
e80af95
Mark instance meshes as deleted if they are changed to be references …
schinkowski May 25, 2023
930e0e9
Fix to handle nested instances correctly.
schinkowski May 30, 2023
a84a4a6
Don't mark instance meshes dirty every update. We can use the hash to…
schinkowski Jun 1, 2023
aeed7a9
Use path provider to ensure instances use their correct path for prop…
schinkowski Jun 2, 2023
2ac32e6
Fix for image paths coming from libraries
schinkowski Jun 2, 2023
ddcb93e
Allow instancing empty objects.
schinkowski Jun 2, 2023
33e2b18
don't us enormals for hashing in blender
schinkowski Jun 6, 2023
79ab68b
Export bones if they have custom properties.
schinkowski Jun 12, 2023
3db393d
Take custom properties into account when hashing entities
schinkowski Jun 12, 2023
cef23c8
Revert "Take custom properties into account when hashing entities"
schinkowski Jun 12, 2023
3aeb57e
Refactoring and bug fixes
schinkowski Jun 13, 2023
0e27426
WIP, instance fixes
schinkowski Jun 15, 2023
4ca6e4c
Refactoring
schinkowski Jun 15, 2023
1994c0d
Removing not needed child instance path provider.
schinkowski Jun 20, 2023
db46598
Don't round normals.
schinkowski Jun 21, 2023
58a8cdb
Merge branch 'dev' of https://github.com/Unity-Technologies/MeshSyncD…
schinkowski Jun 21, 2023
b12e07f
merge issue fix
schinkowski Jun 21, 2023
efa5b0a
Handle empty instanced meshes.
schinkowski Jul 5, 2023
9c4de91
Append library name to object names to ensure uniqueness.
schinkowski Jul 10, 2023
ac1ac24
Send all objects in the file, not just the scene. This fixes a lot of…
schinkowski Aug 1, 2023
7456c7e
Merge pull request #390 from Unity-Technologies/chris_working_branch
schinkowski Aug 1, 2023
03bbb78
Updating version
schinkowski Aug 1, 2023
def7d27
Updating version
schinkowski Aug 1, 2023
794b9ca
Adding meta file
schinkowski Aug 2, 2023
3e3fbc9
Rebuilt package
schinkowski Aug 23, 2023
9ec80ba
Adding blender 3.6.2 support
schinkowski Aug 31, 2023
dd2c08b
Fix for instances not being sent
schinkowski Sep 1, 2023
8ef4abb
Updating docs
schinkowski Sep 1, 2023
54f1b60
Updating docs.
schinkowski Sep 1, 2023
5d99b27
Updating build files
schinkowski Sep 1, 2023
889dedc
Fix for meshes not getting deleted.
schinkowski Sep 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [0.18.0-preview] - 2023-08-01

### Added
* feat: Blender 3.5 and Blender 3.6.2 support
* feat: Improved instancing support

### Changed
* change: instances are now sent in a way that allows the same object to be instanced on multiple parents and keep that hierarchy in Unity

### Fixed
* fix: various instancing fixes

## [0.17.1-preview] - 2023-06-13

### Added
Expand Down
2 changes: 2 additions & 0 deletions Documentation~/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ This allows devs to immediately see how things will look in-game while modelling
| Blender 3.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Blender 3.3 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Blender 3.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Blender 3.5 | :white_check_mark: | :x: | :x: |
| Blender 3.6.2 | :white_check_mark: | :x: | :x: |

Notes:
* :white_check_mark: : Supported
Expand Down
Binary file modified Editor/Plugins/UnityMeshSync_3DSMAX_Windows.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Editor/Plugins/UnityMeshSync_3DSMAX_Windows.zip.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Editor/Plugins/UnityMeshSync_Blender_Linux.zip
Binary file not shown.
7 changes: 0 additions & 7 deletions Editor/Plugins/UnityMeshSync_Blender_Linux.zip.meta

This file was deleted.

Binary file removed Editor/Plugins/UnityMeshSync_Blender_Mac.zip
Binary file not shown.
7 changes: 0 additions & 7 deletions Editor/Plugins/UnityMeshSync_Blender_Mac.zip.meta

This file was deleted.

Binary file modified Editor/Plugins/UnityMeshSync_Blender_Windows.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Editor/Plugins/UnityMeshSync_Blender_Windows.zip.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Editor/Plugins/UnityMeshSync_Maya_Linux.zip
Binary file not shown.
7 changes: 0 additions & 7 deletions Editor/Plugins/UnityMeshSync_Maya_Linux.zip.meta

This file was deleted.

Binary file removed Editor/Plugins/UnityMeshSync_Maya_Mac.zip
Binary file not shown.
7 changes: 0 additions & 7 deletions Editor/Plugins/UnityMeshSync_Maya_Mac.zip.meta

This file was deleted.

Binary file modified Editor/Plugins/UnityMeshSync_Maya_Windows.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Editor/Plugins/UnityMeshSync_Maya_Windows.zip.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Editor/Plugins/UnityMeshSync_MotionBuilder_Linux.zip
Binary file not shown.
7 changes: 0 additions & 7 deletions Editor/Plugins/UnityMeshSync_MotionBuilder_Linux.zip.meta

This file was deleted.

Binary file not shown.
7 changes: 0 additions & 7 deletions Editor/Plugins/UnityMeshSync_MotionBuilder_Windows.zip.meta

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [0.18.0-preview] - 2023-08-01

### Added
* feat: Blender 3.5 and Blender 3.6.2 support
* feat: Improved instancing support

### Changed
* change: instances are now sent in a way that allows the same object to be instanced on multiple parents and keep that hierarchy in Unity

### Fixed
* fix: various instancing fixes

## [0.17.1-preview] - 2023-06-13

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.unity.meshsync.dcc-plugins",
"displayName":"MeshSync DCC Plugins",
"version": "0.17.1-preview",
"version": "0.18.0-preview",
"unity": "2020.3",
"description": "This package contains plugin binaries of DCC tools for using MeshSync, which is another package for synchronizing meshes/models editing in DCC tools into Unity in real time.",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" /version [15.0^,16^) /property installationPath`) do (
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" /version 17^ /property installationPath`) do (
set VSDIR=%%i
echo %%i
)
set VSCMD_DEBUG=True
call "%VSDIR%\Common7\Tools\VsDevCmd.bat"
cd %~dp0
2 changes: 1 addition & 1 deletion Plugins~/Build/make_meshsync_dcc_plugin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ IF %ARG_COUNT% GEQ 2 (
SET CMAKE_BUILD_ARGS=%*
)

SET BUILD_SYSTEM=-G "Visual Studio 15 2017" -A x64
SET BUILD_SYSTEM=-G "Visual Studio 17 2022" -A x64

ECHO cmake build Arguments: %CMAKE_BUILD_ARGS%
cmake -UBUILD_*_PLUGIN -UBUILD_*_ALL -DMESHSYNC_VER:STRING=%MESHSYNC_VER% %CMAKE_BUILD_ARGS% %BUILD_SYSTEM% ..
2 changes: 2 additions & 0 deletions Plugins~/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ list(APPEND BLENDER_VERSIONS
BLENDER_3.2.0
BLENDER_3.3.0
BLENDER_3.4.0
BLENDER_3.5.0
BLENDER_3.6.2
)

if(BUILD_BLENDER_ALL)
Expand Down
12 changes: 6 additions & 6 deletions Plugins~/Docs/en/BuildDCCPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
Make sure to choose one of the "Add CMake to the System PATH ..." options as shown below.
![CMakeInstallation](../Images/CMakeInstallation.png)

1. Install Visual Studio 2017, together with the following components:
1. Install Visual Studio 2022, together with the following components:
* Windows 8.1 SDK
* Windows Universal CRT SDK

1. Install git. For example: [SourceTree](https://www.sourcetreeapp.com/)
1. Build [Poco](https://pocoproject.org) (static libraries).
* Download [Poco 1.10.1](https://github.com/pocoproject/poco/archive/poco-1.10.1-release.zip) and extract the file in a folder.
* Start "Developer Command Prompt for VS 2017" and go to where Poco was extracted.
* Start "Developer Command Prompt for VS 2022" and go to where Poco was extracted.
* Execute the following in the command prompt:
```
$ mkdir cmake-build
$ cd cmake-build
$ cmake .. -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 15 2017" -A x64
$ cmake .. -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 17 2022" -A x64
$ cmake --build . --config Release && cmake --build . --config Debug
```

Expand All @@ -41,7 +41,7 @@
### Build Steps (Win)


Start "Developer Command Prompt for VS 2017" and execute the following:
Start "Developer Command Prompt for VS 2022" and execute the following:

```
$ git clone https://github.com/Unity-Technologies/MeshSyncDCCPlugins
Expand All @@ -57,9 +57,9 @@ $ cmake -DBUILD_TYPE=Release -P cmake_install.cmake
* `[optional_arguments]`
See [MakeOptionalArguments](MakeOptionalArguments.md) for more details.

> For a regular "Command Prompt", there is a script: *VsDevCmd_2017.bat*
> For a regular "Command Prompt", there is a script: *VsDevCmd_2022.bat*
> under the *Build* folder, which if executed, will turn the prompt into a
> "Developer Command Prompt for VS 2017".
> "Developer Command Prompt for VS 2022".

#### Notes

Expand Down
1 change: 1 addition & 0 deletions Plugins~/Docs/en/MakeOptionalArguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ with commands described in the following sections.
* Blender 3.2.0 : `-DBUILD_BLENDER_3.2.0_PLUGIN=ON`
* Blender 3.3.0 : `-DBUILD_BLENDER_3.3.0_PLUGIN=ON`
* Blender 3.4.0 : `-DBUILD_BLENDER_3.4.0_PLUGIN=ON`
* Blender 3.5.0 : `-DBUILD_BLENDER_3.5.0_PLUGIN=ON`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No 3.6.0 here?


## Modo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ struct InstancesManagerRecord
{
bool dirtyInstances = false;
bool dirtyMesh = false;
InstanceInfoPtr instances = nullptr;
TransformPtr entity = nullptr;
bool updated = false;
std::map<std::string, bool> updatedParents;
std::map<std::string, std::vector<InstanceInfoPtr>> instancesPerParent;
};

/// <summary>
Expand Down Expand Up @@ -74,6 +75,8 @@ class InstancesManager : public TransformManager<InstancesManagerRecord>
/// </summary>
void eraseStaleEntities() override;

bool erase(const std::string& path);

bool needsToApplyMirrorModifier() override { return false; }
};

Expand Down
70 changes: 62 additions & 8 deletions Plugins~/Src/MeshSyncClient/msInstancesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,50 @@ namespace ms {
}
return ret;
}

vector<InstanceInfoPtr> InstancesManager::getDirtyInstances()
{
vector<InstanceInfoPtr> ret;
for (auto& p : m_records) {
InstancesManagerRecord& r = p.second;
if (r.dirtyInstances) {
ret.push_back(r.instances);
for (auto& instances : r.instancesPerParent)
{
ret.insert(ret.end(), instances.second.begin(), instances.second.end());
}
}
}

// Sort by parent to ensure children are grouped correctly by the server:
sort(ret.begin(), ret.end(), [](const InstanceInfoPtr& a, const InstanceInfoPtr& b) {
return a->parent_path < b->parent_path;
});

return ret;
}

vector<Identifier>& InstancesManager::getDeleted() {
return m_deleted;
}

bool InstancesManager::erase(const std::string& path) {
auto it = m_records.find(path);
if (it != m_records.end()) {
m_records.erase(it);
m_deleted.push_back({ path, InvalidID });
return true;
}
return false;
}

void InstancesManager::clearDirtyFlags()
{
for (auto& p : m_records) {
InstancesManagerRecord& r = p.second;
r.dirtyInstances = false;
r.dirtyMesh = false;
r.updated = false;
r.updatedParents.clear();
}

m_deleted.clear();
Expand All @@ -60,13 +81,25 @@ namespace ms {
void InstancesManager::add(InstanceInfoPtr info)
{
auto& rec = lockAndGet(info->path);

for (int i = 0; i < rec.instancesPerParent[info->parent_path].size(); ++i)
{
const auto& instance = rec.instancesPerParent[info->parent_path][i];

if (m_always_mark_dirty || rec.instances == nullptr) {
rec.dirtyInstances = true;
if (instance->parent_path == info->parent_path)
{
// Remove instance from the list, the new one will be added below:
rec.instancesPerParent[info->parent_path].erase(rec.instancesPerParent[info->parent_path].begin() + i);

break;
}
}

rec.updated = true;
rec.instances = info;
// instanceInfos need to be sent every update because it's how the server knows which instances are still alive:
rec.dirtyInstances = true;

rec.instancesPerParent[info->parent_path].push_back(info);
rec.updatedParents[info->parent_path] = true;
}

void InstancesManager::clear()
Expand All @@ -85,13 +118,34 @@ namespace ms {
{
for (auto it = m_records.begin(); it != m_records.end(); ) {
if (!it->second.updated) {
if (it->second.instances) {
m_deleted.push_back(it->second.instances->getIdentifier());
}
m_records.erase(it++);
}
else
{
// Remove records to parents that were not updated:
auto& parentMap = it->second.instancesPerParent;
auto& updatedParents = it->second.updatedParents;

for (auto parentMap_it = parentMap.cbegin(), nextParentMap_it = parentMap_it;
parentMap_it != parentMap.cend();
parentMap_it = nextParentMap_it)
{
++nextParentMap_it;

auto& instances = parentMap_it->second;

for (auto& instance : instances)
{
auto& parentPath = instance->parent_path;
if (!updatedParents[parentPath])
{
parentMap.erase(parentPath);
}
}
}

++it;
}
}
}
}
1 change: 1 addition & 0 deletions Plugins~/Src/MeshSyncClient/msPropertyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace ms {
std::unique_lock<std::mutex> lock(m_mutex);

vector<PropertyInfoPtr> ret;
ret.reserve(m_records.size());

for (const auto& [key, propertyInfo] : m_records) {
ret.push_back(propertyInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace blender
void world_matrix(mu::float4x4* world_matrix);
Object* parent();
Object* object();
private:
public:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this an intentional change?

PointerRNA& m_instance;
};

Expand Down
Loading