Drawing polygon(s)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/04/2012 at 01:56, xxxxxxxx wrote:
I must admit - I feel a bit embarrased! All that effort and I wasn't even in the right function ha!! Ohwell - I can now draw objects based on the poly info through the Draw() function. No idea what that could be used for but it's there! One for the scrap book!
My plugin's at the stage where I'd like to see what is there before I take it any further, which is why I'm trying to sort this out! I'm kind of excited about it as I think others would get a kick out of this plug. It's just a shame I've not coded before, it'd probably be much more advanced by now!
I'll have to go back to GVO! Thanks Steve! -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/04/2012 at 03:40, xxxxxxxx wrote:
GVO is really nice because you simply create the geometry within that function and then return the final PolygonObject that you created. For example if you wanted to create a single polygon you could do it like this.
PolygonObject *polyObj = PolygonObject::Alloc(4,1); //Allocate a Polygon Object with 4 points and 1 polygon if (!polyObj) return NULL; //Check to make sure the pointer is valid if not return NULL, prevents crashing Vector *padr=NULL; //Declare a Vector array to hold the points CPolygon *vadr=NULL; //Declare an array of CPolygons to hold the polys padr = polyObj->GetPointW(); //assign the points array to your polygon object points array vadr = polyObj->GetPolygonW(); //assign the polygon array to your polygon object's poly array padr[0] = Vector(0,-400,-400); //place your points at your desired locations. padr[1] = Vector(0,-400,400); padr[2] = Vector(0,400,400); padr[3] = Vector(0,400,-400); vadr[0] = CPolygon(0,1,2,3); // Assign the 4 points to a CPolygon return polyObj; //return your final object
Just drop that code in to GVO without anything else and see what it does.
Also if you want to create primitives such as a cube. You would do something like this.
BaseObject* cube = BaseObject::Alloc(Ocube); if(!cube) return NULL; return cube;
basically because PolygonObject is derived from BaseObject, you can return either a BaseObject or a PolygonObject and it will show up through GVO.
Hope that helps.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/04/2012 at 05:02, xxxxxxxx wrote:
Hi Shawn,
thanks for those examples. Just in the last hour or so I've been able to draw some things into the viewport using a similar style to the first example. I've previously drawn a spline in GVO as well which I'm using to get some length data.
Here's the trixy bit I'm losing myself on though. I'm using the CopyPastePlugin to copy polygons over to my plugin object. So the data is there in the tags, I just don't know how to draw it in the viewport. That's where I went to the Draw() function to have a go. So it's just getting the polys to display that's my issue.
I'm guessing from here I could probably just iterate through the tag info like I did in the Draw but inside GVO and maybe that's all I need to do? Or is there a way to just return what's already in memory?
In simple terms, I just want my own polygon plugin that I can edit etc using Cinema's tools, but with my own AM gui elements and sliders etc. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/04/2012 at 05:15, xxxxxxxx wrote:
It's really a matter of using the BaseContainer of the object to access your AM parameters. and using the values your get from there to edit or manipulate the geometry you create in GVO..
so for example since you would be working from GVO, you would get the basecontainer of your object by doing
BaseContainer* bc = op->GetDataInstance();
then if you want to access your attributes from there you would do something like,
Real myParam = bc->GetReal(MY_PARAMETER_NAME);
then let's say you wanted to manipulate the point count of your polygon, you would do,
PolygonObject* obj = PolygonObject::Alloc(myParam, myParam/4);
in that way you could dynamically manipulate the polygonobject you are creating.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/04/2012 at 19:24, xxxxxxxx wrote:
Hi Shawn,
thanks again! I've been able to get gui elements to do things which is great (though only simple things thus far). Customgui elements seem to be a bit more difficult, but I'm fumbling my way through them!
I've started the GVO loop for the polys. But there's a bit of wind outside so I might have to go for a windsurf first and come back to it later!!!
One thing I should ask though - if I'm drawing polys through GVO that are being obtained through the Tpolygon tag data, does my plugin need to be registered as an OBJECT_GENERATOR? Or can I just have OBJECT_POLYGON and OBJECT_POINT there? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/04/2012 at 01:33, xxxxxxxx wrote:
It needs to be OBJECT_GENERATOR because you're generating a new object. You don't need OBJECT_POLYGONOBJECT or OBJECT_POINTOBJECT. In some cases, like the HyperNURBS or the Array object, you would also need OBJECT_INPUT indicating that the generator takes a child object and generates something from it.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/04/2012 at 02:20, xxxxxxxx wrote:
Hm, I just did a few builds with just the GENERATOR but I can't seem to copy polygons over to it. It seems to only let me copy polys to it if I have the POLYOBJECT and POINTOBJECT in there as well. I'm guessing that it won't matter too much if they stay..?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2012 at 03:58, xxxxxxxx wrote:
Hi folks,
my apologies for being such a pest about this.
I've had a think about this GVO function stuff and the GENERATOR registration flag, and I think there's something I need to know a bit more about.
If I don't have the OBJECT_GENERATOR flag in the registration, then GVO won't run/work will it? If that's the case, then how does Cinema's editable polygon meshes work? They must not work through GVO? They don't have the green tick..?
Pest out...
WP. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2012 at 06:46, xxxxxxxx wrote:
If the flag is not set, nothing will be generated (is my understanding). You have to distinguish between a parametric object, which has various parameters you can change like width, height, etc. and an editable polygon object.
The C4D primitives are parametric objects which are generators - so in the Cube object, if you could see its source code, it would have OBJECT_GENERATOR set. But once you make it editable you lose the generator and it's just another poly object. These don't have the OBJECT_GENERATOR flag set.
I've just written a very basic object generator as an example, and it and the accompanying tutorial will be on my site later today. I'll post a link here when done so you can see how it works.
Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2012 at 09:43, xxxxxxxx wrote:
Okay, this new tutorial is up on my site and you can find it at http://www.microbion.co.uk/graphics/c4d/create_plugins6.htm
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/04/2012 at 03:54, xxxxxxxx wrote:
Hi Steve,
firstly - thanks for the tutorial link. I hope you didn't rush that out for my part! There's some very useful and easy-to-understand info there. I'll spend a few days having a play, and to mix 'n' match things into my own experimental object. I'm already seeing parts that I can build on to utilise in my plugins! I suggest other capital N Newbies like myself out there take a look if you're following this thread.
Second - going back to your first post of the latest two has got me wondering. You mention that primitives are parametric objects, which are in turn generator objects. What I'm trying to make however sounds like it's not a generator object, as what I'm trying to achieve is just a plain editable polygon object. If we use the cube as an example, instead of it being a Cinema parametric Ocube with fillet options etc, I want the cube to be just a plain editable polygon object (as if the Ocube has been made editable). That way I can use Cinema's modelling tools on it. I'll see if I can upload a video showing what my dilema is, it might explain it better than what my words can
Thanks for the tutorial link again. Simple examples like these are very useful to turn too!
WP. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/04/2012 at 05:46, xxxxxxxx wrote:
Alrighty, here's a poorly made 1 minute video showing what happens when my plugin is in a scene. The link is one of those annoying download sites but I haven't got anywhere else to put it. For this one off it'll unfortunately have to do. I've never screen-captured or made a video downloadable before (oddly enough). Might have to consider YouTube uploads. Anyway, it should be enough to show visually inside Cinema where my plugin falls short, and may help to decipher what code elements I'm missing/needing.
Polygon Display Video
WP. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/04/2012 at 08:30, xxxxxxxx wrote:
Originally posted by xxxxxxxx
You mention that primitives are parametric objects, which are in turn generator objects. What I'm trying to make however sounds like it's not a generator object, as what I'm trying to achieve is just a plain editable polygon object. If we use the cube as an example, instead of it being a Cinema parametric Ocube with fillet options etc, I want the cube to be just a plain editable polygon object (as if the Ocube has been made editable). That way I can use Cinema's modelling tools on it. I'll see if I can upload a video showing what my dilema is, it might explain it better than what my words can =
Thanks. I can't look at the video right now but I will as soon as I can. From what you say though you are really trying to insert a new polygon object into the scene and then edit it manually in the usual way. In that case a generator object won't do which means an ObjectData plugin is not the right choice. The reason is that an ObjectData returns its object through GetVirtualObjects and you cannot insert a new object into a scene from GVO - it'll crash.
I'm guessing here but from the sound of it what you need is a CommandData plugin. With this you would click the plugin in the Plugins menu, perhaps change any required settings in a dialog, and maybe hit an OK button to insert the object into the scene. Then the plugin is done with and you can edit the object as you normally would.
Steve