<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[PYTHON Development]]></title><description><![CDATA[PYTHON Development]]></description><link>http://developers.maxon.net/forum/category/40</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 01:32:06 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/category/40.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Sep 2018 11:29:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Script Write to Annotation Tag on Save]]></title><description><![CDATA[<p dir="auto"><em>On 31/08/2018 at 07:42, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">I can't seem to figure out how to get<br />
MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE<br />
to trigger.</p>
<p dir="auto">I would like to save some info to an Annotation tag, but only right before the user saves the document.</p>
<p dir="auto">Tried to put it in Message() but couldn't figure out if Message can stand by itself or if it has to be in a NodeData class?</p>
<pre><code>class SampleClass(plugins.NodeData) :
    def Message(self, node, type, data) :
        if type == c4d.MSG_DOCUMENTINFO:
            if data['type'] == c4d.MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE:
                print "Document is about to save"
                return True
            return True
</code></pre>
<p dir="auto">Thanks</p>
]]></description><link>http://developers.maxon.net/forum/topic/10944/14404_script-write-to-annotation-tag-on-save</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10944/14404_script-write-to-annotation-tag-on-save</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 11:29:06 GMT</pubDate></item><item><title><![CDATA[Outline selection?]]></title><description><![CDATA[<p dir="auto"><em>On 30/08/2018 at 13:12, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi all,</p>
<p dir="auto">How can I select the outline edges of selected polygons in python, just like the command "Outline Selection"?</p>
<p dir="auto">Best regards</p>
<p dir="auto">Fnoller</p>
]]></description><link>http://developers.maxon.net/forum/topic/10943/14403_outline-selection</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10943/14403_outline-selection</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 11:29:00 GMT</pubDate></item><item><title><![CDATA[Art shader, or load from content browser ?]]></title><description><![CDATA[<p dir="auto"><em>On 30/08/2018 at 02:01, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">First off I'm new here, and also very new with python.<br />
I'm trying to create a pretty basic material using python, but it seems not so easy.</p>
<p dir="auto">I have two questions:<br />
How can I add the Art shader to a channel?</p>
<p dir="auto">It's not listed in the SDK shader list.<br />
So it's probably not like I'm just missing the right word here, is it ?</p>
<p dir="auto">&gt; matt[c4d.MATERIAL_USE_LUMINANCE] = True<br />
&gt;<br />
&gt; Art = c4d.BaseList2D(c4d.X...something.....)<br />
&gt;<br />
&gt; matt.InsertShader( Art )<br />
&gt;<br />
&gt; matt[c4d.MATERIAL_LUMINANCE_SHADER] = Art</p>
<p dir="auto">I also want it to load a image in the art shader, so I figured, why don't I just create a preset folder in the content browser and load the material form that folder. <br />
Turns out it's quite tricky to import materials from the content browser too.</p>
<p dir="auto">&gt; fn = "preset://somefolder/Cube.2.c4d"<br />
&gt;<br />
&gt; c4d.documents.LoadFile(fn)</p>
<p dir="auto">If I use anything else then LoadFile, it will tell me to use a base document in the console.</p>
<p dir="auto">From my understanding, I have to make a virtual base document and then import it from that.<br />
How does that look like in code ?</p>
<p dir="auto">I only need one to work, but I am very interested in both!</p>
<p dir="auto">Cheers,<br />
Tim</p>
]]></description><link>http://developers.maxon.net/forum/topic/10942/14402_art-shader-or-load-from-content-browser-</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10942/14402_art-shader-or-load-from-content-browser-</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 11:28:52 GMT</pubDate></item><item><title><![CDATA[&quot;Connect Objects&quot; in a Generator?]]></title><description><![CDATA[<p dir="auto"><em>On 28/08/2018 at 23:16, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Is there a way to do the equivalent of "Connect Objects" (or "Connect and Delete") in a Python Generator?</p>
<p dir="auto">I am creating a hierarchy of groups of groups of polys, and the viewport is very slow. Perhaps it would be faster if I could convert it to a single poly object and optimize it?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10939/14399_connect-objects-in-a-generator</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10939/14399_connect-objects-in-a-generator</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 11:00:02 GMT</pubDate></item><item><title><![CDATA[CommandData Plugin with submenu]]></title><description><![CDATA[<p dir="auto"><em>On 28/08/2018 at 02:32, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi there,</p>
<p dir="auto">i'm failing to get a submenu with a commanddata plugin...<br />
could anybody more experienced maybe have a look at this code?</p>
<p dir="auto">best, index</p>
<p dir="auto">my folder structure is:<br />
plugins<br />
Test<br />
test.pyp<br />
icon.png</p>
<p dir="auto">what i would like to get in the plugin menu is:<br />
Plugins<br />
Test Plugin<br />
Submenu1<br />
Submenu2</p>
<p dir="auto">but what i get with the following code is just: (no submenu!)<br />
Plugins<br />
Test</p>
<p dir="auto">import c4d<br />
from c4d import bitmaps<br />
import os.path</p>
<p dir="auto">PLUGIN_ID = 1234567  # unique ID (obtained from <a href="http://www.plugincafe.com" target="_blank" rel="noopener noreferrer nofollow ugc">www.plugincafe.com</a>)<br />
PLUGIN_SHORT = "Test Plugin"</p>
<p dir="auto">MENUID_SUB1 = 1000<br />
MENUID_SUB2 = 1010</p>
<p dir="auto">class MenuHandler(c4d.plugins.CommandData) :</p>
<pre><code>def Register(self) :
	bmp = bitmaps.BaseBitmap()
	dir, f = os.path.split(\__file\_\_)
	fn = os.path.join(dir, "icon.png")
	bmp.InitWith(fn)
	return c4d.plugins.RegisterCommandPlugin(
		id=PLUGIN_ID,
		str=PLUGIN_SHORT,
		info=c4d.PLUGINFLAG_COMMAND_HOTKEY,
		icon=bmp,
		help="",
		dat=self
	)


def GetSubContainer(self, doc, submenu) :
	bc = c4d.BaseContainer()
	bc.SetString(1, PLUGIN_SHORT)
	bc.SetString(MENUID_SUB1, "Submenu1")
	bc.SetString(MENUID_SUB2, "Submenu2")
	submenu.InsData(0, bc)
	return True


def ExecuteSubID(self, doc, id) :
	if id == MENUID_SUB1: print "Submenu1"
	elif id == MENUID_SUB2: print "Submenu2"
	return True


def Execute(self, doc) :
	return True
</code></pre>
<p dir="auto">if __name__ == "__main__":<br />
MenuHandler().Register()</p>
]]></description><link>http://developers.maxon.net/forum/topic/10938/14398_commanddata-plugin-with-submenu</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10938/14398_commanddata-plugin-with-submenu</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:43 GMT</pubDate></item><item><title><![CDATA[Accessing Hotspots in Visual Selector]]></title><description><![CDATA[<p dir="auto"><em>On 27/08/2018 at 20:41, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,<br />
I've been trying to create a Python script to automate my Visual Selector setup (particularly setting the transparency to 100% for all hotspots, of which there are many). I looked at the C++ documentation and there appears to be an ID called <strong>ID_CA_TAG_VS_HOTSPOTS</strong> , but I'm unable to get the list of hotspots from it. This is my current approach:</p>
<pre><code>tag = doc.GetActiveTag()
print tag		#&lt;c4d.BaseTag object called 'Visual Selector/Visual Selector' with ID 1026275 at 0x0000026255AE3710&gt;
print tag[c4d.ID_CA_TAG_VS_HOTSPOTS]		#AttributeError: Parameter value not accessible (object unknown in Python)
</code></pre>
<p dir="auto">Could anyone help me with this? Thank you.</p>
]]></description><link>http://developers.maxon.net/forum/topic/10936/14395_accessing-hotspots-in-visual-selector</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10936/14395_accessing-hotspots-in-visual-selector</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:24 GMT</pubDate></item><item><title><![CDATA[change plugin&#x27;s  .h file,can not  update]]></title><description><![CDATA[<p dir="auto"><em>On 27/08/2018 at 03:58, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,<br />
For example, I set SPONE = 1001 in the header file, SPTWO = 1002, then I successfully loaded and ran the plugin in cinema 4d, but I changed the settings of the header file, such as SPONE = 1002, SPTWO = 1001 Then I run the plugin again in cinema 4d. I typed c4d.SPONE in the console but it will return 1001, and I didn't update the changes I made, even if I completely removed the plugin when I was in the console. When I type c4d.SPONE, it will still return 1001. It seems to be stored. I don't understand it very well. I want to know exactly how to ensure that the cinema 4d will be updated when I change the value in the header file again. What should I do?</p>
<p dir="auto">Thanks!</p>
]]></description><link>http://developers.maxon.net/forum/topic/10935/14393_change-plugins--h-filecan-not--update</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10935/14393_change-plugins--h-filecan-not--update</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:10 GMT</pubDate></item><item><title><![CDATA[find material slot for shader]]></title><description><![CDATA[<p dir="auto"><em>On 26/08/2018 at 07:20, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">hi there,</p>
<p dir="auto">is it possible to find the shader slot in a material for a given shader?</p>
<p dir="auto">i.e. if i have this setup<br />
Mat[c4d.MATERIAL_USE_COLOR] = some_shader</p>
<p dir="auto">can i find c4d.MATERIAL_USE_COLOR if i have only Mat and some_shader?</p>
<p dir="auto">--&gt; I'd need something like:<br />
findSlot(Mat, some_shader)  # 2000 (c4d.MATERIAL_USE_COLOR)</p>
<p dir="auto">best, index</p>
]]></description><link>http://developers.maxon.net/forum/topic/10934/14391_find-material-slot-for-shader</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10934/14391_find-material-slot-for-shader</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:02 GMT</pubDate></item><item><title><![CDATA[PolygonReduction class is not renderable]]></title><description><![CDATA[<p dir="auto"><em>On 26/08/2018 at 03:30, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">I'm using PolygonReduction class in my OBJECT_GENERATOR plugins.<br />
When I'm making the desired object a child of it, it works correctly and but it is not working when I'm rendering it with physical render in the viewport.</p>
<p dir="auto"><img src="https://i.imgur.com/Ls2KXFq.gif" alt="" class=" img-fluid img-markdown" /></p>
<pre><code>  
import c4d
  
