I need serious guidance [video]

On 23/06/2015 at 17:23, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 Demo 
Platform:      Mac OSX  ; 
Language(s) :      XPRESSO  ;  PYTHON  ;

Please watch this video I just created. You should be able to tell if you can guide me: https://www.youtube.com/watch?v=2JEBk0tiKXw&feature=youtu.be

It has everything to do with how I am so new and I am not sure if I am taking the correct approaches.

On 24/06/2015 at 01:41, xxxxxxxx wrote:

1. Dude! You need to practise making precise questions. 13 min videos on youtube is not a good solution 🙂
2. I don't know why you're not using Mograph to do this. Check out the Shader Effector for starters.
3. Just a tip: The SDK Help part of the forum is for c++ related questions. You might be better off posting these kind of questions in the "General Discussions" forum.


On 24/06/2015 at 08:30, xxxxxxxx wrote:

bonsak, thanks for your reply.

I use a shader effector for each color of the image's color palette. For instance, I am right now working with an image that causes my script to generate 13 shader effectors. I don't know why you thought I wasn't using shader effects, teheh! The only purpose of creating a separate mograph shader effector for each color is so that I can also apply a separate mograph selection to it, and that's how I draw the image to the cloner grid array, making a 1:1 pixel to cloner object color mapping.

Anyways, I have since figured out my entire solution last night / this morning. I now have all of my custom user data.  But, I was really hoping experienced people could have guided me more efficiently, but I did not have the time to sit and wait around haha!. Even now, I am not sure that creating so many shader effectors with mograph selections is the easiest way to map 1:1 an image's pixel to a clone child of the grid array. Nor do I know whether C4D can achieve this effect without my script.. Furthermore, I am not so sure how well is my solution. To achieve my solution, I ended up scrapping the 75% achieved Python<->Xpresso bridge, because the Xpresso failed to be driven correctly from Python in 2 ways, each of them is documented by myself; I posted forum threads on the Python SDK forum so that experts can clarify my findings.

Thus, I created a Python tag whose body is dynamically crafted from the Python script. By dynamic, I mean its body is filled with the relevant user data IDs that were generated during the creation of user data. This python tag is always querying the nearby object data and user data, and interfacing the two. It is working OK so I'm happy. Although I do not quite understand fully the frequency of the python node's running, and whether it's preferable to run the code in a loop or not. I am not using a loop but the node is consistently driven frequently enough to satisfy my update needs based on interaction with the user data. From my observation the node is ran whenever user input is actively being driven, at least.

I ran into several hiccups that can only allude to there being bugs in C4D but since I have no expert reference and no replies yet to my forum thread submissions, I can not verify my findings. I will wait for this, but it's really in your hands (professionals of MAXON).

The PythonSDK Documentation is not well put together for the novice newcomer. I found most of the wealth in information lurking around various message boards including this one, and only by putting together the shards strewn across the internet was I able to put together a well pieced software. The concepts I learned I hope I can arrange into a tutorial or organized learning center which I would like to submit to MAXON since I have no use for hosting the material online myself. I am not interested in housing that kind of information, although at worst case I could do so. But this knowledge belongs in the SDK doc, which only has 2 uncommon example code snippets in its Cookbook. Psh. :[ It needs a lot of improvement so that's where I come in. I have learned various common and necessary techniques that are not documented, including (in no particular order) :

  • Creating a texture
  • Creating a color shader for the texture
  • Creating a texture tag, applying it to the object
  • Using the Console to discover how to access much of the data in C4D.
  • Using the Script Manager to save time testing your script.
    • Using with external text editor
    • creating a script icon for placing in your GUI
  • Creating Mograph selection
  • General object creation routine (create, title, insert to document)
  • Undo history - although I don't quite have the ordering right. I didn't bother to experiment, but if I will then this will be another notch under my belt.
  • Creating Xpresso Tag
  • Modifying Cloner attributes
  • Creating Xpresso Nodes / Ports. Creating Python Nodes/Ports
  • Creating UserData, accessing the data from Python and adding Userdata to Xpresso Ports.
  • Create a mograph shader effector - create color and control the color
  • Create and populate Python tag from Python script
  • Using Script Log to record some activity in GUI, such as tool selection.

I didn't see any of this in SDK. Although I enjoyed the challenge in free thinking and putting the puzzle together, it is not necessary anymore. I have learned these concepts and I wouldn't mind creating more friendly forms of teaching the material. Not everybody is in the mood to break apart example source code searching for the missing pieces.. But if he can read the headline "How to create a texture" he is drawn in by that.

On 25/06/2015 at 01:45, xxxxxxxx wrote:

Thanks. You can get the same color mapping effect happening with the shader effector on a regular Cloner setup. Check out the attachment.

I agree that the Python SDK is not optimal. It should have a lot more examples.
The search function in this forum is not optimal either. You'll get a lot more hits if you use google to search this forum. Try searching for "shader effector" in the regular search box here, and then go to google.com and enter this:
shader effector site:www.plugincafe.com.
See the difference?


On 26/06/2015 at 07:27, xxxxxxxx wrote:

Thanks for making that Bonsak!! I learned that by setting the Texture image Sampling to 'None' I get exactly what I'm after. Also, sometimes I require putting a texture with the color channel set to "mograph Color Shader" to get the color to appear properly.

I also learned that you can put a texture tag on the shader effector, I was always adding custom effectors, but this is a nice alternative.

On 29/06/2015 at 06:19, xxxxxxxx wrote:


if you think you found a bug in the API please report this in the Bug Reports subforum. If you need help with Cinema 4D or want to report a Cinema 4D bug please use the online form.

We agree that the documentation can be improved and we are working on different ways to improve the documentation and to share more information and examples. But Cinema 4D is a complex tool and thus the API is complex and targeted at professional programmers. Please be aware of the existing Python Examples and also the the C++ documentation that includes some more information.

Best wishes,