Message 1 of 2
[Python][SDK] Create Property not working?
Not applicable
02-20-2020
02:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am attempting to use the 2019.0 python sdk to read and write a property to the scene of an fbx file. However, after much digging and testing, I am fearing the worst, that it may not be implemented correctly.
This is by no means final code,
def set_data_to_file(file_name, data):
"""Get data from scene.
Usage:
set_data_to_file(r"C:\temp\no_data.fbx", "{'data':1}")
"""
lSdkManager, lScene = FbxCommon.InitializeSdkObjects()
lResult = FbxCommon.LoadScene(lSdkManager, lScene, file_name)
if not lResult:
print("An error occurred while loading the scene...")
else:
p1 = lScene.FindProperty('MyCustomProp')
if p1.IsValid() == False:
p1 = FbxCommon.FbxProperty.Create(lScene, FbxCommon.FbxPropertyString, str('MyCustomProp'))
FbxCommon.SaveScene(lSdkManager, lScene, file_name, pFileFormat=0)
lSdkManager.Destroy()
However I am seemingly running into an error on the Create call.
TypeError: arguments did not match any overloaded call: FbxProperty.Create(FbxProperty, FbxDataType, str, str pLabel="", bool pCheckForDup=True): argument 1 has unexpected type 'FbxScene' FbxProperty.Create(FbxObject, FbxDataType, str, str pLabel="", bool pCheckForDup=True): argument 2 has unexpected type 'sip.wrappertype'
Even if I attempt to create a property on a regular scene node i get this...
TypeError: arguments did not match any overloaded call: FbxProperty.Create(FbxProperty, FbxDataType, str, str pLabel="", bool pCheckForDup=True): argument 1 has unexpected type 'FbxNode' FbxProperty.Create(FbxObject, FbxDataType, str, str pLabel="", bool pCheckForDup=True): argument 2 has unexpected type 'sip.wrappertype'
Am I implementing correctly? Can anyone confirm if this is working or not? If not, any ideas on a work around?
Regards.