class test(c4d.plugins.ObjectData) :
  
    def GetVirtualObjects(self, op, hh) :
        if not op.GetDown() : return None
  
        gch = op.GetAndCheckHierarchyClone(hh, op.GetDown(), c4d.HIERARCHYCLONEFLAGS_ASPOLY, False)
        polyObject = gch["clone"]
  
        if not gch["dirty"]: return polyObject
  
        data = {}
        data['_op'] = polyObject
        data['_doc'] = op.GetDocument()
        data['_thread'] = None
  
        polyReduction = c4d.utils.PolygonReduction()
  
        if not polyReduction.PreProcess(data) : return True  
        polyReduction.SetReductionStrengthLevel(0.9)
        polyObject.Message(c4d.MSG_UPDATE)
        return polyObject
  
if __name__ == "__main__":
    result = c4d.plugins.RegisterObjectPlugin(id = 1000001,str = "?",g = test,description = "",info = c4d.OBJECT_GENERATOR|c4d.OBJECT_INPUT,icon = None)
</code></pre>
<p dir="auto">Download Plugin: <a href="http://www.dropbox.com/s/97c9xn941ywurg9/Test%20Plugin%200.4.zip?dl=0" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.dropbox.com/s/97c9xn941ywurg9/Test%20Plugin%200.4.zip?dl=0</a></p>
]]></description><link>http://developers.maxon.net/forum/topic/10932/14389_polygonreduction-class-is-not-renderable</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10932/14389_polygonreduction-class-is-not-renderable</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:52 GMT</pubDate></item><item><title><![CDATA[Python in the context of CMotion]]></title><description><![CDATA[<p dir="auto"><em>On 25/08/2018 at 07:45, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">I'm digging around some areas of c4d which I've neglected for a while, today its the CMotion object.<br />
Does anyone know of any examples or use cases for python in the context of CMotion actions? Does it have some predefined parameters/variables? in the help file it just says <br />
"You can write, copy, paste, etc.. your Python scripts in this input field. They will be executed automatically by CMotion once the animation is run."</p>
<p dir="auto">So I assume there must be some method of addressing relevant / relative cmotion properties?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10930/14387_python-in-the-context-of-cmotion</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10930/14387_python-in-the-context-of-cmotion</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:30 GMT</pubDate></item><item><title><![CDATA[Generating Standard Particles using Python]]></title><description><![CDATA[<p dir="auto"><em>On 23/08/2018 at 08:56, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">I have some ideas about extending the Standard Particle (SP) emitter.</p>
<p dir="auto">Is it possible to generate Standard Particles using Python? With a Python Generator?</p>
<p dir="auto">Cheers<br />
Thanassis</p>
]]></description><link>http://developers.maxon.net/forum/topic/10929/14386_generating-standard-particles-using-python</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10929/14386_generating-standard-particles-using-python</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:25 GMT</pubDate></item><item><title><![CDATA[Camera Commands]]></title><description><![CDATA[<p dir="auto"><em>On 23/08/2018 at 08:52, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">I'm not sure how to activate/deactivate camera commands with python. Do I need to get the active basedraw and use c4d.BaseList2D.__setitem__() to set the state for things like Object Mode, Cursor Mode, etc?</p>
<p dir="auto">I see that in the symbols there is IDS_CAMERACOMMAND_OBJECTMODE but i'm not sure where to plug that into toggle on and off?</p>
<p dir="auto">Thank you</p>
]]></description><link>http://developers.maxon.net/forum/topic/10928/14385_camera-commands</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10928/14385_camera-commands</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:58:12 GMT</pubDate></item><item><title><![CDATA[Python Generator: how to access &#x27;self&#x27; object?]]></title><description><![CDATA[<p dir="auto"><em>On 22/08/2018 at 14:56, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">In my Python Generator code I want to create an Object Selection tag and actually insert it in the Generator object itself, so the user can see it in the Object Manager.</p>
<p dir="auto">But "self is not defined". How to do this?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10926/14382_python-generator-how-to-access-self-object</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10926/14382_python-generator-how-to-access-self-object</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:57:50 GMT</pubDate></item><item><title><![CDATA[Listening for Checkbox Clicks in User Data]]></title><description><![CDATA[<p dir="auto"><em>On 22/08/2018 at 14:13, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hello,<br />
Is it possible, with a Python tag or otherwise, to listen for the click of an object's User Data checkbox? I have gotten this to work with the User Data button in the past. I'm looking to run some scripts when the user checks a "Use IK" checkbox.</p>
<p dir="auto">I tried overriding the "message" method in my Python tag, but I couldn't find any of the attributes for the data object that gets passed as a parameter. In my web searches, it seemed that attributes such as 'descid' only existed for certain types of message data.</p>
<p dir="auto">Any clarification on how to set this up (and decipher the message data) would be very helpful. Thank you.</p>
]]></description><link>http://developers.maxon.net/forum/topic/10925/14381_listening-for-checkbox-clicks-in-user-data</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10925/14381_listening-for-checkbox-clicks-in-user-data</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:57:42 GMT</pubDate></item><item><title><![CDATA[Animated user data for Python Generator - how?]]></title><description><![CDATA[<p dir="auto"><em>On 22/08/2018 at 13:39, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">I have a simple Python generator that creates some polys.</p>
<p dir="auto">In the Generator's User Data there is a Link for a texture tag, which gets cloned by the generator and assigned to the created polys.</p>
<p dir="auto">I want to allow the user to animate some of the parameters of the cloned texture tag (eg Offset and Length).</p>
<p dir="auto">I assume I need to create User Data elements for these parameters, so the user can animate them.</p>
<p dir="auto">But how do I link the User Data so that its changing values get propagated to the properties of the cloned tag created in the Generator?</p>
<p dir="auto">Or am I going about this the wrong way..?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10924/14380_animated-user-data-for-python-generator--how</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10924/14380_animated-user-data-for-python-generator--how</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:57:34 GMT</pubDate></item><item><title><![CDATA[Save All Materials]]></title><description><![CDATA[<p dir="auto"><em>On 22/08/2018 at 06:51, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi everyone,</p>
<p dir="auto">I'm trying to save all of the project materials into a .c4d file?<br />
This will be inside a CommandData plugin and unfortunately can't find a way of saving only the materials.</p>
<p dir="auto">Does anyone have a way of dealing with this?</p>
<p dir="auto">Thank you very much! <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":slightly_smiling_face:" alt="🙂" /></p>
]]></description><link>http://developers.maxon.net/forum/topic/10923/14379_save-all-materials</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10923/14379_save-all-materials</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:57:26 GMT</pubDate></item><item><title><![CDATA[Change Colour of EDITTEXT_HELPTEXT]]></title><description><![CDATA[<p dir="auto"><em>On 20/08/2018 at 08:12, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi all,</p>
<p dir="auto">Just wondering if it would be possible to change the colour of the c4d.EDITTEXT_HELPTEXT flag in the AddEditText widget?<br />
Couldn't find an answer anywhere.</p>
<p dir="auto">Thank you very much in advance <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":slightly_smiling_face:" alt="🙂" />!</p>
]]></description><link>http://developers.maxon.net/forum/topic/10922/14377_change-colour-of-edittexthelptext</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10922/14377_change-colour-of-edittexthelptext</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:57:19 GMT</pubDate></item><item><title><![CDATA[Cycle drop-down with thumbnails]]></title><description><![CDATA[<p dir="auto"><em>On 17/08/2018 at 06:44, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Is there a way for creating thumbnails in plugin's UI, similar to C4D's noise thumbnails?</p>
<p dir="auto"><img src="https://i.imgur.com/49UklKD.jpg" alt="" class=" img-fluid img-markdown" /></p>
]]></description><link>http://developers.maxon.net/forum/topic/10920/14375_cycle-dropdown-with-thumbnails</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10920/14375_cycle-dropdown-with-thumbnails</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:57:09 GMT</pubDate></item><item><title><![CDATA[searching immediate hierarchy]]></title><description><![CDATA[<p dir="auto"><em>On 16/08/2018 at 15:00, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">This problem was seemingly simple to solve but is giving me a hard time. I have the standard procedure for iterating through the object hierarchy from a selected object but I don't want it to keep going after the last object in the immediate hierarchy. I'm using this as a starting point:</p>
<pre><code>def GetNextObject(op) :
    if op==None:
        return None
 
    if op.GetDown() :
        return op.GetDown()
 
    while not op.GetNext() and op.GetUp() :
        op = op.GetUp()
 
    return op.GetNext()
  
