Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. WTools3D
    3. Posts
    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups

    Posts made by WTools3D

    RE: ObjectData::GetDimension() ignored?

    Now it's more clear.
    I assumed behavior of the framing commands on wrong premise.

    Maybe you could add some further explanation in the documentation where the overwritten bounding data is used in the cinema.

    Thank you for your suggestions how to resolve this on my side!

    Regards,
    Viktor

    posted in Cinema 4D SDK •
    RE: ObjectData::GetDimension() ignored?

    Hi Ferdinand.
    I'll explain each issue separately:

    First. try to multiply *rad value by 10, in your example.
    case 1: *rad = Vector(rady, rado + radx, rado + radx) *10; break;

    Then when you try to select this object and use 'Frame Selected Elements' function in the viewport.
    It will frame to the size of actual geometry not to the overridden size multiplied by 10.
    So it ignores the override.

    posted in Cinema 4D SDK •
    RE: Animatable control not working (DESC_ANIMATE_ON)

    Yes, this condition was the issue!
    It was a copy-paste part from some C4D example without deeper thinking.
    Now it works as expected also with animations!

    Regarding the value as a class parameter, it is of course handled for read-write copy.
    Our plugins are ported into more applications not just for C4D. Using its own data management so that's why the Get-Set callback are used.

    Thank you for your quick and useful help, as usual 🙂

    Regards,
    Viktor

    posted in Cinema 4D SDK •
    ObjectData::GetDimension() ignored?

    Hi guys.
    ObjectData::GetDimension() callback is ignored in most of the cases.

    1. When ObjectData::GetVirtualObjects() callback returns null object, in this case GetDimension() is completely ignored. It is the case when it would be most useful!

    2. When ObjectData::GetVirtualObjects() callback returns valid PolygonObject, in this case GetDimension() is again ignored because the plugin is calculating dimension from returned PolygonObject.

    Is there some additional settings which needs to be set to force plugin to use GetDimension()?

    Thanks!

    posted in Cinema 4D SDK •
    Animatable control not working (DESC_ANIMATE_ON)

    Hi.
    I am struggling to update existing plugins to be animatable.
    Plugins are geometry generator derived from ObjectData.
    Panel is generated with GetDDescription() callback.
    And internal data are handled via GetDParameter() and SetDParameter() callbacks.

    Below is simplified example.
    I need to animate the internal parameter (Float m_value).
    It doesn't work when set to DESC_ANIMATE_ON.
    Animation of Value parameter appears in panel with the animate diamond icon, but it doesn't switch to red state when clicking on it.

    1d6b4d01-6e6a-4d0a-b220-b7d0ab2ec025-image.png

    #define CTL_VAL_ID	1001
    //===========================================================================================================
    // class
    //===========================================================================================================
    class TestData : public ObjectData
    {
    	INSTANCEOF(TestData, ObjectData);		// Cinema4D hierarchy	
    public:
    	// create
    	static NodeData* Create() { return NewObjClear(TestData); }
    
    	//----------------------------------------------------------
    	// DATA
    	//----------------------------------------------------------
    	Float	m_value = 15;
    
    	//----------------------------------------------------------	
    	// panel
    	//----------------------------------------------------------
    	Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags)
    	{
    		// validation
    		if (node == nullptr || description == nullptr)			return false;
    		// load the description for Obase
    		if (description->LoadDescription(Obase) == false)		return false;
    
    		// load all parameters
    		if (description->GetSingleDescID() == nullptr)
    		{
    			//
    			const DescID cid = DescLevel(CTL_VAL_ID, DTYPE_REAL, 0);
    			//---------------------------------------------------------------------
    			BaseContainer bc = GetCustomDataTypeDefault(DTYPE_REAL);
    			//---------------------------------------------
    			bc.SetInt32(DESC_UNIT, e_CtlUnitType::flt);
    			bc.SetString(DESC_NAME, String("Value: "));
    			bc.SetInt32(DESC_SCALEH, 1);
    			//---------------------------------------------		
    			// animate ON
    			bc.SetInt32(DESC_ANIMATE, DESC_ANIMATE_ON);
    			//---------------------------------------------
    			// set parameter
    			description->SetParameter(cid, bc, DescLevel(ID_OBJECTPROPERTIES));
    		}
    
    		// controls loaded into tool description
    		flags |= DESCFLAGS_DESC::LOADED;
    
    
    		// base	class
    		return SUPER::GetDDescription(node, description, flags);
    	}
    	//----------------------------------------------------------
    	Bool GetDParameter(GeListNode* node, const DescID& id, GeData& t_data, DESCFLAGS_GET& flags) override
    	{
    		// shortcuts		
    		BaseContainer* bc = static_cast<BaseObject*>(node)->GetDataInstance();
    
    		//-----------------------------------------
    		// parameter value to bc (get from bc)		
    		if (CTL_VAL_ID == id[0].id)
    		{
    			bc->SetFloat(CTL_VAL_ID, m_value);
    			return true;
    		}
    		//---------------------
    		// base
    		return SUPER::GetDParameter(node, id, t_data, flags);
    	}
    	//----------------------------------------------------------
    	Bool SetDParameter(GeListNode* node, const DescID& id, const GeData& t_data, DESCFLAGS_SET& flags) override
    	{
    		//-----------------------------------------
    		// parameter value from bc (set in bc)
    		C4dControls controls(t_data);
    		if (CTL_VAL_ID == id[0].id)
    		{
    			m_value	= t_data.GetFloat();
    			return true;
    		}
    		//-----------------------------------------
    		// base
    		return SUPER::SetDParameter(node, id, t_data, flags);
    	}
    };
    
    RegisterObjectPlugin(1060016, String("#$44 Test Nurbs"), OBJECT_GENERATOR | OBJECT_USECACHECOLOR, TestData::Create, maxon::String(""), nullptr, 0);
    
    posted in Cinema 4D SDK •
    RE: R25 - DrawPoint2D,DrawHandle2D not drawing pixel size anymore

    I just found out it's a GPU issue.
    Pixels are not visible on Intel UHD 630.
    Mac M1 well.
    GeForce works on 4K monitor but not on HD monitor.

    So it is a bug.

    posted in Cinema 4D SDK •
    RE: Spline generator drawing and selection override.

    I guess it is probably not doable with current api.
    I am marking this as solved!

    I sacrifice the possibility that the generator can be changed to a Spline object with the Cinema Make Editable command.
    If the call to NurbsData::GetContour() returns null, no highlighting or geometry will be drawn.
    So I can draw everything without any collisions.

    Only downside of this is that additional command for conversion of this object to a spline object is needed.

    Thanks.

    posted in Cinema 4D SDK •
    R25 - DrawPoint2D,DrawHandle2D not drawing pixel size anymore

    Hi,
    I am not able to draw a pixel in R25 anymore.
    DrawPoint2D and DrawHandle2D() with DRAWHANDLE::MINI option doesn't work anymore.
    R21,S22,R23,S24 works fine.

    Is anything changed in R25 drawing api?

    I hope it is just an error on my side. But it works in all other versions.
    Problem is just in R25.

    Anybody else having a problem with this?

    Thanks!
    Viktor

    posted in Cinema 4D SDK •
    RE: Spline generator drawing and selection override.

    @m_adam said in Spline generator drawing and selection override.:

    What do you mean by being part of the generator? If they are children of your generator, and your generator is registered with the OBJECT_INPUT then the cache should be automatically touched and therefor not shown.

    No children.
    I just want to disable drawing of Spline Object by cinema. Spline object which is returned in GetContour() callback.
    But only for the time it is being generated. Until you call Make Editable command which destroy generator and keep just Spline object.

    So I want to override drawing of that generated Spline object. And draw selected and not selected parts with differnt colors.
    Avoid to overdrawing selected parts over existing draw made by cinema which makes "glitches".

    So in short just need to disable drawing spline object and highlighting.

    Sorry for confusion.
    Thanks!
    V

    posted in Cinema 4D SDK •
    RE: Spline generator drawing and selection override.

    @m_adam said in Spline generator drawing and selection override.:

    Just return true in your draw method during the HIGHLIGHT_PASS, this way nothing will be drawn.

    I have tested all returns of DRAWRESULT from NurbsData::Draw() callback. (R21-R25)

    In R21 the spline is always white, in R25 it is orange.
    No matter if I exit with return SUPER::Draw(op, type, bd, bh) or return any DRAWRESULT result.

    V.

    posted in Cinema 4D SDK •
    RE: Spline generator drawing and selection override.

    @m_adam

    I'll try to explain briefly the plugin first and the glitches.

    Plugin NurbsData (derived from ObjectData) is complete NURBS generator.
    NURBS data are stored in base container as a single data parameter.
    Data contains geometry,topology, UV and selection.
    Selection depends on Cinema mode (points,<segments-edges>, <curves-surfaces- polygons>)

    Object has an internal switch for curves or surfaces.
    When works in curves mode the NurbsData::GetContour() returns the Spline object.
    When works in surfaces mode the NurbsData::GetVirtualObjects() returns the Polygon object.

    It is all implemented and works, only makes drawing glitches depends on Cinema version.

    Problematic is when drawing NURBS selection. (specially curve segments), it is not matching the highlighted curves, It is just 1-2 pixels random difference depend on viewport settings.
    But it is a huge problem on large scale floor-plans with thousands of lines, because the visibility is messy then.

    If still not clear, I can show it. (call with a sceen-share)

    Thanks!
    Viktor

    posted in Cinema 4D SDK •
    Spline generator drawing and selection override.

    I have implemented NURBS object as a spline and polygon generator.
    I am trying to have the same visual look from R21 to R25.
    There are several visual glitches and problems specially when drawing additional geometry.
    So the best way would be to override the drawing of everything.

    I would need to completely disable drawing of spline geometry(cache) and highlighting of selected object.

    1. Is there a way to disable drawing spline cache object while it is part of generator object?
      But it have to be visible after it is converted to spline object.

    2. Is there a way how to completely disable object highlighting per specified plugin?
      In R21 it was optional :
      6b686d34-7db3-4f35-aa79-49123c1f9421-image.png

    I am not able to find this in R25 and not even in SDK.

    I have already missed the deadline because of struggling with this.
    Any advice would help.
    thanks!

    posted in Cinema 4D SDK •
    RE: ToolData::GetDDescription() redundant call, why?

    Thank you guys for quick reply.
    But I was probably not clear enough with the question.

    I do understated the concept of setting panel description via GetDDescription() callback.
    I already did the checks for whether it is request for full description of just single id.
    As it is listed in the example below (it is member function of C4dControls class from previous snippet 😞

    void C4dControls::AddIntChoice(int id, int gid, const String& name, const BaseContainer& items)
    {	
    	const DescID cid = DescLevel(id, DTYPE_LONG, 0);
    	//---------------------------------------------------------------------
    	if (ex_descr && (!ex_singleid || cid.IsPartOf(*ex_singleid, nullptr)) )
    	{
    		BaseContainer bc = GetCustomDataTypeDefault(DTYPE_LONG);
    		//---------------------------------------------
    		bc.SetInt32	(DESC_CUSTOMGUI, ID_QUICKTABSRADIO_GADGET);
    		bc.SetString(DESC_NAME, name);
    		bc.SetInt32	(DESC_SCALEH, 1);
    		// animate OFF
    		bc.SetInt32	(DESC_ANIMATE, DESC_ANIMATE_OFF);
    		//---------------------------------------------
    		bc.SetContainer(DESC_CYCLE, items);
    		//---------------------------------------------
    		ex_descr->SetParameter(cid, bc, DescLevel(gid));
    	}	
    }
    

    But it is still calling to rewrite each control description several times after any event in GUI.
    What confuses me the most, is that each series of calls is with the different pointer to description (Description* description)
    For example there are five different pointers to description when ToolData::GetDDescription() is executed for the same event. (after mouse click into attribute manager)

    Is this the way how it really works?
    There are more versions of description for the same panel, and all of them have to be initialized repeatedly after each event?

    Thanks!
    Viktor

    posted in Cinema 4D SDK •
    ToolData::GetDDescription() redundant call, why?

    Hi,
    I have a questions about behavior of ToolData class member function GetDDescription().
    I can't find any example and I don't understand why Cinema is calling this function several times after each user event in GUI.

    Below is the code of overridden member function.
    I am filling description with controls every time now. (function LoadControls())

    Bool LwCadToolData::GetDDescription	(BaseDocument* doc, BaseContainer& data, Description* description, DESCFLAGS_DESC& flags)
    {
    	// validation
    	if (description == nullptr)		return false;
    		
    	ApplicationOutput("GetDDescription flags: @", flags);
    
    	// initialize controls	
    	LoadControls(C4dControls(description, description->GetSingleDescID()));
    
    	// controls loaded into tool description
    	flags |= DESCFLAGS_DESC::LOADED;
    
    	//---------------------
    	// base
    	return SUPER::GetDDescription(doc, data, description, flags);
    }
    

    Problem is that after each mouse event , this function is executed several times, always a different description pointer.
    Below is the list of calls after a single click.

    GetDDescription flags: NONE
    GetDDescription flags: NONE
    GetDDescription flags: NONE
    GetDDescription flags: NONE
    GetDDescription flags: RESOLVEMULTIPLEDATA|MAPTAGS
    GetDDescription flags: NONE

    Could you please give me a hint, how to optimize this properly?
    Optimal way is to fill description only once.
    Is it necessary fill it every time the GetDDescription() function is executed?

    Thanks!

    posted in Cinema 4D SDK •
    RE: BaseDraw::DrawHUDText() - setting color ?

    Works like a charm!
    It's much more flexible than I hoped;)

    Thanks a lot!

    posted in Cinema 4D SDK •
    BaseDraw::DrawHUDText() - setting color ?

    I am trying to draw colored text with BaseDraw::DrawHUDText().
    Using BaseDraw::SetPen() before, has no effect.

    Is there any way to draw text with custom color using DrawHUDText funcrtion ?

    Thanks!

    posted in Cinema 4D SDK •
    RE: Creating NGONs low level with NgonBase::BuildNgon() ?

    @m_magalhaes
    Thanks Manuel!

    When I fill-in only Inner edges in NgonBase::BuildNgon, then it surprisingly works 😉
    I don't know why I tested all combinations except this one 🙂
    There are still some minor glitches, some inner edges are randomly not hidden, but ngons created are valid for all the cases I have tested.
    Random glitches are easily fixable with forcing all inner edges to be hidden.

    I will test it more, but this seems to be reliable for now.
    NGONS import - read outer edges directly from Pgon::*m_Edge array
    NGONS export - with NgonBase::BuildNgon(), filling Inner edges only, and force hide inner edges on quads.

    Thanks a lot Manuel,
    Your help has been very valuable to me.

    Regards,
    Viktor.

    posted in Cinema 4D SDK •
    RE: Creating NGONs low level with NgonBase::BuildNgon() ?

    @m_magalhaes
    I'll wait for what you get from your team.
    Thanks Manuel!

    posted in Cinema 4D SDK •
    RE: Creating NGONs low level with NgonBase::BuildNgon() ?

    Thanks I'll wait of course.
    Viktor

    posted in Cinema 4D SDK •
    RE: Creating NGONs low level with NgonBase::BuildNgon() ?

    Hey guys.
    I spent almost two weeks to get stuck with this.
    I would really appreciate any reply to this problem.

    Just need an answer to these questions:

    1. Is NgonBase::BuildNgon() function intended to use for creating ngons with holes from the triangles ?
    2. If yes, are there any restrictions or rules for triangles provided ?

    Please anybody, can you give me a hint?

    posted in Cinema 4D SDK •