@m_magalhaes
here is my code
import c4d
from c4d import utils, documents, plugins
import time
from threading import Thread
class WatchThread(Thread):
def __init__(self, name, doc):
Thread.__init__(self, name=name)
self.doc = doc
def run(self):
while True:
time.sleep(2.5)
obj_importer(self.doc, r'f:\01.obj')
print 'Loaded.',
break
def obj_importer(doc, obj_path):
if obj_path is None:
return
plug = plugins.FindPlugin(1030177, c4d.PLUGINTYPE_SCENELOADER)
if plug is None:
return
op = {}
if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, op):
if "imexporter" not in op:
return
obj_import = op["imexporter"]
if obj_import is None:
return
# Parameters
obj_import[c4d.OBJIMPORTOPTIONS_POINTTRANSFORM_SWAPXY] = False
obj_import[c4d.OBJIMPORTOPTIONS_POINTTRANSFORM_SWAPXZ] = False
obj_import[c4d.OBJIMPORTOPTIONS_POINTTRANSFORM_SWAPYZ] = True
doc.StartUndo()
doc.AddUndo(c4d.UNDOTYPE_CHANGE, doc)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
c4d.documents.MergeDocument(doc, obj_path,
c4d.SCENEFILTER_OBJECTS |
c4d.SCENEFILTER_MATERIALS |
c4d.SCENEFILTER_MERGESCENE, None)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
doc.EndUndo()
obj_import[c4d.OBJIMPORTOPTIONS_PRESETS] = 0
c4d.StatusClear()
c4d.EventAdd()
if __name__ == '__main__':
doc = c4d.documents.GetActiveDocument()
wt = WatchThread('ht', doc)
wt.start()