On 28/08/2017 at 04:58, xxxxxxxx wrote:
I'm quite new to scripting in Cinema as well as scripting in general. The last two months I wrote my first 3 PlugIns and even though these work as expected, during that process I ended up with quite some questions, which I'd like to find answers to.
Since I couldn't find any forum rules regarding topics, I'll put all my questions in that one topic. However I'll name every section/question, so that one can find that thread via searching.
I'd be thankfull for some help.
To my actual questions:
1. How do you add a PlugIn to a self-created submenu?
So as you can see I have a submenu example which works just fine. However when trying to add a "PlugIn" to it I don't get the result I'd like to have.
def GetSubContainer(self, doc, submenu) :
sub2 = c4d.BaseContainer() #a submenu in a submenu
sub2 = "Another submenu"
sub2[subsubmenu_2] = "Sub_SubMenu II"
sub2[subsubmenu_3] = "Sub_SubMenu III"
sub2[subsubmenu_4] = "Disabled&d&"
def ExecuteSubID(self, doc, id) :
elif id == subsubmenu_2:
gui.MessageDialog("You clicked on 'Sub_Submenu II'")
elif id == subsubmenu_3:
gui.MessageDialog("You clicked on 'Sub_Submenu III'")
I'm obviously doing something wrong. I guess I can't just use InsData() to add a PlugIn to the menu, but how would you do that?
I guess I could add the submenu to the plugins and use ExecuteSubID() to execute it, but that doesn't seem like how it's meant to work.
2. How to access an object after using TransferGoal()?
I'm using that function to copy the information of where an object(A) is linked (e.g. in an Instance) to another object(B). Once I did that I'd like to delete that object(A).
The references however that I use to access that object(A), while the program is running are getting transferred as well. That means, that I'm unable to delete it after using
TransferGoal(). So I used the following code to do what I tried to achieve, but there has to be a better solution than that.
3. Is there any way to access the Coordinate Manager?
I'm trying to get the "Size" value which basically gives the vector for the bounding box of anything selected (points as well as objects). If that's not possible, is there any way to get that information?
4. Is it possible to create an object using Python so that attributes are linked to a "parent object"?
I'm basically trying to do what you see in the picture, but with Python. Is there any way to create the "Compositing_Child" with Python in a way so that parts of its attributes are permanently linked to the parent?
So when I change these attributes of the parent the attributes of the child change as well.
5. Is it possible to get every change made in the object manager?
The answer to that question might be beyond me, since I haven't tried to use events yet.
Basically I'd like to know, if there is a way to get the information if any object in the object manager is being modified and if so, which object is being modified and how it's being modified.
Thanks in advance!