5

LONG CYCLEs with icons and separator

You want to display icons in a LONG CYCLE? Easy as pie, this article will show you how it works!

This is how it looks in the Character object:

A CYCLE with icons in the Character object, used for the template selection on top

A CYCLE with icons in the Character object, used for the template selection on top

How it works

If you don’t need a sophisticated solution like the CYCLEBUTTON, but simply some icons in a LONG CYCLE, you can do this with just a small addition to your plugin’s .res file.

Here’s an exemplary .res file with a normal LONG CYCLE:

CONTAINER Omyobject
{
	NAME Omyobject;
	INCLUDE Obase;

	GROUP ID_OBJECTPROPERTIES
	{
		LONG MYOBJECT_ICONCYCLE
		{
			CYCLE
			{
					MYOBJECT_ICONCYCLE_ITEM_0;
					MYOBJECT_ICONCYCLE_ITEM_1;
					MYOBJECT_ICONCYCLE_ITEM_2;
					MYOBJECT_ICONCYCLE_ITEM_3;
			}
		}
	}
}

It will look like this:

A normal LONG CYCLE

Before

Now we add icons to the cycle items 1, 2, and 3, as well as a separator line between the items 0 and 1:

CONTAINER Omyobject
{
	NAME Omyobject;
	INCLUDE Obase;

	GROUP ID_OBJECTPROPERTIES
	{
		LONG MYOBJECT_ICONCYCLE
		{
			CYCLE
			{
					MYOBJECT_ICONCYCLE_ITEM_0;
					-1;
					MYOBJECT_ICONCYCLE_ITEM_1~Ocube;
					MYOBJECT_ICONCYCLE_ITEM_2~Opyramid;
					MYOBJECT_ICONCYCLE_ITEM_3~1021433;
			}
		}
	}
}

It now looks like this:

A pretty CYCLE BUTTON with icons

After

Separator

Create a separator by inserting a “-1” item.

Icons

Add an icon to an item by appending a registered symbol name or a plugin ID to the item ID, separated with a “~“.

Frank Willeke

worked with computers since more than 20 years | got hooked on computer graphics back on the AMIGA | started programming at the age of 13 | relesed some successful plugins for cinema 4d | started working for maxon computer gmbh in 2009 | now contributing to cinema 4d as a senior developer

making electronic music since 1993 | playing the electric guitar since 1995 age of 14 | first live gigs in 1997 | playing the bass guitar 2005 | playing keyboards and synths since 2012

experimenting with photography since 2003

5 Comments

  1. hi there, thank you for the valuable information i found on your site. can you explain how i can use custom icons here? do i need to create a separate plugin for every icon i want to add?

    • You can include lib_iconcollection.h, and use RegisterIcon() to register custom icons.
      Use GetIcon() to retrieve it in an IconData object, which will contain a pointer to the bitmap in its bmp member.

  2. one thing fater looking up in the sdk: do i really need to get unique plugin id for every single icon i want to use?

    • Yes, you do. Using unique IDs avoids collisions that might happen if everybody was to just come up with their own.

Leave a Reply to c4d-jack Cancel reply

Your email address will not be published. Required fields are marked *