Ok, I think it’s not a big deal if the group & parent don’t work for now. But my point is, if you have a “Mesh A” with a pivot point in the center of it, you duplicate “Mesh A” (in instance, I guess), but for some reason (honestly, I do that all the time) you need to change the pivot point just on one Mesh, what happens in this case ? All pivots move ? All Meshes moves in UE4 but not in Maya ? Something else ?
as long as you don’t “Freeze Transformations” the actual origin of the mesh (the origin from which the vertex-positions are measured) will still be the same, no matter where you move the pivot(s)
That means, I can always figure out how the actual transform of a mesh is, measured from that origin. This is also the position that will be moved to the world origin before exporting. So, the “mesh origin” will always match up between meshes in maya and UE, no matter where your pivots in maya are.
If you move the pivot on one mesh, the other meshes will not be touched in the slightest.
I will put a video up where I show that maya-pivot-hell now works, within the next few days.
If you want to get the origin of a mesh to another position, you will have to freeze transformations. But that will actually alter the geometry, so two meshes, although looking exactly the same, will be different objects. But that is the point of freezing transformations, although some people don’t know the consequences.
Ok great, do you plan to port your script for UE 4.3 (and more) or you stay to the 4.2 ? Speedy37 (our programer, he created the converter UDK to UE4) try to compile it for the 4.3 and he told me you used some private thing and if I want to used it, he need to upload a big file.
Very cool, i see this type of workflow being industry standard in the future, hopefully…
It just makes sense.
Thank you . Yes, cinema4d can talk python. Unfortunately I’m not a programmer. But I’ll try
Yeah it does python fine, I initially thought I would deal with outputting the correct text file, just so happens I wrote a basic Python script about year or so ago for C4D to export positions of cloners for stadium seating…
So with this, the in DCC plugin has to connect to a server that is running in UE?
Not sure what he means, I only use Engine-code and my .dylib is about 500kB in size. But yes, I plan to visit a Friend tonight and use his unlimited supplies of internets to download 4.3 for my mac and my PC, so I might be able to supply a compiled .dll tomorrow or so, depending on how problematic the conversion to 4.3 will be.
Outputting a text file would be a good start I think.
The m2uPlugin (the UE plugin) will start a TCP listener (server) when the plugin is loaded. Currently the listening address is hardcoded (localhost:3939).
On the m2u side (the python script). When telling m2u to “initialize” it is told which Program (Maya, Max, …) it should load and which Editor (UEngine, Unity, …) it should use. m2u will then load the modules for those if they exist (a folder named accordingly inside the m2u directory).
Those Program and Editor modules have to provide an Interface, a certain set of functions that is common across them (which is currently changing constantly, because… WIP).
So all a Cinema4D module for m2u would have to do is, provide the correct interface functions (and a UI, until there might be a common UI across all programs) and internally make the correct calls to the Editor module’s interface (getting the module using m2u.core.getEditor())
The python->TCP->UEngine->DoStuff will then be handled by the ue4 python module and the m2uPlugin.
If you, for some reason, don’t want to adhere to the m2u structure, you have to make a TCP connection to the m2uPlugin yourself and send the correctly formatted commands, where the provided m2u implementation should be the reference.
Would certainly be great to have a working version for 4.3!
EXCELLENT WORK! This is one of the best things i’ve see so far this year!
thank you guys :o
It took a while, fighting with Visual Studio, but I got it to work with 4.3 and 4.4 on Windows and Mac of course.
( I uninstalled all my old VS and reinstalled VS2013 again only to find out my Anti-virus program was the cause of UBT not being able to compile… )
latest additions:
- you can unleash pivots in maya, the transforms of the objects are taken from their actual origins now.
- added display layer syncing, adding, removing, renaming layers and changing membership of objects. (a bit buggy sometimes)
(- disabled parenting syncing until I will implement adding empty transforms in UE for maya’s group transforms)
A Note on Layers:
Maya allows an object to be member of one and only one layer at a time. UE allows objects to be member in multiple layers, though the object will only be hidden if all layers of which it is member are hidden. When using layer syncing, a member-change will always tell UE to remove the object from all other layers. So we will force Maya’s Display Layer behaviour onto UE here.
A Note on Grouping / Parenting:
You can use groups in maya and children of that group will be transformed correctly. But beware of duplicating groups or so, as there is no name-checking currently implemented for that case. Normally the children of a duplicated group in maya will have the same names as their originals, but will be prefixed (namespace) by their parent.
so duplicating a group1 with children pCube1 and pCube2 will generate a group2 with children group2|pCube1 and group2|pCube2. This will cause any names involved in this to be unfindable in UE, so the sync will be broken until you make sure you rename the duplicated objects with unique names.
In some future update, there will be a name syncing for duplicated children, but not yet.
To use it:
You will have to compile it yourself, because you have to make a change to one engine source file to compile on Windows!
1.) get the tag from here: https://bitbucket.org/m2u/m2uue4plugin/commits/tag/v0.2
2.) do the following change to line 7 in /Source/Editor/UnrealEd/Classes/Factories/FbxFactory.h
from
class UFbxFactory : public UFactory
to
class UNREALED_API UFbxFactory : public UFactory
This will make sure that UFbxFactory class is exported from the library and the m2uPlugin can find it when linking to it. This step is not necessary on Mac, only on Windows!
3.) recompile the Engine and the plugin.
4.) start the Editor and enable m2uPlugin under the Editor tab in the Plugin manager. You will have to restart the Editor.
For Maya:
1.) check out the develop branch from here: https://bitbucket.org/m2u/m2u/branch/develop
2.) put the path to the directory where the m2u directory is located to the python path and initalize m2u:
import m2u
m2u.core.initialize("maya","ue4")
from m2u.maya import mayaInternalUI
mayaInternalUI.createUI()
Changing the FbxFactory.h file should only be a temporary solution. I will either file a request to epic to make that change in a future engine version or I will have to copy more code from the UFbxFactory and derive from UFactory instead, but I would have to move my code to a repository on Github which restricts access to Users having access to Epics current engine repository, because that would be a lot of copy-pasted engine code then. We will see.
Been trying to compile this unsuccessfully, so this comes at a great time. Even with the new version I keep having a problem with UBT where it complains about SlateCore:
Binding IntelliSense data... 0%ERROR: Exception thrown while processing dependent modules of m2uPlug...
in
ERROR: Couldn't find module rules file for module 'SlateCore'.
Goes away when I comment out the SlateCore part in the build file, is that ok?
Edit: ah never mind, I was on 4.1 by mistake. Trying on 4.3.
If it builds successfully then it should be ok, i guess.
I haven’t had that error yet and I added the slate-references when I got an unresolved external symbol from some engine-class that uses Slate. But maybe adding SlateCore was not necessary.
Yeah compiled fine, thanks. I grabbed the Maya bit but can’t seem to figure what you mean by this:
in a managed environment (pipeline), there are certain places where you put scripts, which are by default added to the pythonpath by maya. Those are environment variables pointing to certain directories (PYTHONPATH, MAYA_SCRIPT_PATH)
If you don’t want to care about setting up those paths (because you don’t use many more other scripts or so), you can just add to the pythonpath within python by executing this:
import sys
sys.path.append("C:/path/to/folder/in/which/m2u/folder/lies")
so if you put the m2u folder into “C:/temp” then add that to the path, NOT “C:/temp/m2u”
Alright, now I have the m2u window loaded in Maya but it seems I can’t connect.
# Error: m2u.udk.udkUI : No UDK instance found. #
I have the UE4 editor running and the plugin is enabled. Anything else I need to do?
Oh right, it’s going to udk folder instead of ue4 for some reason?
you need to run initialize explicitly with the parameters telling it to initialize for UE4, not UDK (which still is the default in code, maybe i should remove default parameters from that function)
m2u.core.initialize("maya","ue4")
This is looking amazing! Any plans to support the collision authoring tools in the editor? Right now the interaction tools and camera controls are pretty rough in some of the tools. This could help out with that tremendously!
Ok so connect seems to work, but using “Sync Camera” or “Fetch Selected” results in Maya freezing and me having to kill it in Task Manager. And “Send Selected To Editor” produces:
# m2u.maya.mayaCommand : found 1 selected meshes
# m2u.maya.mayaCommand : found 1 untagged
# m2u.maya.mayaCommand : found 0 tagged
# m2u.maya.mayaCommand : found 0 tagged uniques
# m2u.maya.mayaCommand : assuming new untagged unique: pSphere1
# m2u.maya.mayaCommand : found 1 uniques (with untagged)
# m2u.maya.mayaCommand : settings file path is: D:\GitHub\m2u\ue4/ue4FBXSettings.fbxexportpreset
// Error: Preset file not found. //
// Error: **D:GitHubm2uue4\**ue4FBXSettings.fbxexportpreset //
# Error: MelError: file D:\3d\Autodesk\Maya2015\Python\lib\site-packages\pymel\core\language.py line 835: Error during execution of MEL script: Preset file not found.
D:GitHubm2uue4\ue4FBXSettings.fbxexportpreset
Script:
FBXLoadExportPresetFile -f "D:\GitHub\m2u\ue4/ue4FBXSettings.fbxexportpreset"; #
Now GitHub may sound a bit odd since you’re on Bitbucket, I just wanted to have it all in one place. Not that it matters of course. But the red part seems to be missing some slashes? Maybe an issue with backslashes on Windows or something? Tried to reverse the slash in the PYTHONPATH environment variable, that did nothing though.
the missing slashes should be fixed, please make sure you checkout the develop branch, not the master branch!
the freezing might be caused by the tcp not being able to connect to localhost, maybe caused by a firewall or your machine being in a LAN. It was only recently that I came across the same problem and I’m not sure about the solution to that problem yet.
please execute the two following command in a python shell, when the editor is running and m2uPlugin is loaded:
import socket
# client code
s=None
def openConnection(TCP_IP = '127.0.0.1', TCP_PORT=3939):
BUFFER_SIZE = 1024
global s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
openConnection()
the log-window in the Editor should tell you if a connection was made. Otherwise you will get an error by python, that the connection has been refused.
Thank you. You mean the other editor windows, like the Static Mesh Editor? I didn’t think of that yet, I think the most used means of collision authoring would be to create UCX prefixed meshes in the 3d-authoring program and export them with the mesh to the FBX file? But I did not actively investigate anything in the form of syncing collision yet.
So sorry, my origin pointed to https://bitbucket.org/m2u/m2u/branch/develop yet I still get the master branch unless I manually switch to the develop branch. God I hate version control. It’s fixed now, both m2u and your shell code connect successfully and everything else works as expected as well.
Thanks for the support. Hopefully I’ll be able to help others who might run into the same troubles.