On the site noted above,
Here on this site I have shown how to install Autodesk’s FBXSDK.
This described method allows you to view and edit FBX information on Blender (or on VSDODE).
As a practical matter,
I think it would be difficult to make FBX modules “for distribution” add-ons, since they are not modules, or built-in objects, but probably external libraries or plug-ins.
Also, if you can do C++, you might want to “maturely” code in C++…
But…I think I can realize an environment where I can easily change the output FBX to other environments after FBX output for my personal environment, so I will share it here in the thread community.
As a sample, the code below edits the material information.
import fbx
def create_material(scene):
# Create a new material
node = scene.GetRootNode().GetChild(0)
material = node.GetMaterial(0)
# Display the name of the material for testing
print("Material Name:", material.GetName())
# Set specular reflection information for the material
material.ReflectionFactor.Set(0.5) # Set the specular reflection coefficient
material.SpecularFactor.Set(1) # Set the strength of specular reflection
material.Specular.Set(fbx.FbxDouble3(0.2, 0.8, 0.8)) # Set the color of specular reflection
material.AmbientFactor.Set(1)
material.Ambient.Set(fbx.FbxColor(1,1,0))
material.Emissive.Set(fbx.FbxColor(1,1,1))
return material
def import_fbx(scene, manager, filen_path=""):
# Create an importer instance
importer = fbx.FbxImporter.Create(manager, "MyScene")
# Initialize the FBX file
importer.Initialize(filen_path)
# Import into the scene
importer.Import(scene)
# Close the importer
importer.Destroy()
# Modify material information
create_material(scene)
def export_fbx(scene, filename):
# Create an exporter instance
exporter = fbx.FbxExporter.Create(scene, "")
# Set the filename for the exporter
exporter.Initialize(filename, -1)
# Export the scene to the file
exporter.Export(scene)
# Close the exporter
exporter.Destroy()
# Create an instance of the FBX Manager
manager = fbx.FbxManager.Create()
# Create an instance of the scene
scene = fbx.FbxScene.Create(manager, "MyScene")
import_fbx(scene, manager, filen_path = "1.fbx")
# Export the scene
export_fbx(scene, "output.fbx")
I am a layman when it comes to coding and 3D, so I hope this will give some good tips to those who are actually involved in FBX output in the field.
Other than Console.
To achieve autocomplete, etc. in Blender’s text editor, is it an add-on I maintain?
I recommend the following add-ons.