@ferdinand the example that i based my custom data type from is "DotsCustomDataTypeClass" in file "customdata_customgui.h",and i kept it's functionality "when click on the gui a new square is added", and this part is saving and loading fine as in the provided video, but the color graident shown in the dialog that i change is not saving as you can see as soon as i click of the tag the gradient data resets, sorry if my question is too general but how can i store the "Gradient" data as if they were like any other parameter.
this is my data type on a tag ,compiled with cinema 4d 26
myTag.zip
Posts made by aghiad322
-
RE: how to store/serialize custom data type?
-
how to store/serialize custom data type?
hi there , i'm making a custom data type , and if i'm not mistaken the "MyCustomData::DescribeIO(const maxon::DataSerializeInterface& stream)" along with "Describe()" are responsible for storing/serializing the data , as in my custom type i used the example 'Dots' datatype and added extra data i want to use
maxon::Result<void> iMyCustomData::DescribeIO(const maxon::DataSerializeInterface& stream) { iferr_scope; PrepareDescribe(stream, iMyCustomData); //this is how the example is storing the _points member array Describe("_points", _points, Vector, maxon::DESCRIBEFLAGS::TYPE_ARRAY) iferr_return; Describe("_TimeScaler", _TimeScaler, Float, maxon::DESCRIBEFLAGS::NONE) iferr_return; //here i have member variables of my custom type as pointers (Gradient* MyCustomData::_gradient), it gives me error "missing data type registration" since it's a pointer not tthe data type. Describe("_gradient", _gradient, Gradient*, maxon::DESCRIBEFLAGS::NONE) iferr_return; // and if i tried to add a member of type "Gradient" instead of pointer "Gradient*" i cant instantiate it since it has a private constructor Describe("_gradient", _gradient, Gradient, maxon::DESCRIBEFLAGS::NONE) iferr_return; //Describe("_spline", ("_spline, SplineData*, maxon::DESCRIBEFLAGS::NONE) iferr_return; return maxon::OK; }
so my problem is two parts :
1-how can i serialize c4d-registered custom data types i.e : Gradient, SplineData ....
2- i ccouldn't instantiate a member of type "Gradient" instead of a pointer to Gradient "Gradient *"
i tried dereferencing the allocated gradient but with no avail : Gradient _grad = *(Gradient::Alloc());
sorry if my cpp skills might be the barrier here . -
RE: Expose cpp-registered datatype to python
@ferdinand thanks for the reply, all that i'm trying to do is just to link a SplineData parameter "ANIMATION_CLONER_SPLINE" from the python tag to the customGUI that has a datatype "SPLINEVIS" to visualize the spline in the GeUserArea, here is snippet from ".res" file of the python tag
GROUP{ COLUMNS 1; SPLINE ANIMATION_CLONER_SPLINE { ANIM OFF; SHOWGRID_H; SHOWGRID_V; MINSIZE_H 300; MINSIZE_V 180; EDIT_H; EDIT_V; X_MIN 0; X_MAX 1; Y_MIN -1; Y_MAX 1; X_STEPS 0.01; Y_STEPS 0.01; }; SPLINEVIS ANIMATION_CLONER_SPLVIS { ANIM OFF; }; }
and here is the source code of the custom dataType/Gui
splinevis.zip
i want to change the splinedata of "iSplineVisDataType::_spline" , in the code i provided i just initialized it to demonstrate how im using it, but i want this splineData to be initialized from the python tag.
Or if i can have access to the node "BaseTag" that's hosting the customGui so that i can link it's splineData to the customGui ,that would work. -
Expose cpp-registered datatype to python
hi there so i made a custom gui and custom datatype in cpp and i want to use them in a python tag plugin, so i added it in the tag's ".res" file and it's working (i copied the "Dots CustomDataType & CustomGui Example" and tweaked it to my needs) , but i want to access the data type in python source code of the tag plugin so i can initialize some values on the CustomDataType (that will be vizualized in the GeUserArea of the custom gui) when i initialize the python tag, i read in the documentation that maybe i should use "MAXON_DATATYPE_REGISTER_STRUCT" to expose datatype to python but i didn't find examples implementing it, so basically i want a datatype like the BaseContainer that has (SplineData, Gradient, Float) in it .
-
RE: Effector plugin is only executing in deformation mode
@ferdinand Thanks a lot it worked
-
RE: Effector plugin is only executing in deformation mode
@ferdinand i managed to figure out that it's caused by the "Message()" function , if i uncomment the "Message" definition and declaration the problem comes back again even if i left the Message definition blank, here is the compilable code , c4d 26
Effector.zip -
RE: Effector plugin is only executing in deformation mode
@ferdinand exactly it works fine as a deformer like the second image you provided, i also tested in in 2024.1 it's not working as well, but after some experimenting i ran into weird behaviour , so for the matrix it only works if i put the effector as a child of the matrix and in points deformer mode . and if i added the effector to the effector list of the matrix without being a child of the matrix it wont work, i didn't provide method's definition because they aren't being executed in the first place (when set break point in debug mode it wont be reached), here is a screen recording of it
-
Effector plugin is only executing in deformation mode
hi there , i'm trying to make an effector plugin but the effector implementation only runs in deformer mode , i checked the DropEffectorplugin provided in the sdk, but for some reason "ModifyPoints" is only executing in deformer mode, and also the "InitPoints" is not executing when using the effector with mograph (matrix , cloner ...), here are the functions i'm overriding:
class MyEffector : public EffectorData { virtual Bool InitEffector(GeListNode* node); virtual Bool Message(GeListNode* node, Int32 type, void* t_data); virtual Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags); virtual Bool GetDEnabling(GeListNode* node, const DescID& id, const GeData& t_data, DESCFLAGS_ENABLE flags, const BaseContainer* itemdesc); virtual void InitPoints(BaseObject* op, BaseObject* gen, BaseDocument* doc, EffectorDataStruct* data, MoData* md, BaseThread* thread); void ModifyPoints(BaseObject* op, BaseObject* gen, BaseDocument* doc, EffectorDataStruct* data, MoData* md, BaseThread* thread); static NodeData* Alloc() { return NewObjClear(MyEffector ); }; }
-
RE: how to make parameter stick to position with dynamic parameters hiding?
Thanks a lot @i_mazlov that's exactly what i needed.
however on one of the options for the dropdown i have a single Text input that spans across the whole attribute manager, now after i added the "STATICTEXT { SCALE_V; }" it eats up half the space in the image below
i tried to give it a Description id and treat it as any other parameter and hiding it using "c4d.DESC_HIDE", below is the layout of the whole tabGROUP ADVANCED_TAB { SCALE_V; STRING CUSTOM_TXT_PARAMETER{ ANIM OFF; CUSTOMGUI MULTISTRING; SCALE_V; WORDWRAP; }; GROUP{ COLUMNS 2; LONG ANIMATION_CLONER_FROM { MIN 0; ANIM OFF; }; LONG ANIMATION_CLONER_TO { MIN 0; ANIM OFF; }; LONG ANIMATION_CLONER_SPAN { MIN 1; ANIM OFF; }; GROUP{ COLUMNS 1; SEPARATOR ANIMATION_CLONER_SEPARATOR{ LINE; }; REAL ANIMATION_CLONER_MULTIPLIER { MIN 0.1 ; STEP 0.1 ; ANIM OFF; }; } } GROUP{ COLUMNS 2; REAL SWEEP_PRO_RADIUS { UNIT METER ; STEP 0.1 ; MIN 0.1; ANIM OFF; }; REAL SWEEP_PRO_MULTIPLIER { MIN 0.1; ANIM OFF; }; } STATICTEXT UI_FILLER{SCALE_V;} GROUP{ COLUMNS 2; LONG PRESET { ANIM OFF; CYCLE { ANIMATION_CLONER; SWEEP_PRO; CUSTOM_INPUT; } } } }
but when i try to hide it from the "GetDDescription()" the description "description.GetParameterI(paramId)" is empty ! ,in the "GetDDescription()" in my source code i have the hiding for the other parameters implemented as well but didn't copy them to keep the snippet at minimum lines
def GetDDescription(self, node: c4d.GeListNode, description: c4d.Description, flags: int) -> typing.Union[bool, tuple[bool, int]]: if not description.LoadDescription(node.GetType()): return False, flags paramId: c4d.DescID = c4d.DescID(c4d.DescLevel(c4d.UI_FILLER, c4d.DTYPE_STRING, 0)) evalId: c4d.DescID = description.GetSingleDescID() if (evalId and not paramId.IsPartOf(evalId)): return True, flags paramData: c4d.BaseContainer = description.GetParameterI(paramId) #paramData for the "c4d.UI_FILLER" is empty if paramData is None: return True, flags # parameter ID_HIDE_CONDITION. paramData[c4d.DESC_HIDE] = True if node[c4d.PRESET] == c4d.CUSTOM_INPUT else False return True, flags | c4d.DESCFLAGS_DESC_LOADED
-
how to make parameter stick to position with dynamic parameters hiding?
i am struggling to align the cycle button to the bottom , i tried flag "ALIGN_BOTTOM" on both the parameter and the group containing the parameter in the ".res" file, it didn't work, and i am hiding the above parameters using "GetDDescription()" i want the cycle button to stick to the bottom in the red area even when above parameters changed.
GROUP{ COLUMNS 2; ALIGN_BOTTOM; //causes an error when loading the tag plugin LONG PRESET { ANIM OFF; CYCLE { ANIMATION_CLONER; SWEEP_PRO; CUSTOM_INPUT; } } }
-
RE: Plugin Tag printing randomly to the console
@ferdinand thanks a lot , the problem was in the "message()" function, it didn't return anything.
sorry for the inconvenience of my previous questions. -
Plugin Tag printing randomly to the console
hi there, i'm working on a tag plugin and whenever i add it to the scene the console start printing random letters , in this case it's printing "(null)" but sometimes it prints out completely random letters and symbols
-
RE: Message system isn't working in python effector
@m_adam thanks , hope it's gonna be implemented soon , i got around it , i kept the button on the effector but worked with the "message()" function from a python tag to handle the button interaction.
-
Message system isn't working in python effector
hi there , i'm new to how the message system works , and i want to use a ui button that's on the python effector (the yellow line)
i searched and found out that to achieve that you need to call the message function (the purple line) in this case i'm testing it to print "works"but it's not being run on the python effector if i copied this message function to other object it will print on each refresh , and as far as i know every object automatically calls the message function, what am i doing wrong? -
Instance Object Link is not working
i'm trying to link an object in the instance's reference object but it's not working