def IterateHierarchy(op) :
    if op is None:
        return
 
    while op:
        op = GetNextObject(op)
        
def main() :
  start_object = doc.GetActiveObject()
</code></pre>
<p dir="auto">So far the only way I've found to get it to search within the immediate hierarchy only is to give IterateHierarchy function the same argument twice, which is the active object, so I can have a reference to the original object while the other is getting replaced by the next object in the sequence . I want the code to say "if you get back to the active object(original object) then end the loop. It seems a bit sloppy the way I did it and i'm sure I am doing wrong. Is there an easier way to start from an object and only search from there down?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10919/14374_searching-immediate-hierarchy</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10919/14374_searching-immediate-hierarchy</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:57:01 GMT</pubDate></item><item><title><![CDATA[How to use bridge tool in Python script]]></title><description><![CDATA[<p dir="auto"><em>On 16/08/2018 at 13:30, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">To automate some of my modelling workflows, I am currently trying to execute some bridge commands via scripts. Specifically, I try to bridge two polygons. How can I do this with a python script? I have two objects and the selected polygons to bridge. I tried:</p>
<p dir="auto">c4d.CallCommand(450000008) # Bridge<br />
    tool()[c4d.MDATA_BRIDGE_OBJINDEX1] = doc.SearchObject("Test2")<br />
    tool()[c4d.MDATA_BRIDGE_OBJINDEX2] = doc.SearchObject("Test")<br />
    tool()[c4d.MDATA_BRIDGE_ELEMENT1] = 0<br />
    tool()[c4d.MDATA_BRIDGE_ELEMENT2] = 0<br />
    tool()[c4d.MDATA_BRIDGE_DELETE] = True<br />
    tool()[c4d.MDATA_BRIDGE_ISO] = False<br />
 <br />
    c4d.CallButton(tool(), c4d.MDATA_APPLY)</p>
<p dir="auto">But I had no luck so far. Honestly, I have no clue what MDATA_BRIDGE_OBJINDEX1 and MDATA_BRIDGE_ELEMENT1 really should be. There is also no real documentation how this should work.</p>
]]></description><link>http://developers.maxon.net/forum/topic/10918/14373_how-to-use-bridge-tool-in-python-script</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10918/14373_how-to-use-bridge-tool-in-python-script</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:56:53 GMT</pubDate></item><item><title><![CDATA[Using UVCOMMAND with Multiple Objects]]></title><description><![CDATA[<p dir="auto"><em>On 14/08/2018 at 09:24, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hello,<br />
I'm trying to move UVs using UVCOMMAND for a UDIM setup with multiple selected objects. In my current script, the transforms only happen to the last object in the list. I've tried other flags for the Active UV set and selecting the UV Polygons before UVCOMMAND is called. Nothing is working. Could someone please tell me what I am doing incorrectly? Here's my code.</p>
<pre><code>def moveUVs(obj,index) :
    # Retrieves active UVSet
    handle = bodypaint.GetActiveUVSet(doc, c4d.GETACTIVEUVSET_ALL)
    if not handle:
        print "No active UVSet!"
        return
    
    settings = c4d.BaseContainer()
    settings[c4d.UVCOMMAND_TRANSFORM_MOVE_X] = index
    settings[c4d.UVCOMMAND_TRANSFORM_MOVE_Y] = 0
    settings[c4d.UVCOMMAND_TRANSFORM_SCALE_X] = 1
    settings[c4d.UVCOMMAND_TRANSFORM_SCALE_Y] = 1
    settings[c4d.UVCOMMAND_TRANSFORM_ANGLE] = utils.DegToRad(0)
  
    # Retrieves UVW list
    uvw = handle.GetUVW()
    if uvw is None:
        return
    
    # Calls UVCOMMAND_TRANSFORM to change UVW list
    ret = bodypaint.CallUVCommand(handle.GetPoints(), handle.GetPointCount(), handle.GetPolys(), handle.GetPolyCount(), uvw,
                                  handle.GetPolySel(), handle.GetUVPointSel(), handle.GetBaseObject(), handle.GetMode(), c4d.UVCOMMAND_TRANSFORM, settings)
    if not ret:
        print "CallUVCommand() failed!"
        return
    
    print "CallUVCommand() successfully called"
  
    # Sets the transformedUVW from Texture View 
    if handle.SetUVWFromTextureView(uvw, True, True, True) :
        print "UVW from Texture View successfully set"
    else:
        print "UVW from Texture View failed to be set!"
    
    # Releases active UVSet
    bodypaint.FreeActiveUVSet(handle)
  
