Just a real quick question about Genesis file detection
def is_character_file(self, file_path):
try:
with open(file_path, 'r', errors='ignore') as f:
content = f.read()
if 'Genesis' in content:
print("This is a Genesis character, choose DBZFILE or MORPHED for MESH FITTING setting on panel!")
return True
else:
print("This is an Environment or Prop - Choose 'UNIQUE' or 'SHARED' for MESH FITTING setting on panel!")
return False
except FileNotFoundError:
print(f"File not found: {file_path}")
return False
The above code has been working on everything I throw at it every Genesis file comes back true i'm just using this as a test to strengthen my error handling and I was wondering if I could rely on your greater knowledge to let me know if this is good enough for all instances and if it's not maybe give me a proper search term that would be more apt to detect any Genesis character duf that you're at on supports…. just not sure if you notice anomalies where there's any Genesis DUF scene files that don't contain that I know maybe some V4 don't at least the Loretta and Lorenzo Poly kit doesn’t… I spent three hours last night trying to train neural networks on DUF files to get it to detect them and came up with that in a pinch and it works so I'm just kind of going with this until I hear otherwise thanks in advance for any help….. Or if you have a method of detection could you show me where it is
Comments (7)
-
reporter -
repo owner - changed status to open
A duf/dsf file is a json file which is optionally gzipped. The function loadJson in load_json.py reads the file and returns a python dict.
-
reporter no the thing is I'm trying to figure out a foolproof way to testify file is a Genesis DUF and I think I found it in the above it's been working on everything I threw at it I just wanted to ask your opinion on what you thought because I kind of needed in my code so I could cancel out of an operator
-
repo owner That might work, but I would prefer to read the file with json to have more control over what’s happening. I added the function that loads gzipped json files to the api:
import_daz.load_daz_file(filepath)
. I also added an example script that reads files and reports the asset type and the first url encountered, if any.: https://bitbucket.org/Diffeomorphic/daz-importer-scripts/src/master/check_file_content.py. Here is the outputFile: /data/DAZ 3D/Genesis 8/Female 8_1/Genesis8_1Female.dsf Asset type: figure File: /People/Genesis 8 Female/Characters/Aiko 8.duf Asset type: character First URL: /data/DAZ%203D/Genesis%208/Female/Genesis8Female.dsf#Genesis8Female File: /People/Genesis 3 Female/Poses/Fashion Model Pose 01.duf Asset type: preset_pose File: /People/Genesis 3 Female/Materials/Jeane Eyes 01.duf Asset type: preset_material File: /People/Genesis 3 Female/Clothing/Basic Wear/Basic Wear.duf Asset type: wearable First URL: /data/DAZ%203D/Genesis%203%20Female%20Starter%20Essentials/Top/Top_2282.dsf#Top_2282
-
reporter thank you very much for that I appreciate it!!
-
reporter is there a specific test For environment and prop and if it comes back as asset type character does that mean 100 percent always it's a Genesis character this is really cool I appreciate providing all that information
-
repo owner - changed status to closed
- Log in to comment
Actually I made a error when I was doing it so this is my final one