'Copy from IRR' command
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/05/2011 at 07:22, xxxxxxxx wrote:
Now that is extremely useful to know. Many thanks indeed, Matthias!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/05/2011 at 07:25, xxxxxxxx wrote:
Btw. this does not only work with RenderData but also with objects, tags etc. Basically everything derived from BaseList2D.
cheers,
Matthias -
On 09/06/2013 at 01:30, xxxxxxxx wrote:
Sorry to use this post, but I like to do the same in Python.
So I should use statements like:
rdata = doc.GetActiveRenderData()
NodeData.Message(self, node, type, data)However, I'm not sure about the container.
Could you do the same example in Python?
-
On 09/06/2013 at 06:52, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Sorry to use this post, but I like to do the same in Python.
So I should use statements like:
rdata = doc.GetActiveRenderData()
NodeData.Message(self, node, type, data)However, I'm not sure about the container.
Could you do the same example in Python?
The method named Message() in the example is not the overridable method Message()
in NodeData. It refers to the Message() implementation in C4D Atom which can be used
to send messages to an atom. I am not sure if the approach is applicable on Python as
we are missing some classes / structs form the example(the description stuff). I know
that the description command is listed under the atom messages in the Python SDK, but
I have never tried it, as the whole documentation about the data parameter is non
existent.Your best shot might be c4d.CallButton() in Python. As the BaseList2D to pass you will
have to grab the Render Settings BasePlugin. But i do not know if it will actually work,
as CallButton() is not very consistent. -
On 10/06/2013 at 08:34, xxxxxxxx wrote:
This Python script will execute the Copy From IRR button:
import c4d def main() : rdata = doc.GetActiveRenderData() c4d.CallButton(rdata, c4d.RDATA_FROMIRR) c4d.EventAdd() if __name__=='__main__': main()
-ScottA
-
On 10/06/2013 at 10:37, xxxxxxxx wrote:
Thanks, very much.
I tought CallButton needed a tool, but this examples shows it can be done differently.Below my not functioning attempt / code.
tool = c4d.plugins.FindPlugin(50000, c4d.PLUGINTYPE_ANY) print tool c4d.CallButton(tool, c4d.RDATA_FROMIRR) c4d.EventAdd()
-
On 10/06/2013 at 10:56, xxxxxxxx wrote:
The CallButton takes many different things: tags, tools, etc..
None of this is documented very well (if at all). So I've had to ask lots of questions about it. And create my own documentation for it.Here's my personal notes about the CallButton() function in Python:
#These are the various plugin types and their ID's.That are used in the CallButton() function PLUGINTYPE_ANY=0, PLUGINTYPE_SHADER=1, PLUGINTYPE_MATERIAL=2, PLUGINTYPE_COFFEEMESSAGE=3, PLUGINTYPE_COMMAND=4, PLUGINTYPE_OBJECT=5, PLUGINTYPE_TAG=6, PLUGINTYPE_BITMAPFILTER=7, PLUGINTYPE_VIDEOPOST=8, PLUGINTYPE_TOOL=9, PLUGINTYPE_SCENEHOOK=10, PLUGINTYPE_NODE=11, PLUGINTYPE_LIBRARY=12, PLUGINTYPE_BITMAPLOADER=13, PLUGINTYPE_BITMAPSAVER=14, PLUGINTYPE_SCENELOADER=15, PLUGINTYPE_SCENESAVER=16, PLUGINTYPE_COREMESSAGE=17, PLUGINTYPE_CUSTOMGUI=18, PLUGINTYPE_CUSTOMDATATYPE=19, PLUGINTYPE_RESOURCEDATATYPE=20, PLUGINTYPE_MANAGERINFORMATION=21, PLUGINTYPE_CTRACK=32, PLUGINTYPE_FALLOFF=33, PLUGINTYPE_VMAPTRANSFER=34, PLUGINTYPE_PREFS=35, #This example executes the Restore Selection button on a Selection Object #Other buttons code can be found in the "../../resource/res/description/Oselection.h" file import c4d from c4d import * def main() : obj = doc.GetFirstObject() c4d.CallButton(obj,c4d.SELECTIONOBJECT_RESTORE) #Executes the "Restore Selection" button c4d.EventAdd() if __name__=='__main__': main() Tpolygonselection #This example executes the Restore Selection button on a Polygon Selection Tag #Other buttons code can be found in the "../../resource/res/description/Tpolygonselection.h" file import c4d def main() : obj = doc.GetActiveObject() if obj is None: return False tags = obj.GetTags() for tag in tags: if tag.GetType() == c4d.Tpolygonselection: #A Polygon Selection Tag tag.SetBit(c4d.BIT_ACTIVE) c4d.CallButton(tag,c4d.POLYGONSELECTIONTAG_COMMAND1) #Execute the Restore Selection button c4d.EventAdd() if __name__=='__main__': main() #This example executes the Restore Selection button on a Edge Selection Tag #Other buttons code can be found in the "../../resource/res/description/Tedgeselection.h" file #This uses a message to call to and execute the button #R13++ only import c4d def main() : obj = doc.GetActiveObject() edgetag = obj.GetFirstTag() #The first tag should be an edge Selection Tag dc = {} dc['id'] = c4d.DescID(c4d.EDGESELECTIONTAG_COMMAND1) edgetag.Message(c4d.MSG_DESCRIPTION_COMMAND, dc) #instead of simulating the button click, send a message to the tag, which should be thread safe c4d.utils.SendModelingCommand(c4d.MCOMMAND_EDGE_TO_SPLINE, [obj]) #Converts the selected edges to a spline object if __name__=='__main__': main() #This script executes the mirror tool options #Only works in R13+ import c4d from c4d import gui def main() : c4d.CallCommand(1019953) tool=doc.GetAction() tool=c4d.plugins.FindPlugin(tool, c4d.PLUGINTYPE_TOOL) c4d.CallButton(tool, c4d.ID_CA_MIRROR_TOOL) c4d.EventAdd() if __name__=='__main__': main() #This is the shorter version c4d.CallButton(c4d.plugins.FindPlugin(tool,c4d.PLUGINTYPE_TOOL), c4d.ID_CA_MIRROR_TOOL) #This script executes the Naming tool options #Only works in R13+ import c4d from c4d import gui def main() : c4d.CallCommand(1019952) tool=doc.GetAction() tool=c4d.plugins.FindPlugin(tool, c4d.PLUGINTYPE_TOOL) tool[c4d.ID_CA_JOINT_NAMING_REPLACE] = "Cube" #Set the text to replace tool[c4d.ID_CA_JOINT_NAMING_REPLACE_WITH]= "fdsdf" #Set the new text c4d.CallButton(tool, c4d.ID_CA_JOINT_NAMING_REPLACE_APPLY) c4d.EventAdd() if __name__=='__main__': main() #This code executes the Apply button from the "Apply,NewTransformation,Reset" options import c4d from c4d import plugins def main() : movedObj = doc.SearchObject("Sphere") targetObj = doc.SearchObject("Cube") c4d.CallCommand(c4d.ID_MODELING_TRANSFER_TOOL) #Launch the Transfer tool tool = plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) if tool is not None: tool[c4d.MDATA_TRANSFER_OBJECT_LINK] = targetObj c4d.CallButton(tool, c4d.MDATA_APPLY) c4d.EventAdd() if __name__=='__main__': main() #This example shows how to execute the buttons in the multishader shader #Other ID's can be found in: ..\..\..\CINEMA 4D R13\modules\mograph\res\description\xmg_multi.h import c4d def main() : mat = doc.GetFirstMaterial() #Get the material shdr = mat[c4d.MATERIAL_COLOR_SHADER] #Get the shader in the color channel c4d.CallButton(shdr, c4d.MGMULTISHADER_ADD) #Adds a new shader to the list c4d.CallButton(shdr, c4d.MGMULTISHADER_CLEAR) #Removes the last shader from the list c4d.EventAdd() if __name__=='__main__': main() #This executes the "Copy From IRR" button in the render settings import c4d def main() : rdata = doc.GetActiveRenderData() c4d.CallButton(rdata, c4d.RDATA_FROMIRR) c4d.EventAdd() if __name__=='__main__': main()
I also have lots of notes on how to execute various types of buttons in C++ too.
I had to bug Matthias with a lot of silly questions to compile them. If anyone wants them. I'll post them too. Because they aren't in the docs.
Between my C++ notes and my Python notes. I can usually (but not always) figure out how to execute almost any button.-ScottA
-
On 11/06/2013 at 08:39, xxxxxxxx wrote:
Yes, please. The more examples, the better.
E.g. in the Content Browser go to a specific directory.
Go Presets, Favorites is simple, but a specific directory is more complicated.
d:\c4d\presets\small\Here an example of Bake Texture.
It creates the tag, does some settings and give the command.def AddBakeTag(bakeobject, w,h, naam) : c4d.CallCommand(1011133) # Bake Texture tag = bakeobject.GetTag(c4d.Tbaketexture) tag[c4d.ID_BASELIST_NAME] = "Naam" tag[c4d.BAKETEXTURE_FORMAT] = c4d.FILTER_HDR tag[c4d.BAKETEXTURE_WIDTH] = w tag[c4d.BAKETEXTURE_HEIGHT] = h tag[c4d.BAKETEXTURE_CHANNEL_REFLECTION] = True if (not naam == "") : tag[c4d.BAKETEXTURE_NAME] = naam c4d.CallButton(tag, c4d.BAKETEXTURE_BAKE) return tag
-
On 11/06/2013 at 08:47, xxxxxxxx wrote:
Originally posted by xxxxxxxx
The CallButton takes many different things: tags, tools, etc..
None of this is documented very well (if at all).It actually is documented:
Originally posted by xxxxxxxx
c4d.CallButton
(op, id)
_<_dt id="c4d.call" style=": rgb251, 234, 174;"_>_Simulate a click of a button.
For example, here is how to call the 'Apply' button of a Tool:import c4d
c4d.CallCommand(c4d.ID_MODELING_TRANSFER_TOOL) # Set Transfer as current Tool
tool = plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) # Search Transfer Tool instance
if tool is not None:
c4d.CallButton(tool, c4d.MDATA_APPLY)
c4d.EventAdd()_Parameters:|
- op (
BaseList2D
) – The object. - id (int) – The ID of the button._/ul>
CallButton() accepts a BaseList2D object. This includes tags, objects, materials, xpresso nodes,
render data, layer objects, curves, tracks, shaders...Originally posted by xxxxxxxx
#These are the various plugin types and their ID's.That are used in the CallButton() function
1. The PLUGINTYPE_ constants are defined in the c4d module 2. they are not used with CallButton(),
indirectly they are, yes. But not in all cases so it can not be generalized.Kind regards,
-Niklas - op (
-
On 11/06/2013 at 12:50, xxxxxxxx wrote:
Niklas,
The docs do not explain what you think they do. You're seeing things that aren't there.
You're using knowledge you've picked up as tools to decrypt what's implied...but not actually written in them.
You're no longer reading the docs. You're interpreting them using years of tips and tricks you've collected.If I took you for a ride in my time machine back about three or four years. And gave you the current docs and said "There you go..everything you need is in there". You'd probably call me dirty name after reading them.
-ScottA