Thanks Ferdinand. Putting those lines in the projectdefinitions.txt of the solution was the... solution
Best posts made by ECHekman
-
RE: Natvis settings not working?
Latest posts made by ECHekman
-
RE: Get and Set DTYPE_COLORA/DTYPE_VECTOR4D on basecontainer or gedata
DTYPE_VECTOR4 and DTYPE_COLORA are not maxon::data types internally in c4d.
When I get or set them as maxon::data like your example code the GeData changes to a DTYPE_DATA instead
Additionally the existing 4d colorpicker GUI for DTYPE_COLORA will override the maxon::data type and reset it to whatever DTYPE_COLORA is internally. -
RE: Data, DataTypes, Python and GUI
Ok thanks for the help Ferdinand. I will take the road of least resistance and just build on top of float64 vectors
-
RE: Get and Set DTYPE_COLORA/DTYPE_VECTOR4D on basecontainer or gedata
I made this separate thread specifically because of the clear singular question rule i have been told to follow. And this is a different question from the question on custom data types.
-
RE: Get and Set DTYPE_COLORA/DTYPE_VECTOR4D on basecontainer or gedata
This is a different question from:
https://developers.maxon.net/forum/topic/15823/data-datatypes-python-and-gui/6?_=1732092863717If you are referring to the same post i wrote on the backstage forum the suggestion i got there does not work:
const ColorA* color = data.GetCustomDataType<ColorA>();
^^ this does not work
I am asking how to use existing types here. And not new/custom ones
Specifically the DTYPE_COLORA and DTYPE_VECTOR4 and not the regular types DTYPE_COLOR and DTYPE_VECTOR -
Get and Set DTYPE_COLORA/DTYPE_VECTOR4D on basecontainer or gedata
How do I get and set Vector4 and ColorA to the basecontainer/gedata?
I have tried pretty much every possible function and method but I dont seem to be able to use Vec4/Color4.I have managed to get it via unsafe c-style casting:
GeData ge(DTYPE_COLORA, DEFAULTVALUETYPE::DEFAULTVALUE); // Create // Get const CustomDataType* customPtr = ge.GetCustomDataTypeI(DTYPE_COLORA); maxon::ColorA color = *(maxon::ColorA*)customPtr; // Set color = maxon::ColorA(0.5, 0.1, 0.6, 0.7); CustomDataType* customPtrDst = (CustomDataType*)&color; ge.SetCustomDataTypeI(DTYPE_COLORA, *customPtrDst); // Get again to check if it worked const CustomDataType* customPtr2 = ge.GetCustomDataTypeI(DTYPE_COLORA); maxon::ColorA color2 = *(maxon::ColorA*)customPtr2;
But this is basically undefined behavior
-
RE: Data, DataTypes, Python and GUI
Just to clear something up that you wrote: maxon::IntVector32 is not a new template specialization.
And are you sure maxon::IntVector32 is not wrapped in python. It is in the python sdk?
https://developers.maxon.net/docs/py/2025_0_0/modules/maxon_generated/datatypes/vec_col_mat/maxon.IntVector32.html?highlight=intvector32#module-maxon.IntVector32
Or am I missing something here?I have the UI working for the pre-existing maxon::IntVector32 data type. The only problem with this method is that when i animate it, it does not interpolate between multiple keyframes - it just jumps from one to the other.
The problem im trying to solve is that Octane supports these other types (int3 float4 long2 etc). But from what I now learned, and reading your answers, I will either need to chose between:
- Use Custom Data Type - dropping python support
- Use maxon::IntVector32 - dropping keyframe interpolation support
- Cast everything from Vector4d to int vectors and in64 vectors - possible data loss and clunkyness by having to set int values with floats in python
Btw, I recently got backstage access, would it be better to ask these questions there?
-
RE: Data, DataTypes, Python and GUI
I have two problems with using maxon::data route
For instance I have tried to do int32_3 by using maxon::IntVector32. Which is maxon::Vec3<maxon::Int32, 1>;
- However this type does not seem to support interpolating between keyframes
- I cant seem to dynamically create GUI for it
For example: This is how i generate UI for the bool checkbox:
const DescID cid = CreateDescID(DescLevel(guiID, DTYPE_BOOL, 0)); BaseContainer bc = GetCustomDataTypeDefault(DTYPE_BOOL); bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BOOL); bc.SetString(DESC_NAME, name); bc.SetBool(DESC_SCALEH, scaleH); bc.SetBool(DESC_FITH, fitH); bc.SetInt32(DESC_ANIMATE, anim); description->SetParameter(cid, bc, CreateDescID(DescLevel(groupID)));
How would i do the same for maxon data types?
-
Data, DataTypes, Python and GUI
For the project I am working I would like to add new data types to the BaseContainer/GeData for a ShaderData and I'm wondering what the best method for storing, displaying, animating and python interop.
The types I want to add are the following vectors:
Int32_2, Int32_3, Int32_4 Float_2 Float_4 Int64_2
I have tried 3 methods so far:
Method 1: CustomDataType from the sdk example:
I implemented this for Int32_3. This one is the most promising so far as it gives me the greatest level of control over the data and GUI.
Drawbacks:- I am not sure how to set/get this data from python or other plugins?
- Would much prefer to have proper integrated types like maxon::IntVector32
Method 2: maxon::data types (IntVector32)
I tried IntVector32 and Vector4d for Int32_t and Float_4. The data can be set with the SetMaxonData function or SetData on GeData. This method seems to the most integrated, and these types also exist in python?
Drawbacks:- There seems to be no GUI for these types?
- They are not interpolated between keyframes
- I dont know how to properly add new GUI for these types as they do not have DTYPE_ value?
Method 3: DTYPE_VECTOR4 / DTYPE_COLORA / DTYPE_VECTOR2
These have GUI.
Drawbacks:- I cannot set or get the data from the BaseContainer. There is no GetVector4. And im not sure how to extract this data from the GeData.
- There are no int32 or int64 versions of these
Hopefully you can help me out on navigating this issue.
I would much prefer to use official data types, but im happy to implement my own custom data types. However I am not sure how these properly interop with python and other plugins. -
RE: Natvis settings not working?
Thanks Ferdinand. Putting those lines in the projectdefinitions.txt of the solution was the... solution
-
Natvis settings not working?
Im trying to get the natvis files to work, and I added the settings from the documentation.
However this does not seem to do anything. Is there something im missing?AdditionalSolutionFiles=\ ..\..\frameworks\core.framework\project\typeviewer\msvc\maxon.natvis;\ ..\..\frameworks\cinema.framework\project\typeviewer\msvc\c4dapi.natvis
I have gotten it to work by manually adding the natvis to the visual studio document folder, but i would like to automate it.