def main() :
    objs = doc.GetActiveObjects(0)
    doc.StartUndo()
    for idx, obj in enumerate(objs) :
        moveUVs(obj,idx)
        c4d.EventAdd()
    doc.EndUndo()
  
if __name__=='__main__':
    main()
</code></pre>
<p dir="auto">Thank you!</p>
]]></description><link>http://developers.maxon.net/forum/topic/10915/14369_using-uvcommand-with-multiple-objects</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10915/14369_using-uvcommand-with-multiple-objects</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:56:27 GMT</pubDate></item><item><title><![CDATA[How get active renderer]]></title><description><![CDATA[<p dir="auto"><em>On 13/08/2018 at 21:52, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi gues, how i may get active renderer name and version if i use redshift or octane?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10913/14367_how-get-active-renderer</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10913/14367_how-get-active-renderer</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:56:14 GMT</pubDate></item><item><title><![CDATA[Get value of chosen Combobox&#x2F;Dropdown in Layout]]></title><description><![CDATA[<p dir="auto"><em>On 12/08/2018 at 22:03, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">How can I get the value(string) from a combobox dropdown in a layout window?</p>
<p dir="auto">I can use GetLong to get the subID, but the string and the subId are both created dynamically.</p>
<p dir="auto">for example if I added the child<br />
self.AddChild(1001,10011,"Circle")<br />
I can get 10011 with self.GetLong(1001)<br />
How would I get "Circle" if I knew the (10011)?</p>
<p dir="auto">Thank you.</p>
]]></description><link>http://developers.maxon.net/forum/topic/10912/14363_get-value-of-chosen-comboboxdropdown-in-layout</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10912/14363_get-value-of-chosen-comboboxdropdown-in-layout</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:56:00 GMT</pubDate></item><item><title><![CDATA[Call Command to button]]></title><description><![CDATA[<p dir="auto"><em>On 12/08/2018 at 03:49, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hello there,</p>
<p dir="auto">I am trying link a call command to a user data button. (See Image below)</p>
<p dir="auto">Is it possible with a python tag?</p>
<p dir="auto"><img src="https://image.ibb.co/kvKCBU/Screenshot_2.png" alt="" class=" img-fluid img-markdown" /></p>
]]></description><link>http://developers.maxon.net/forum/topic/10910/14361_call-command-to-button</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10910/14361_call-command-to-button</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:55:45 GMT</pubDate></item><item><title><![CDATA[Reuse code from helper class]]></title><description><![CDATA[<p dir="auto"><em>On 11/08/2018 at 08:27, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi</p>
<p dir="auto">I'm just learning python for Cinema 4d and have a really beginner question.</p>
<p dir="auto">How do I import a helper class from another file?</p>
<p dir="auto">----- <a href="http://Helper.py" target="_blank" rel="noopener noreferrer nofollow ugc">Helper.py</a> ---------------</p>
<pre><code>class Helpers(object) :  
    def \__init\_\_(self, arg) :  
        super(Helpers, self).\__init\_\_()  
  
    @staticmethod  
    def myFunction() :  
        print("My helper function")
</code></pre>
<p dir="auto">---- Main <a href="http://script.py" target="_blank" rel="noopener noreferrer nofollow ugc">script.py</a> -------------</p>
<pre><code>import c4d  
import Helpers  
  
def main() :  
    Helpers.myFunction()  
  
if \__name\_\_=='\__main\_\_':  
    main()
</code></pre>
<p dir="auto">When I try this, I get an error "ImportError: No module named Helpers"</p>
<p dir="auto">What am I doing wrong?</p>
]]></description><link>http://developers.maxon.net/forum/topic/10909/14360_reuse-code-from-helper-class</link><guid isPermaLink="true">http://developers.maxon.net/forum/topic/10909/14360_reuse-code-from-helper-class</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:55:37 GMT</pubDate></item></channel></rss>