Visual Aid
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 11:03, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) :---------
I'm looking got create a visual aid that will show a symmetry plane without actually being an object. For example I want a plane to show up in the center of an object but I don't want it to be something that people can alter. Any ideas as to how to go about this?Thanks,
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 11:25, xxxxxxxx wrote:
I think a single polygon in xray mode with a color would look great but how can I get it to be in the scene without being in the object manager?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 11:43, xxxxxxxx wrote:
Override the ObjectData or TagData Draw() function. Again, you don't call this yourself, it will be called by Cinema 4D to draw into the viewport. Use the supplied BaseDraw* bd to draw what you need into the viewport. Yes, you can even draw polygon objects!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 11:50, xxxxxxxx wrote:
would I use the
> <code>
>
>> `\> void DrawPoly(Vector* vp, Vector* vf, Vector* vn, LONG anz, LONG flags) \>
`
>
> </code>in the class declarations.
then in my code set up a bool to determine if this is on or off?
Could you provide an example of how I would use this properly. Your examples have been a big help so far.
Thanks Robert,
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 19:48, xxxxxxxx wrote:
More specifically I want to draw a polygon that represents the symmetry plane for an object. I want the plane to be drawn when the user clicks a check box named SHOW_PLANE. At this point I would simply like to be able to draw the plane. Later on I would like to orient the plane based on another combo box that contains specific orientations. However, I would really appreciate someone helping me get started by showing me how to draw the polygon using the DrawPoly() Function.
Thanks so much.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 20:06, xxxxxxxx wrote:
I don't have any specific code that would help here (too much to widdle down and mostly ObjectData or ToolData which are different to an extent). You can use DrawPoly(). Or you can use Polygon3D(). For Polygon3D(), you can then use the tag's object global matrix or the BaseDrawHelp's GetMg() to place the plane polygon with respect to the object. For DrawPoly(), you must use one of the methods mentioned to set the coordinate space.
There is a simple example of Polygon3D in the liquidtool.cpp example plugin.
The other thing is that polygons are one sided in the view (I found this out for my plugin Object). Either you must draw two polygons (a second with inverted point order) or use a thin Box3D() instead. Note how you set the dimensions is by multiplying the Matrix v1, v2, v3 (x, y, z) vectors by a real value:
Matrix m;
m.v1 *= 0.1f;
m.v2 *= 2.0f;
m.v3 *= 2.0f;will give you a cube thin along the x-axis.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 22:18, xxxxxxxx wrote:
Thanks Robert, I am toying around with Polygon3D(). One more question to you or anyone else.. How to I determine if the checkbox or Bool named SHOW_PLANE has been checked?
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 22:35, xxxxxxxx wrote:
TagData::Draw() sends your tag as PluginTag* tag. Do this:
if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // draw
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/08/2009 at 22:46, xxxxxxxx wrote:
okay this is the code I have .
> `
\> \> LONG TrueSymmetry::Draw(PluginTag* tag, BaseDocument *doc, BaseContainer &data;, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt,LONG flags) \> { \> \> \> if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // draw \> { \> \> //Vector p[3] = { Vector(0,0,0),Vector(100,0,0),Vector(50,100,0)}; \> //Vector f[3] = { Vector(1,0,0),Vector(1,0,0),Vector(1,0,0)}; \> //bd->Polygon3D(p,f,TRUE); \> GePrint ("It's Checked"); \> } \> else \> { \> GePrint ("Not Checked"); \> } \> return TRUE; \> \> } \> \>
`
At this point I'm just looking for a message to come back and tell me that the box was checked. But nothing is showing up.
Do you see anything wrong?
Thanks,
~Shawn -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 06:21, xxxxxxxx wrote:
Any thoughts about this?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 06:31, xxxxxxxx wrote:
The code looks ok to me. There must be somewhere else an error I guees.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 07:27, xxxxxxxx wrote:
Can you think of anything that would prevent GePrint () from printing to the console? It seems like it's not recognizing that the checkbox was checked.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 07:32, xxxxxxxx wrote:
Without any additional code it is hard to say. Maybe the description resource for the checkbox is wrong.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 07:39, xxxxxxxx wrote:
Here's the reference from the .h file
SHOW_PLANE = 1005,
Here's the reference from the .res file
BOOL SHOW_PLANE {ANIM OFF;}
Here it is from the .str file
SHOW_PLANE "Show Symmetry Plane";
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 07:44, xxxxxxxx wrote:
I can send you more code if you think it would be helpful.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 07:46, xxxxxxxx wrote:
Quote: Originally posted by emberintherain on 24 August 2009
>
> * * *
>
> I can send you more code if you think it would be helpful.
>
> ~Shawn
>
>
> * * *Please do, because the description resource seems to be ok.
Btw. is the Draw() method called at all?
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 07:52, xxxxxxxx wrote:
Here is the code up to this function.
> `
\> \> ///////////////////////////////////////////////////////////// \> // TrueSymmetry \> \> #include "c4d.h" \> #include "c4d_symbols.h" \> #include "ttruesymmetry.h" \> #include "truesymmetry.h" \> \> #include "lib_description.h" \> #include "customgui_priority.h" \> \> const Real DELTA=0.001f; \> \> class TrueSymmetry : public TagData \> { \> Bool blnMessages; \> Bool blnSymmetryActive; \> Bool blnSymmetryDirty; \> Bool blnTest; \> \> \> \> Bool IsSymmetrical(BaseObject* obj , BaseContainer* data); \> Bool InitSymmetryPoints(BaseObject* obj,BaseContainer* data); \> Bool InitSymmetryPolygons(BaseObject* obj,BaseContainer* data); \> Bool IsPartner(const Vector * arrPoints, LONG lngI, LONG lngJ, LONG lngSymPlane); \> Bool OnSymmetryPlane(const Vector * arrPoints, LONG lngI, LONG lngSymPlane); \> Bool PointOnEditableSide(const Vector * arrPoints, LONG lngI, LONG lngSymPlane, LONG lngMirroredSide,bool blnIncNul); \> Bool PolyOnEditableSide(const Vector * arrPoints, const CPolygon * arrPolygons,LONG lngI, LONG lngSymPlane, LONG lngMirroredSide); \> Bool PolygonStillExists(const CPolygon * arrPolygons, LONG lngOldPoly); \> LONG FindLastKnowPolyPartner(const CPolygon * arrPolygons,LONG lngOldPoly); \> LONG FindPolyPartner(const CPolygon * arrPolygons, LONG lngPolygonCount,LONG lngPoly); \> \> Bool ResetPointsOnSymPlane(PolygonObject* objPoly,BaseContainer* data); \> Bool UpdateSymmetryPositions(PolygonObject* objPoly,BaseContainer* data); \> Bool CreateSymmetry(BaseObject* obj ,BaseContainer* data); \> Bool ReInitSymmetry(BaseObject* obj,BaseContainer* data); \> \> Vector GetVirtualPartnerPos( Vector * arrPoints, LONG lngI, LONG lngSymPlane); \> CPolygon GetVirtualPartnerPolygon(CPolygon * arrPolygons, LONG lngPoly); \> \> LONG * arrPartners; \> Vector * arrLastKnownPos; \> CPolygon* arrLastKnownPolygons; \> LONG lngLastKnownPointCount; \> LONG lngLastKnownPolygonCount; \> \> public: \> virtual Bool Init(GeListNode *node); \> virtual void Free(GeListNode *node); \> virtual Bool GetDDescription(GeListNode *node, Description *description,LONG &flags;); \> virtual Bool Message(GeListNode *node, LONG type, void *data); \> virtual LONG Execute(PluginTag* tag, BaseDocument* doc, BaseObject* op, BaseThread* bt, LONG priority, LONG flags); \> virtual Bool GetDEnabling(GeListNode *node, const DescID &id;,GeData &t;_data,LONG flags,const BaseContainer *itemdesc); \> \> //FOR SHOWING SYMMETRY PLANE \> virtual LONG Draw(PluginTag* tag, BaseDocument *doc, BaseContainer &data;, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt,LONG flags); \> \> \> static NodeData *Alloc(void) { return gNew TrueSymmetry; } \> \> }; \> \> //FOR DRAWING THE SYMMETRY PLANE \> ///////////////////////////////////////////////////////////////////////////////////////// \> LONG TrueSymmetry::Draw(PluginTag* tag, BaseDocument *doc, BaseContainer &data;, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt,LONG flags) \> { \> \> \> \> if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // draw \> { \> \> Vector p[4] = { Vector(-100,0,0),Vector(100,0,0),Vector(-100,100,0),Vector(100,100,0)}; \> Vector f[3] = { Vector(1,0,0),Vector(1,0,0),Vector(1,0,0)}; \> bd->Polygon3D(p,f,TRUE); \> GePrint ("It's Checked"); \> } \> else \> { \> GePrint ("Not Checked"); \> } \> return DRAW_HANDLES|DRAW_AXIS; \> \> \> \> \> \> } \> \> \> ///////////////////////////////////////////////////////////////////////////////////////// \> \> \>
`
If this does not show the problem I can email you the whole contents of the .cpp file if you PM me your email.
Thanks so much Matthias for taking the time to help me out.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 07:58, xxxxxxxx wrote:
I just realize that your Draw function has a wrong declaration. For TagData plugins it looks like this
virtual Bool Draw(PluginTag *tag, BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)
Your Draw() method is probably never called.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 08:06, xxxxxxxx wrote:
There it is.... That was the solution.. Thanks alot Matthias. You really help me out here.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2009 at 08:24, xxxxxxxx wrote:
how do I remove the polygon after I have drawn it? I am able to draw a polygon on the symmetry plane now but I want it to go away after they uncheck the bool.
Thanks in advance,
~Shawn