JustinPedersen / maya_fspy

Simple UI to import fSpy files into Autodesk Maya
MIT License
38 stars 0 forks source link

No JSON object could be decoded [Maya 2018] #1

Closed Squall789 closed 3 years ago

Squall789 commented 3 years ago

Hi

I'm testing it in Maya 2018 with an image with a resolution of 1920x1080. I've placed the script in the correct location, added a shortcut button in the Polygon Shelf of Maya 2018, added this code to it as mentioned (note: this code is copy pasted from the command window in Maya).

import maya_fspy.ui as mfspy_ui
mfspy_ui.maya_fspy_ui()

The fspy importer window pops up, but after selecting the files and clicking Import, nothing happens, the output within the Script editor is as follows.

# Traceback (most recent call last):
#   File "C:/Users/Me/Documents/maya/2018/scripts\maya_fspy\ui.py", line 85, in generate_camera
#     create_camera_and_plane(self.json_lineedit.text(), self.image_lineedit.text())
#   File "C:/Users/Me/Documents/maya/2018/scripts\maya_fspy\core.py", line 19, in create_camera_and_plane
#     data = json.load(json_file)
#   File "C:\Program Files\Autodesk\Maya2018\bin\python27.zip\json\__init__.py", line 291, in load
#     
#   File "C:\Program Files\Autodesk\Maya2018\bin\python27.zip\json\__init__.py", line 339, in loads
#     
#   File "C:\Program Files\Autodesk\Maya2018\bin\python27.zip\json\decoder.py", line 364, in decode
#   File "C:\Program Files\Autodesk\Maya2018\bin\python27.zip\json\decoder.py", line 382, in raw_decode
# ValueError: No JSON object could be decoded

I've uploaded the JSON file and the associated image here for you to take a look at.

This is an awesome script, and it'll save me constantly having to go back/forth into Blender each time.

One thing I wondered is, I used Unreal often, so my Maya axis are using Z as up (though I changed it to Y up for testing this script), would it be possible to add an option, if it's even needed, to correctly rotate the group to the Z up axis if that is the users configuration.

Thankyou

Squall789

Squall789 commented 3 years ago

User fault

JustinPedersen commented 3 years ago

Hi there @Squall789

Sorry for not getting back to you on this, I've been away on holiday for the festive season and don't have access to my pc or laptop.

Glad you managed to figure out what the issue was!

Adding an option for other up axies is definitely doable and if it would benefit you I'll try add it in when I'm back!

-J

Squall789 commented 3 years ago

Adding an option for other up axies is definitely doable and if it would benefit you I'll try add it in when I'm back!

That sounds great, currently I've just been rotating the group by 90 degrees after import. The issue I had before was that I wasn't importing the JSON file, I was stupidly thinking the .fspy file was just JSON with a different extension.

JustinPedersen commented 3 years ago

Ahh yeah, might be good to add some more detail on the readme about that. There was another paid plugin that reads the .fspy file and gets all the info from there.

I might look into doing that for a v2 if its an easily readable format since that would be simpler than how I'm currently doing it.

darkjinue commented 3 years ago

Hi, sorry for asking, how do i get access to json file to use this amazing script in maya ? I have no idea on it, Pls help

darkjinue commented 3 years ago

Adding an option for other up axies is definitely doable and if it would benefit you I'll try add it in when I'm back!

That sounds great, currently I've just been rotating the group by 90 degrees after import. The issue I had before was that I wasn't importing the JSON file, I was stupidly thinking the .fspy file was just JSON with a different extension. I also am using .fspy file , so what should i use instead? Pls help

JustinPedersen commented 3 years ago

Hi all.

I've released a new update that should help clear some of these Issues up. The UI will no longer let you input a file that is not a .json. I've also updated the docs to be a bit more clearer on the process. If they are still a bit foggy please open up another issue with any suggestions you might have.

@darkjinue You'll need to export a .json file from the FSPY application and then use that on the maya side. Inside the FSPY window once you have everything configured go File/Export/Camera parameters as JSON. There's more info on this on the README page :)

@Squall789 I'm going to close this Issue and open up a new one for your suggestion about supporting different scene up configurations within Maya.

Thanks all