Basic PyGenerator plugin Please
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2011 at 16:35, xxxxxxxx wrote:
I need an example how to do the exact same thing as the
default Python Generator Object but as an ObjectGenerator PyPlugin.
That is, return a default Cube.
No extra settings or anything.I've copied the "DoubleCircle" py example as I want to
make a spline generator. Have my own ID for it.
I have it all working in a PythonGenerator
but can't for the life of me get it to return anything in a Plugin object Generator!So to get the basics of Object Generators (I've only been doing
Tag plugins till now) it would be of great help to see
a working example of returning a default object.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2011 at 18:51, xxxxxxxx wrote:
Here's a very simple example of an object plugin that generates a rectangle spline with a couple of size controls:https://sites.google.com/site/scottayersmedia/PythonSplineObject.zip
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2011 at 19:51, xxxxxxxx wrote:
Thanks Scott. I'll look into it a bit more
but I'm confused as your setup generates
a child object.
What I need is the Generator to be the intended result itself,
just as the PythonGenerator.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2011 at 20:09, xxxxxxxx wrote:
I'm not sure if this is what you want or not.
But if you remove or comment out this line: ret.InsertUnder(op)
Then the only object that will be created will be the generator object. Like if you used the Python Generator object.I'm not very experienced with object plugins myself.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2011 at 22:09, xxxxxxxx wrote:
The Python Generator object evaluates the code within c4d.plugins.ObjectData.GetVirtualObjects().
You just have to copy paste your code from the Python Generator to your Python Plugin, as if the GetVirtualObjects() Method was your main function.import c4d from c4d.plugins import ObjectData class MyObjectPlugin(ObjectData) : def GetVirtualObjects(self, op, hh) : " Overrides c4d.plugins.ObjectData.GetVirtualObjects() " # paste your code here for example: return c4d.BaseObject(c4d.Ocube)
Cheers,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2011 at 17:12, xxxxxxxx wrote:
Thanks,
Hm.
I can use GetVirtualObjects() and I now get a visible object.
If I create a BaseObject like Ocube it is recognized by ie a Cloner.
How ever if a create a Osplineobject or SplineObject (and set
it's points where I want them) I also get a visible object, -but-
it is not seen as a spline by a Cloner or an AlignToSpline Tag.
It -is- recognized by a SweepNurb.
Running MakeEditable or CurrentStateToObject I do get the correct
spline in return.ok, so looking at the Py_DoubleCircle example it does not
use GetVirtualObjects() but GetContour() instead.
And it is seen by Cloner etc.
But what is it in that example that makes that happen?When I use my "functional" spline code I don't get any errors
but no spline is generated. Doing MakeEditable I get
a Null Object in return.What is it in GetContour that is important?
My plugin is based on the Py example and all I do
is create a simple spline with no settings at all,
no Draw, Handles or anything. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2011 at 17:18, xxxxxxxx wrote:
Oh, the reason why I'm trying the Object Plugin way
is that the setup is running using the Python Generator Object
and it has the same issue that a returned spline is not seen
by Cloners, AlignToSpline etc. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2011 at 10:20, xxxxxxxx wrote:
is it?
put in PyGenerator and make editableimport c4d #Welcome to the world of Python def main() : spl = c4d.SplineObject(2,0) spl.SetPoint(0,c4d.Vector(0.0)) spl.SetPoint(1,c4d.Vector(0.0,1000.0,0.0,)) spl.Message(c4d.MSG_UPDATE) return spl
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2011 at 14:52, xxxxxxxx wrote:
Hi Ilya.
I need to have the PyGenerator seen as a spline by a Cloner etc.
-without- making it editable the same way as a cube generated
in the PyGenerator is seen by a Cloner.The PyDoubleCircle example manage that and I can't figure out why.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/10/2011 at 16:22, xxxxxxxx wrote:
In C++. We need to use the " virtual SplineObject* GetContour() " method. As part of the class.
If it's left out. The spline does not even draw.
This does not seem to be the case in python.Per the C++ SDK. GetContour() is used for generating splines.
AFAIK. It's not needed to generate other types of objects.This is just a wild guess.
But it looks like the way the python version is ported from C++ is allowing us to generate splines in python without using GetContour(). Which might be a bad practice.
My guess is that this is not the "proper" way to build a spline generator. And will cause things like the Align-to-Spline tag not to work with it.This is just a wild guess based on my experience with it in C++.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2011 at 02:56, xxxxxxxx wrote:
Hello Lennart
I try to put spl-pygen object, clonner draw it normally, without returning of base object(make editable) as described.At more complex code, pyGen was failed at drawing of object if it is in clonner/or mo-object.
Also try Nux95's DrawApi helpers, thanks a'lot to Niklas!
Niklas, can you make sample with DrawLines if it-s possible, i some ago apply at sample project...but lost it.... -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2011 at 09:43, xxxxxxxx wrote:
Maybe I need to be even more clear
Make a PyGenerator generating a spline.
ie return c4d.BaseObject(c4d.Osplinecircle)Then put the PyGenerator in a Cloner as Object source
does not allow me to clone stuff on the PyGenerator
as the Cloner does not see the PyGenerator as a spline.Put the PyDoubleCircle in the Cloner instead as Object source
and I can clone.The issue really comes down to that I can't see what in
the PyDoubleCircle example that makes it work.
(Other than it's using GetContour() ) -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2011 at 10:22, xxxxxxxx wrote:
seems it's not possible, if only add optionally new functions as presenting of PyGen like splineObj...like checkbox with GetContour dependecy
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/10/2011 at 18:42, xxxxxxxx wrote:
Update. I've actually got it working (as a plugin), stripping down the
PyDoubleCircle example bit by bit..
I'll post the barebone working code this week with a new question
as it became a new issue how handle updating it.
My guess it's about GetCache(), Get/SetDirty(), all new
territory for me.Thanks till later!
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/10/2011 at 07:59, xxxxxxxx wrote:
Hello
There is interesting and unstable(need to glue to matrix of obj) test -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/10/2011 at 09:04, xxxxxxxx wrote:
That's a good twist, adding the Cloner link via the script, nice.
Don't need to do the CSTO either really.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/10/2011 at 09:18, xxxxxxxx wrote:
Don't need to do the CSTO either really.
You're right! Thanks a'lot.
I played with M.Zabiegly's pointcloud's sample(big thanks to his xpresso tutorials), trying to get cache from procedural objects(Lennart, i make same 3d fashion sample as you did) and try to apply same CSTO.
For CSTO and additional py-snippets i want to say Thanks to Sebastien, Niklas, Scott...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/10/2011 at 08:40, xxxxxxxx wrote:
I have question is this function replicate GetContour() - BaseObject.GetRealSpline ?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/10/2011 at 11:14, xxxxxxxx wrote:
Not really I'm afraid.
But I've come a long way linking Cloners, MoSplines etc
from within the plugin as per the example you show earlier.
This way basically any virtual object within the generator
can be picked. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/11/2011 at 09:20, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Also try Nux95's DrawApi helpers, thanks a'lot to Niklas!
Niklas, can you make sample with DrawLines if it-s possible, i some ago apply at sample project...but lost it....I'm sorry, haven't ever read this post before.
Can you explain more what 'ya need ?PS: My latest achievement in the DrawApi module. (Animations)
http://www.screenr.com/mQLs