GradientCustomGui..

On 19/03/2014 at 04:30, xxxxxxxx wrote:

I have a GRADIENT gui object thing successfully showing up in my plugin and have managed to initiate it with a set of predefined knots and interpolation set to none etc..

However, i noticed there is setting within the documentation for GradientCustomGui called  GRADIENTPROPERTY_NOEDITCOLOR.
_
_
I assumed this would prevent the user from editing the colour of the existing knots but it doesn`t seem to do anything when added to the GRADIENT in the .res file.

Basically i am looking at ways to allow the user to drag the knots around, but not edit them/delete-them/add-more.

Anybody have any words of wisdom on this?

Itll be my third question posted to this forum in the past week, none of which have been responded to, so im not holding my breath.  Would be nice to get some ideas from more experienced python/c4d devs though..

On 17/04/2014 at 12:40, xxxxxxxx wrote:

I can confirm your problem. Looks like a bug to me. I've informed the developers and will get
confirmation or solution, soon.

Best,
-Niklas

On 29/07/2014 at 11:41, xxxxxxxx wrote:

I have a question on this. How do you apply the settings? I'm using python.

I'm trying to view all the options with the gradient (presets, color). Right now, I just have the gradient bar.

Thanks..
Joe

On 30/07/2014 at 14:50, xxxxxxxx wrote:

Hi,

I actually dropped this because i didn`t need it, but will see if i can dig out the working code for implementing the gradient..

On 30/07/2014 at 15:42, xxxxxxxx wrote:

This is how I applied knots to my gradient:

Res file was something like this:

CONTAINER Omyplugin
{
	NAME Omyplugin;
	INCLUDE Obase;
	
	GROUP ID_OBJECTPROPERTIES
	{	
		GROUP
		{	
			GRADIENT MYPLUGIN_GRAD { }
		}
	}
}

And inside the pyp plugin class i added knots to it etc roughly like this:

  
grad = op[MYPLUGIN_GRAD]
  
grad.SetData(c4d.GRADIENT_MODE, c4d.GRADIENTMODE_COLOR)
grad.SetData(c4d.GRADIENT_MODE, c4d.GRADIENTPROPERTY_NOEDITCOLOR)
grad.SetData(c4d.GRADIENT_INTERPOLATION, c4d.GRADIENT_INTERPOLATION_NONE)
  
numKnots = 4
  
valueIncrement = 1.0/(numKnots)
gradIncrement = 1.0/(numKnots-1)
  
posValue = 0
gradValue = 0
  
for i in xrange(numKnots+1) :
    grad.InsertKnot(col=c4d.Vector(gradValue, gradValue, gradValue), pos=posValue)
    posValue += valueIncrement
    gradValue += gradIncrement
  

All that last bit ( the for loop ) does is adds a knot and sets the position and colour incrementally..  I didn`t really get past the testing stage before i dropped it and had just started with python/c4d so might be a bit rough but pretty sure that code worked at the time..

[edit]

If you use something like Notepad++ to create your code, you can use the Find in Files tool to basically search the c4d directories for hints about IDs and the names of parameters..  Usually searching the resourceandmodulesfolders for a keyword ( for examplegradient ) will dig up some res files that expose what names and IDs you can use..

On 01/08/2014 at 17:32, xxxxxxxx wrote:

Thanks for the reply. I got the SetData part figured out. I'm stuck on the GUI... I tried making a bc. It didn't work out.

I'm new to this. Any help is greatly appreciated. Thanks again!

Gradient GUI( CUSTOMGUI_GRADIENT ) for [Gradient](file:///Users/Joe/Downloads/CINEMA4DR15057PYTHONSDKHTML20131220/help/modules/c4d/CustomDataType/Gradient/index.html#c4d.Gradient) data type. These are the settings:
> GRADIENTPROPERTY_COLOR| bool| Color controls.
> ---|---|---
> GRADIENTPROPERTY_ALPHA| bool| Alpha controls
> GRADIENTPROPERTY_NOEDITCOLOR| bool| No color editing.
>
> _<_t_>_

On 02/08/2014 at 10:42, xxxxxxxx wrote:

^What kind of plugin are you trying to create your gradient gizmo in?

-ScottA

On 21/08/2014 at 11:04, xxxxxxxx wrote:

Scott, a command plugin

On 21/08/2014 at 11:32, xxxxxxxx wrote:

I posted a complete working example of one in the bugs forum.
https://plugincafe.maxon.net/topic/8062/10477_pythongradient-gizmo-wont-maximize

Copy the entire code into a .txt file and then rename the file extension to .pyp when you're done.
Then put it in your plugins folder.

There seems to be a bug in opening the gradient's gizmo's options when it's used in a GeDialog class.
But the example I posted does show how to create the gizmo and adds some knots to it.
That should get you started.

-ScottA

On 26/08/2014 at 08:09, xxxxxxxx wrote:

Maybe also take a look at this thread: How to allocate a gradient in Python?