Can not import G3 character which could import with old versions
I could import same scene (it include more items, then I removed some to test recent version with actual character and clothigns)
before. but with recent version (1.6.0.0191) , I can not import the character.
Only difference is I tried to apply smoothing modifer. with interective up-date when save the scene, (so it basically not matter, I remember it worked before)
I test Easy import, and normal import but about both case, it cause error then nothing loaded with verbosity 2.
in console log
Loading I:\myfile\dazstudio4\Mylibrary\TK\Projects\Toblender\b28\cyberpolice\cpolice_simple.duf
Parsing data
Python: Traceback (most recent call last):
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\error.py", line 247, in execute
self.run(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\main.py", line 117, in run
self.loadDazFile(filepath, context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\main.py", line 175, in loadDazFile
main = parseAssetFile(struct, toplevel=True)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\files.py", line 271, in parseAssetFile
return asset.parse(struct)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\files.py", line 77, in parse
asset = self.parseTypedAsset(gstruct, Geometry)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\files.py", line 235, in parseTypedAsset
asset.parse(struct)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\geometry.py", line 465, in parse
Asset.parse(self, struct)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\asset.py", line 354, in parse
self.parseSource(struct["source"])
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\asset.py", line 359, in parseSource
asset = self.getAsset(url)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\asset.py", line 87, in getAsset
return self.getNewAsset(id, ref, strict)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\asset.py", line 99, in getNewAsset
file = parseAssetFile(struct, fileref=fileref)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\files.py", line 271, in parseAssetFile
return asset.parse(struct)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\files.py", line 87, in parse
asset = parseModifierAsset(self, mstruct)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\modifier.py", line 55, in parseModifierAsset
return asset.parseTypedAsset(struct, ExtraAsset)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\files.py", line 235, in parseTypedAsset
asset.parse(struct)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\modifier.py", line 199, in parse
Channels.parse(self, struct)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\import_daz\channels.py", line 53, in parse
if "channels" in extra.keys():
AttributeError: 'str' object has no attribute 'keys'location: <unknown location>:-1
importer error log.txt not generate (keep empty). so it can not be used to detect reason.
Comments (6)
-
reporter -
reporter Then we could bake the daz smooth modifer applied shape with daz smooth modifer option “Auto up-date on” with add on longtime.
then imported mesh show same smooth effect when import scene as base resolution. if user not hope to bake the effect, user may set smooth modifer as OFF without remove modifer.
I afraid if recent add on can not manage those correctly. (if it not matter, no problem. I just found this error after tweak modifier setting in daz then save and export, so suppose it related with current way to handling daz smooth modifer. it is just guess. I may test later, actually smooth modifer baked correctly or not with auto-update on. (before with off, improter can not import mesh as smooth modifer applied I remember)
-
reporter So I hope to confirm when it happen, I generate the “data” which include extra which cause this bug.
console out put like this
Loading I:\myfile\dazstudio4\Mylibrary\TK\Projects\Toblender\b28\cyberpolice\cpolice_simple_on.duf
Parsing data
data: {'type': 'smoothing', 'smoothing': {'smoothing_on': True, 'smoothing_type': 'Base Shape Matching', 'iterations': 2, 'weight': 0.5, 'secondary_weight': -0.5, 'lock_distance': 0.001, 'length_influence': 0.5, 'interactive_update': False, 'collision_node': '/data/DAZ%203D/Genesis%202/Female/Genesis2Female.dsf#GenesisFemale', 'collision_iterations': 3, 'collision_intervals': 1}}
type
<class 'str'>
data: {'type': 'smoothing', 'smoothing': {'smoothing_on': True, 'smoothing_type': 'Base Shape Matching', 'iterations': 2, 'weight': 0.5, 'secondary_weight': -0.5, 'lock_distance': 0.001, 'length_influence': 0.5, 'interactive_update': False, 'collision_node': '/data/DAZ%203D/Genesis%202/Female/Genesis2Female.dsf#GenesisFemale', 'collision_iterations': 3, 'collision_intervals': 1}}
smoothing
<class 'str'>the data is dict type…so when you loop dictionary by self object, like
for extra in data:,
it is same askey in data.keys()
so extra[0] = “type” extra[1] = “smoothing” then they do not have key (because they are str) cause error.
I suppose you might plan to use
for k, v in data.items():
or list(data.items())
-
repo owner The plugin assumed that the “extra” keyword is followed by a list of dicts. This has always been the case when I have checked, but apparently not here. Either the “extra” keyword can be followed by a dict also, or I have been doing something wrong. Anyway, the latest commit should work both if it is a list or a dict, although the code is ugly.
-
reporter Yes if the data is “list” of dics, it should work . Then I print out the data which cause error. But I could not catch the item which cause this exceptional issue,
From the data (dict) It is clear about smooth modifier. so I thought if you save the smooth modifier applied items with character, it will happen. or there is case which cause this issue but I can not detect it.
then from your reply,, usually , data: [{dict1}, {dict2}….{dict3}] is usuall scructure of the data. I suppose if there is only one dict for data, like this case daz saved json purse the [] so data: {dict1} it still correct as JSON structure. (without my editor happend to purse it ,,, I do not know, anyway DS load the scene without problem.
anyway your way can manage it correctly. Thanks. I do not think it is ugry code at all ^^; (though I do not know if there is format function, which auto solve this issue)
-
reporter - changed status to resolved
- Log in to comment
I could detect why this problem happen, with add some code to generate problems.
As error said, you expect extra are dict type. but there is case, extra turn as str.
so I output the channels. which generate as “str”.with my saved scene.duf
16 to 20 , I add if not hasattr(extra, "keys"):
then exclude those case. then to check extra print out those. then console show these
Parsing data
type
<class 'str'>
smoothing
<class 'str'>
other extra are actually dict type, with many keys() but, at same time add on generate those 2 extra “type” and “smoothing” from duf (or json I do not know) ,
both cause issue (so I get 2 error, when the function loop for extra in items. (about the saved scene),
you may need kind of error handling to avoid this issue. (so I simply exclude the case, extra generate as non dict types,, now I could load the scene…)
I do not know which commit cause this issue though…