Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to configure Fbx import settings? #488

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

Open
yuchen-sketch opened this issue Jul 30, 2018 · 15 comments
Open

How to configure Fbx import settings? #488

yuchen-sketch opened this issue Jul 30, 2018 · 15 comments

Comments

@yuchen-sketch
Copy link

Hi all,
I am trying to do something with importing heaps of fbx files coming from maya automatically.
I just read some provieded docs and scripts, and followed the Kaiju example.
However, I just found there is no docs talking about how to set other import settings like 'convert scene', 'combine meshes'.
And I also tried

fbx_factory.ImportUI.bConvertScene = True
fbx_factory.ImportUI.bCombineMeshes = True

which seemed not working.

I am just wondering how I can configure other settings while importing fbx files, and where I can get all api things.

Anyone can help me?

Thanks

@rdeioris
Copy link
Contributor

Hi, the python api maps 1:1 with the C++ one, so you can get the infos from official docs; https://api.unrealengine.com/INT/API/Editor/UnrealEd/Factories/UFbxImportUI/index.html

But honestly that docs are not so handy.

Just print the properties() return value to get the list of related options.

In your case you would end with fbx_factory.ImportUI.StaticMeshImportData.bConvertScene

@yuchen-sketch
Copy link
Author

Cool, man.
Thank you so much.

@yuchen-sketch
Copy link
Author

yuchen-sketch commented Jul 31, 2018

Hi, I just tried the StaticMeshImportData.
The good news was that the bCombineMeshes worked.
However, the bConvertScene still not working.

I also tried
fbx_factory.ImportUI.SkeletalMeshImportData.bConvertScene = True
and
fbx_factory.ImportUI.AnimSequenceImportData.bConvertScene = True

the imported model's coordinator was not converted yet.

However, if i do it mannually, check or uncheck the 'convert scene' would affect the result.
Not sure what else I should do for this problem.

@rdeioris
Copy link
Contributor

You need to choose the right *ImportData object based on what you are importing. If you are importing a skeletal mesh you will use SkeletalMeshImportData and so on.

@yuchen-sketch
Copy link
Author

from unreal_engine.classes import PyFbxFactory
from unreal_engine.enums import EFBXImportType

fbx_factory = PyFbxFactory()
temp_fbx = r"X:\Temp\HRJ\XL\lantern.fbx"

fbx_factory.ImportUI.MeshTypeToImport = EFBXImportType.FBXIT_StaticMesh
fbx_factory.ImportUI.bCreatePhysicsAsset = False
fbx_factory.ImportUI.bImportMaterials = False
fbx_factory.ImportUI.bImportTextures = False
fbx_factory.ImportUI.bImportAnimations = False
fbx_factory.ImportUI.StaticMeshImportData.bConvertScene = True
fbx_factory.ImportUI.StaticMeshImportData.bCombineMeshes = True

# import the mesh
temp_mesh = fbx_factory.factory_import_object(temp_fbx, `'/Game/Sceneset')``

Here are the codes.
The bConvertScnee keeps not working.
Actually the interesting point is the 'convert scene' parameter in the mesh editor is checked, but the coordinator not change.
Could you pls figure it out if my code has something wrong?
I am new to unreal, and I am doing a test like automatically import fbx files and textures according to a json file so that I can migrate my scene from maya to unreal

Thx

@rdeioris
Copy link
Contributor

Your code is right, but are you sure you do not have z-up already in maya ? 'convert scene' will make a check about the axis data available in the fbx file

@yuchen-sketch
Copy link
Author

yuchen-sketch commented Jul 31, 2018

Nope
I do not think I did the operation.
The fact is that if I imported the fbx manually and check the 'convert scene'parameter, the result would be good.

On the other hand, if I imported it by script, whether i set bConvertScene to True or False, the result was just same as I imported it manually and unchecked 'convert scene'

@yuchen-sketch
Copy link
Author

All right,
I tested the script with 4.19 and it worked.
It seems that the issue is a bug with 4.20.1.

@rdeioris
Copy link
Contributor

I have made a little modification to latest code. Can you try it ?

@yuchen-sketch
Copy link
Author

Yes, no problem.
Where can I get the modified code?

@rdeioris
Copy link
Contributor

rdeioris commented Aug 1, 2018

Just clone the master branch

@yuchen-sketch
Copy link
Author

Okay, after I finish the texture part and shader part with my code.

@yuchen-sketch
Copy link
Author

Hey Bro,
I just test with the new code in 4.20. The 'convert scene' works now!!

I got another question: I couldn't find 'set_material_static_switch_parameter' method with material instance. However , I found there was a pull request about it.
Not sure why your code not including the function. I just added it according to the pull request while compiling. I am just wondering if there are any issues with this function?

@yuchen-sketch
Copy link
Author

One more question:

If I created a material instance with
MaterialInstanceConstantFactoryNew().factory_create_new( '/Game/Content/Materials/ExampleA' )
The instance actually would be created as '/Game/Content/Materials/ExampleA/ExampleA.ExampleA'.

How can I create a instance with other name rather than 'ExampleA.ExampleA' (but in the path of '/Game/Content/Materials/ExampleA/')?

@rdeioris
Copy link
Contributor

rdeioris pushed a commit that referenced this issue Aug 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants