Okay, thank you again.
Posts made by ivodow
-
RE: Thinking Particles- How to Set "Settings"
Hi Manuel,
Thank you for your answer, I appreciate it.
So that in the future I can find these things myself, I tried searching searching your Python docs for TP_VIEWTYPE. No results were returned. I assume those #defines are drawn from a C++ header, so I tried searching for TP_VIEWTYPE here, also with no success.
Where can I find full searchable API documentation for Cinema 4D? (Like that for Rhino Common)
-
Thinking Particles- How to Set "Settings"
In Simulate -> Thinking Particles -> TP Settings... there are a series of UI elements at the top of the General tab controlling global settings for the TP system:
Max. Particles
Force this Setting
Show Objects
View TypeHow do I set these from python? (I specifically need Max Particles and View Type.) I have been all over the docs and cannot seem to find them.
Thank you.
-
RE: Write to C4D console in real time
An answer to my initial question, for others who may encounter the same issue. This can be used in lieu of print()
import maxon def ConsolePrint( *args ): # concatenate var args into a single, space separated string suitable for maxon.Loggers txt = " ".join(str(i) for i in args) maxon.Loggers.Python().Write( maxon.TARGETAUDIENCE.ALL, txt, maxon.MAXON_SOURCE_LOCATION(1), maxon.WRITEMETA.UI_SYNC_DRAW ) if __name__ == "__main__": ConsolePrint( "Output" )
-
RE: Thinking Particles allocation failure in new document
Thank for the additional information.
So, would ExecutePasses() with the BUILDFLAGS_EXPORT flag set be typically called just before exporting to alembic (to be on the safe side)? -
RE: Write to C4D console in real time
Here is a contrived minimal working example that demonstrates the issue. This is only intended to force the issue to occur. My actual code involves loading multiple >2 GB databases and building particle systems.
Thank you.
import c4d def long_process(): fullpath = c4d.storage.LoadDialog( type = c4d.FILESELECTTYPE_IMAGES, title = "Select File > 10MB:" ) if not fullpath: return for n in xrange( 10 ): cnt = 0 with open( fullpath, 'rb') as f: while( True ): ansi_byte = f.read(1) if( ansi_byte == b'' ): break if( cnt % 100000 == 0 ): print( "Scanned " + str(cnt) + " bytes..." ) cnt += 1 print( "Pass: " + str(n) ) if __name__ == "__main__": c4d.CallCommand( 13957 ) print( "Start" ) long_process() print( "End" ) c4d.EventAdd()
-
RE: Write to C4D console in real time
I found c4d.CallCommand( 13957 ), which clears the console and posts any buffered lines.
However, what I'd like to do is post the buffered lines without clearing. Is this possible?
-
Write to C4D console in real time
Hi,
I have a script that takes a long time to complete, and I would like to keep an eye on progress.
Is it possible for print() or WriteConsole() events to immediately be posted to the python console, rather than all posted after the script returns control to c4d? If not, is there another way in the c4d api to accomplish this?
-
RE: Thinking Particles allocation failure in new document
Manuel,
Thank you very much for the workaround.
Can you tell me more about what ExecutePasses() does, and when it should be normally be called? I am also having an issue where exporting large numbers of scripted particles to alembic (again, by scripting) is creating a nearly empty file. I see the flag BUILDFLAGS_EXPORT on ExecutePasses() and wonder if that might do the trick.
-
RE: Thinking Particles allocation failure in new document
I also tried creating the new document with c4d.CallCommand(12094). AllocParticle() failed with this approach as well.
-
Thinking Particles allocation failure in new document
Hi,
A minimal example to reproduce my issue is posted below. Am I missing a step?
Please advise...
Thank youS22.118
Windows 10import c4d def main(): temp_document = c4d.documents.BaseDocument() c4d.documents.InsertBaseDocument( temp_document ) c4d.documents.SetActiveDocument( temp_document ) pSys = temp_document.GetParticleSystem() if pSys is None: raise RuntimeError("Failed to retrieve Thinking Particle System from Document.") particle_id = pSys.AllocParticle() if particle_id == c4d.NOTOK: raise RuntimeError("particle_id == c4d.NOTOK" ) # Execute main() if __name__=='__main__': main()
-
RE: Alembic Export Options Not Working
Seems to be an initialization/ caching issue. I found 2 workarounds:
- Open the Alembic Export Dialog manually, then hit Cancel, before running the script.
-or-
- Toggle the state of each export setting in the script, as follows:
abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = False abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True
-
Alembic Export Options Not Working
Hi,
S22.016(RC)
I am attempting to make an automated Alembic thinking particle exporter, and I have run into an issue where setting the export options does not work.
Copying directly from the dev example here:
https://github.com/PluginCafe/cinema4d_py_sdk_extended/blob/master/scripts/03_application_development/files_media/export_alembic_r14.pyand only changing a few of the export options. Script does not work properly, as the resulting .abc file exported DOES contain all objects (not just the selection, as specified), and does NOT contain the particles.
Please advise me.
Thank you.
""" Copyright: MAXON Computer GmbH Description: - Exports Alembic with custom settings. Class/method highlighted: - c4d.plugins.FindPlugin() - MSG_RETRIEVEPRIVATEDATA - c4d.documents.SaveDocument() Compatible: - Win / Mac - R14, R15, R16, R17, R18, R19, R20, R21, S22 """ import c4d def main(): # Retrieves a path to save the exported file filePath = c4d.storage.LoadDialog(title="Save File for Alembic Export", flags=c4d.FILESELECT_SAVE, force_suffix="abc") if not filePath: return # Retrieves Alembic exporter plugin, 1028082, defined in R20.046 as FORMAT_ABCEXPORT abcExportId = 1028082 if c4d.GetC4DVersion() < 20046 else c4d.FORMAT_ABCEXPORT plug = c4d.plugins.FindPlugin(abcExportId, c4d.PLUGINTYPE_SCENESAVER) if plug is None: raise RuntimeError("Failed to retrieve the alembic exporter.") data = dict() # Sends MSG_RETRIEVEPRIVATEDATA to Alembic export plugin if not plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, data): raise RuntimeError("Failed to retrieve private data.") # BaseList2D object stored in "imexporter" key hold the settings abcExport = data.get("imexporter", None) if abcExport is None: raise RuntimeError("Failed to retrieve BaseContainer private data.") # Defines Alembic export settings abcExport[c4d.ABCEXPORT_SELECTION_ONLY] = True abcExport[c4d.ABCEXPORT_PARTICLES] = True abcExport[c4d.ABCEXPORT_PARTICLE_GEOMETRY] = True # Finally export the document if not c4d.documents.SaveDocument(doc, filePath, c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST, abcExportId): raise RuntimeError("Failed to save the document.") print("Document successfully exported to:", filePath) if __name__ == '__main__': main()