A few Python Generator Spline Primitives - WIP


the whole point of the res templates is bot to rebuild the interfaces for commonly
used parts. you are also not rebuilding obase for each plugin. but the key part is
you don’t have to init these values as it is already done by c4d, should have thought
of that. (you are also not initing obase for your plugin).

so just inculde osplineprimitive on you are fine :smiley:


@ Scott thanks for the example ref

@ LD OK - don’t init the attributes -
but you say if I haven inited obase - how should I do that ?

  1. the brackets are casuing this list/int error it has to be :
op[c4d.somevalue] = c4d.anothervalue
  1. not sure what you mean by but you say if I haven inited obase - how should I do that ?,
    i guess my english was the culprit there :D. when you include Obase you get the two
    standard object tabs with all their functionality. you could write somewhere in the code

to xray your object. it works the same way for splines. just add osplineprimitive and
as long as your your plugin is a spline the interpolation will be set according to your
values in the am. the PRIM_PLANE has to be interpreted in your code of course.



If finally figured the brackets were returning a list

thanks for posting all the same

and another stumbling block…

I hadn’t realised that my res .h files id’s starting with 1000 were clashing with the ids of the included resource. Added another zero to each (but I guess as long as its different from the reserved id it doesn’t matter)

Stumped: If I change the IDs from 1000, 1001, 1002 etc, to anything else
My interface items no longer get values.
If I leave the as they are - any change to the Osplineprimitive; include interface items - then changes my gui items - ahhhhhh

Not sure what you mean by using op[ID_BASEOBJECT_XRAY] = True
But off to see what it does when I add the code. It’s always better to tinker with this stiff and struggle for a bit than have it handed to you, as you tend to learn a fair bit in the struggle (even if it is painful)

thanks again

  1. delete your \xxxx\AppData\Roaming\MAXON\c4dfolder\prefs\symbolcache. should always
    be done when you have altered the res or h files.

  2. also note that some ids will be reserved by osplineprimitive, make sure to use different ids.

  3. it xrays your object, it is just another eample for using desciption elements of an included
    res file.


the only enum ID is the osplinteprimitive .h file are


and 2301

the other interface elements don’t apear to be referenced?


osplineprimitive includes also a resfile - ospline, prodviding the spline interpolation interface,
you have either to hide (disable) ospline or to make sure you don’t use following the ids :

#ifndef _Ospline_H_
#define _Ospline_H_


	SPLINEOBJECT_TYPE					      = 1000,
	SPLINEOBJECT_INTERPOLATION	                      = 1001,
	SPLINEOBJECT_CLOSED					      = 1002,
	SPLINEOBJECT_SUB					      = 1003,
	SPLINEOBJECT_ANGLE					      = 1004,

so, 820 and 1000-1005 are already taken.

edit : cgtalk somehow messed the code up, fixed it


Its starting to fall into place

thanks LD



It looks like most of these posts are down to stumblings on the learning curve

but, this one really has got me

I’ve included the Osplineprimitive

so far everything works as expected
except the PRIM_PLANE init always defaults to zero

I’m not doing anything with the Osplineprimitive except

init section - op[c4d.PRIM_PLANE] = 1 # doesnt work always defaults to zero

build section, read variables: plane = op[c4d.PRIM_PLANE] #works
build section, check variable: print 'PLANE: ', plane #works
build section put them back: op[c4d.PRIM_PLANE] = plane #works

the last item is no different to the init? but it works

bottom line - I just can’t Init that first dropdown for the PRIM_PLANE

neither work in the INIT section
op[c4d.PRIM_PLANE] = 1

		op[c4d.PRIM_PLANE] = c4d.PRIM_PLANE_ZY 
		op[c4d.PRIM_REVERSE] = 1 #True
		op[c4d.SPLINEOBJECT_SUB] = 8 # long?
		op[c4d.SPLINEOBJECT_ANGLE] = u.Rad(4) # float?

all the other inits work?

AND once its running
the console reports (using the print statement in the build section) that if I manually select another plane
the correct value for PRIM_PLANE is set? so why doesn’t the init work when its using the same value and method I use in the build?


you should post this question on plugin cafe. the only thing that comes to my mind is a
corrupted symbolscache causing this.


Will do

I’ve removed the cache a couple of times and no difference

Edit: Problem confirmed by PluginCafe - passed to developers


…and the working version to date.

Any comments on how to do this better, more efficiently appreciated.

Credit to all those who have helped with code examples and explanations. I certainly would not have progressed beyond the Python generator if not for the helpful bunch in this forum and on PluginCafe.

If no one has any objection (from contributors) and no one spots anything that needs fixing or changing (its all editable) then will release for all to use.

Hopefully last WIP attached

PS - As far as I am aware - handles can be created and checked for mouse over - but are not working beyond that. As it is visible but not useable - I’ll probably take out on final.

edit: missed the icon - now added



turned out quite nice, but you should remove the handles. also some limitations on the
input values to avoid unwanted results would be great.



Will do on the handles

Have put some limits already in the uploaded file

  • try drag the tail bigger than main upright - limited to main height
  • then drag the main upright down again - it will reduce the tail height
  • also limited the chamfer in places - if one chafer is Off - any individual chamfer can be as wide as the tail - if both on - its limited to half the width

anything else you can suggest - would like to get this polished


i still can do this

i also think that the massive useage of the realslider gui isn’t very good. i would follow
maxon on this and use simple editboxes. you should also streamline the interface, following
the gui standrads maxon has set.

  1. the plane interface isn’t sepereated by a seperator
  2. bools are moved to the bottom of the interface
  3. don’t use sliders
  4. don’t see a reason why the tail has to be smaller than the head
  5. don’t see a reason why head can not be negative.
  6. you shouldn’t be able to set an arms length to negative and smaller than the chamfer
    radius. will produce this :
  7. create an icon which fits more into c4ds general icon layout

check the helix spline as an example.

you could also improve the naming of the elements, as the current isn’t very intuitive for
me. also j-spline is quite misleading for me, as it can produce u-splines as well. corner-
spline would be bettter imho.


Useful feedback

mmm - the first one has been a problem all along - not sure how to solve
apart from adjusting the tail width if tail goes negative

The tail is limited as the whole object flips if outlined and Tail > J height

will take other points onboard



I think I can fix most of the issues

But, where are the Maxon GUI style guidelines?



there are none written down, just observe c4ds tools and objects. helix spline primitive
would be a good subject for you. however, even maxon is a bit inconsequent when it
comes to columns, sometimes they use two columns for the value / subdivision style,
sometimes not.

  1. The plane interface needs separation , otherwise it looks like its connected with the item above, which its not. If there were no other separators - as per most of the C4D spline primitives, I could see the logic.
  2. Bools separated from everything else doesn’t make sense? The need to be next to the controls surely?
  3. Taken out sliders (why are these GUI elements there if we are not supposed to use them?)
  4. Having the tail get bigger than the head means the objects flips as the tail becomes the largest part - yes it could be fixed but it doesn’t create anything that rotating the object 180 cannot achieve, and means more code.
  5. Having the head negative again, doesnt create anything that rotating the object 180 cannot achieve, and it means writing more code.
    6 & 7 Fixed

Any comments from contributors re free release? I’ll put it with the original Python generator for comparison.


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.