I'm working on a simple Tag plugin in Python, which must run under R21.
On the plugin itself, I'm checking inside
Execute() if there is a change on the FILENAME field of my GUI. If there is a change, I'm checking the file extension and depending on this I'm proceeding to a conversion upon the agreement of the user to a question.
But... if seems that the simple call to
c4d.gui.QuestionDialog() makes c4d crash instantly.
That's the facts.
Honestly, I'm using an identical call to this function elsewhere in the code in
Message() without any issue.
Can this crash occurs because I'm using this in
Execute() or can this be related to something I'm doing in a wrong way?
Of course I've check the documentation but I didn't notice anything relevant.
Here the excerpt of the code that makes c4d crash.
import sys import os import c4d import time import json from c4d import gui, plugins, bitmaps #../.. Inside the class which define the Tag plug-in def __init__ (self): pass def Init(self, node): return True def Execute(self, tag, doc, op, bt, priority, flags): # .../... currentFILE = self.currentTagData.GetFilename(c4d.mMOTIONFILE_PATH) if self.currentTagData.GetFilename(c4d.mMOTIONFILE_PATH) != self.previousFILE: self.previousFILE = currentFILE if currentFILE.lower().endswith(".json"): # Is a JSON? return True elif currentFILE.lower().endswith(".csv"): # Is a CSV? # CRASH HERE - Ask to convert the CSV file into a JSON one askConvertToJSON = c4d.gui.QuestionDialog("Would you like to convert this file to a compatible JSON?") if not askConvertToJSON: return False return True else: raise ValueError("This file extensoin is not supported, please load a compatible JSON or CSV file") return False return True
Any helps are more than welcome.