@m_magalhaes Hi, where in this code does the script start to run and call the python code? Or did I misunderstand something?
Latest posts made by ac3
-
RE: id PluginMessage () when the scene loaded
-
RE: id PluginMessage () when the scene loaded
@m_magalhaes, Hi, can you answer me? plz
-
RE: id PluginMessage () when the scene loaded
You can only write the SceneHookData with c++ and that SceneHookData will call your python command so you don't need to rewrite it.
Hi!
Do you have examples of a plugin written with SceneHookData? I am more proficient in python than c ++ -
RE: id PluginMessage () when the scene loaded
@m_magalhaes, Hi!
Thanks for the answer, I will try this and answer later. -
RE: id PluginMessage () when the scene loaded
@C4DS said in id PluginMessage () when the scene loaded:
I don't think this will work for a Python plugin, but with C++ you can provide a SceneHook and use message MSG_DOCUMENTINFO_TYPE_LOAD
Maybe there is another way to start the plugin automatically? Mb is not PluginMessage ()
-
RE: id PluginMessage () when the scene loaded
@C4DS, Hi!
it is very sad. I don't really want to rewrite the plugin from Python to C++ -
id PluginMessage () when the scene loaded
Hello!
I need to find the Message ID when the scene has already loaded, so that after that I can run the plugin that will work with objects on the scene, it is important to make this plugin automatic, that is, without clicking on the button in the plugin gui. As it should be: Cinema4d started > Scene loaded > plugin started > plugin get objects > plugin work with objects. Please help, Google does not help -
RE: Get visible objects from viewport in commandline
Hi,@m_magalhaes
I tried all the messages, and did not find where this could work. Could you tell me the right solution? -
RE: Get visible objects from viewport in commandline
@zipit , Hi.
The methods you suggested will not work for me, since bbox has an error(example: if the bbox of a sphere is included in one corner of the frame, but the sphere itself does not fall into our frame, the source masive will have a sphere object), and GeRayCollider because It does not return objects.Maybe you know how to initialize ViewportSelect to make It work, maybe there is the same method as loading caches for objects in Commandline.exe
-
RE: Get visible objects from viewport in commandline
Code example:
import os import sys import c4d def PluginMessage(_id, data): if _id == c4d.C4DPL_COMMANDLINEARGS: print sys.argv walker() return True return False def walker(step_x=5,step_y=5): doc = c4d.documents.GetActiveDocument() print "Document: {}".format(doc) bd = doc.GetRenderBaseDraw() print "BaseDraw: {}".format(bd) safeframe = bd.GetSafeFrame() print "SafeFrame: {}".format(safeframe) arr_o = [] for y in range(safeframe['cl'],safeframe['cr'],step_y): for x in range(safeframe['ct'],safeframe['cb'],step_x): o = c4d.utils.ViewportSelect.PickObject(bd, doc, x, y, rad=1, flags=c4d.VIEWPORT_PICK_FLAGS_OGL_ONLY_TOPMOST_WITH_OBJ | c4d.VIEWPORT_PICK_FLAGS_OGL_ONLY_VISIBLE) if o: try: arr_o.append(o[0]) except IndexError as e: print(e) print "Array of objects: {}".format(arr_o) return arr_o
Output:
['C:\\Users\\Administrator\\Documents\\1.c4d', '-nogui'] Document: <c4d.documents.BaseDocument object called '' with ID 110059 at 0x00000 08ABA5CC3B0> BaseDraw: <c4d.BaseDraw object called 'Perspective' with ID 110305 at 0x0000008A BA5CC3F0> SafeFrame: {'cr': 0, 'ct': 0, 'cb': 0, 'cl': 0} Array of objects: []
Cmd command:
C:\Program Files\MAXON\Cinema 4D R20>Commandline.exe "C:\Users\Administrator\Documents\1.c4d" -nogui