Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi @orestiskon,
From what I learnt recently, if you have more than one data to store, you can create a sub container of the base container identified by the pluginID.
I can't remember where I read that... just be careful I'm not an advanced C4D developer
In a class for a BaseTag I use this like that,
self.bcDATAS = c4d.BaseContainer() self.bcDATAS[ myData ] = "A string for example" # Be sure to use a unique ID obtained at https://plugincafe.maxon.net/c4dpluginid_cp myPLUGIN_ID = 0123456789 # Get the Document Settings BaseContainer self.bcDoc = doc.GetDocumentData( c4d.DOCUMENTSETTINGS_DOCUMENT ) self.bcDoc[ myPLUGIN_ID ] = self.bcDATAS # Store plugin container inside the document container # Save the updated Document BC op.SetData( self.bcDoc ) # To retrieve a data print ( op.GetData()[ myPLUGIN_ID ][ myData ] )
Cheers,
Christophe
@orestiskon, self is used because the example is an extract of a class. In my case, those variables are defined in the def __init__ (self):, and belongs to the class object. They are not globals. Have a look there, https://docs.python.org/3/tutorial/classes.html you will understand it with a much better explanation than mine.
def __init__ (self):
If you plan to do not use that inside a class, you can get rid of self of course. Just be careful of doc and op used here below as they are arguments of def Execute(self, tag, doc, op, bt, priority, flags): used in my BaseTag plugin.
self
doc
op
def Execute(self, tag, doc, op, bt, priority, flags):
Knowing this, I assume you can easily transpose this to your purpose as the following example won't work as it is
bcDATAS = c4d.BaseContainer() bcDATAS[ myData ] = "A string for example" # Be sure to use a unique ID obtained at https://plugincafe.maxon.net/c4dpluginid_cp myPLUGIN_ID = 0123456789 # Get the Document Settings BaseContainer bcDoc = doc.GetDocumentData( c4d.DOCUMENTSETTINGS_DOCUMENT ) bcDoc[ myPLUGIN_ID ] = bcDATAS # Store plugin container inside the document container # Save the updated Document BC op.SetData( bcDoc ) # To retrieve a data print ( op.GetData()[ myPLUGIN_ID ][ myData ] )
I noticed by having a look on other .res files that there is a STATICTEXT { JOINEND; } that exists and can be applied on LAYERGROUP as well as STATICTEXT { NEWLINE; } but I didn't got the use of the last one as that does not create the "\r" or "\r\n" it should.
STATICTEXT { JOINEND; }
LAYERGROUP
STATICTEXT { NEWLINE; }
Didn't found any informations in the SDK (C++ nor Python) about JOINEND and JOINENDSCALE... those tags looks like to be undocumented.
JOINEND
JOINENDSCALE
split from this thread
Hello,
I made some unsuccessful researches about how to access to the selected value of a CUSTOMGUI QUICKTABRADIO declared in a Resource File. I found some examples on how to create and use a QuickTab using GeDialog, but none using .RES.
CUSTOMGUI QUICKTABRADIO
@ferdinand, based on the ID_CA_MUSCLE_OBJECT_STATE you wrote above, how do you access to the LONG ID_CA_MUSCLE_OBJECT_STATE value inside the Execute() or Message()? I didn't fount any way to get the right message update when clicking the options on the Cycle.
ID_CA_MUSCLE_OBJECT_STATE
LONG ID_CA_MUSCLE_OBJECT_STATE
Execute()
Message()
Until now I totally failed to get the selected value from it, I only get 0 when the first element of the cycle is clicked and nothing on the others.
Any clue or example would be more than welcome!
Thanks a lot Christophe
Thanks a lot @m_adam for this detailed answer. I missed that post about the SceneHook method in C++ - as our main plugin is already in C++, maybe we can incorporate this SceneHook inside it instead of having a perpetual running timer checking for a scene change in Python.
Are you aware if there some example somewhere in the SDK talking about this?
Cheer, Christophe
Hi there,
I'm trying to find a way to detect in a Python plugin a document change when I'm switching between different document in C4D. The switch do not concern file open, then close, and open an other document, but really having 2 or 3 different scenes opened at the same time and switching from one to an another.
I went through the different post here, but I didn't found anything relevant, only few tracks, and also some C++ examples but they have some functions that are not existing in Python (ie GeDialog::CheckCoreMessage()). The best example I found is in C++ there : https://developers.maxon.net/docs/Cinema4DCPPSDK/html/page_manual_gedialog.html#page_manual_gedialog_interaction_global_events But the scope of EVMSG_CHANGE is too wide and appears for many operations and not only windows/doc switching.
GeDialog::CheckCoreMessage()
EVMSG_CHANGE
I tried to trace the msg IDs inside CoreMessage(), but I didn't found the correspondance for the IDs that I traced in console.
For example I'm getting this when switching between opened documents:
Python extract for the CoreMessage call,
def CoreMessage(self, id, msg): doc = c4d.documents.GetActiveDocument() # if id == c4d.EVMSG_CHANGE: if msg.GetId() != 1298360653: print ( f"COREMSG_ID {msg.GetId()}" )
In console,
COREMSG_ID 1937337955
I'm skipping the COREMSG_ID = 1298360653 otherwise I'm filing the console in a blink of an eye - it's maybe the redraw or evaluate scene.
COREMSG_ID = 1298360653
I tried to explore the ge_prepass.h file but didn't found any match. Where are located those ID Core Message definitions and their related readable values?
ge_prepass.h
That would helps me to found the right ID message called when switching.
Then, I thought analyse the doc.GetDocumentName() once I do know that I effectively switch from a document to an another.
doc.GetDocumentName()
If someone have some answers, just let me know, it would be really helpful!
Thanks! Christophe
Thanks a lot @cairyn for your answer. Yes, that's a super old thread, but it's the one talking about CollieMouse Do you have a link to get / buy it? The only link I found is about a v1.2 free, which is not working under R23.
Thanks a lot! Christophe
Hello @Cairyn, do you have now a working version of CollieMouse working for R23 and higher? If yes, could we have a short talk about it? Thanks a lot, Christophe
I finally end up to format all the elements the way I wand thanks to @ferdinand's link. Indeed STATICTEXT { JOINENDSCALE; } is the trick to proper format your elements when you want to use COLUMNS in GROUP.
STATICTEXT { JOINENDSCALE; }
COLUMNS
GROUP
Here the result in picture,
And the code extract from the .str for whom are interested,
GROUP mGRPAXIS { DEFAULT 1; SEPARATOR { SCALE_H; } GROUP { DEFAULT 1; COLUMNS 4; STATICTEXT mPOSITION { SCALE_H; } STATICTEXT mENPOS { } STATICTEXT mROTATION { SCALE_H; } STATICTEXT mENROT { } STATICTEXT { JOINENDSCALE; } } GROUP { DEFAULT 1; COLUMNS 4; REAL mTX { MIN -100.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; SCALE_H; } BOOL mEN_TX { ANIM OFF;} REAL mRX { MIN -100.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; SCALE_H; } BOOL mEN_RX { ANIM OFF; } STATICTEXT { JOINENDSCALE; } REAL mTY { MIN -100.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; SCALE_H; } BOOL mEN_TY { ANIM OFF; } REAL mRY { MIN -100.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; SCALE_H; } BOOL mEN_RY { ANIM OFF; } STATICTEXT { JOINENDSCALE; } REAL mTZ { MIN -100.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; SCALE_H; } BOOL mEN_TZ { ANIM OFF; } REAL mRZ { MIN -100.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; SCALE_H; } BOOL mEN_RZ { ANIM OFF; } STATICTEXT { JOINENDSCALE; } } SEPARATOR { LINE; SCALE_H; } BUTTON mREMOVE_MOTION { ANIM OFF; } }
Thanks again to the community and plugincafe! Cheers,
Christophe.
Oh! I missed this thread... did thought about searching LAYOUTGROUP, thanks a lot @ferdinand; I going to try this right away and keep you in touch!
Why all those tricks do not appears in SDK? maybe with a bunch of examples it will shorten the learning curve for a lot of people