public override bool GetDDescription(GeListNode node, DDescriptionParams descparams) { if (!descparams.Desc.LoadDescription("tbase")) { return(false); } VisitProps(delegate(int itemID, string itemName, PropertyInfo pi) { DescID cid = new DescID(new DescLevel(itemID, C4dApi.DTYPE_LONG, 0)); BaseContainer bc = null; if (pi.PropertyType == typeof(int)) { bc = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_LONG); } else if (pi.PropertyType == typeof(string)) { bc = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_STRING); } bc.SetString(C4dApi.DESC_NAME, itemName); descparams.Desc.SetParameter(cid, bc, new DescID(new DescLevel(C4dApi.ID_TAGPROPERTIES))); }); descparams.Flags |= DESCFLAGS_DESC.DESCFLAGS_DESC_LOADED; return(true); // base.GetDDescription(node, descparams); }
/* * public override bool GetDEnabling(GeListNode node, DescID id, GeData t_data,DESCFLAGS_ENABLE flags, BaseContainer itemdesc) * { * int inter; * BaseContainer data = ((BaseObject)node).GetDataInstance(); * switch (id[0].id) * { * case SPLINEOBJECT_SUB: * inter=data.GetInt32(SPLINEOBJECT_INTERPOLATION); * return inter==SPLINEOBJECT_INTERPOLATION_NATURAL || inter==SPLINEOBJECT_INTERPOLATION_UNIFORM; * * case SPLINEOBJECT_ANGLE: * inter = data.GetInt32(SPLINEOBJECT_INTERPOLATION); * return inter==SPLINEOBJECT_INTERPOLATION_ADAPTIVE || inter==SPLINEOBJECT_INTERPOLATION_SUBDIV; * * case SPLINEOBJECT_MAXIMUMLENGTH: * return data.GetInt32(SPLINEOBJECT_INTERPOLATION)==SPLINEOBJECT_INTERPOLATION_SUBDIV; * } * return true; * } */ public override bool GetDDescription(GeListNode node, DDescriptionParams descparams) { // The main part of this code is taken from the "LookAtCamera.cpp" file from the original C4D API samples. // Be aware that the original LookAtCamera is not an object created from the Plugin menu but a // Tag type that can be added to existing objects from the "Objekte" context (right mouse button) menu under // the "Cinema4dsdk Tags" sub menu. // TODO: whatever this might be good for: if (!singleid || cid.IsPartOf(*singleid, NULL)) // important to check for speedup c4d! // { // This will load the main object attribute tabs ("Basis", "Koord", "Objekt") if (!descparams.Desc.LoadDescription("obase")) { return(false); } ////////////////////////////////////////////////////////////////////////////////////// // Create a double value named radius on the "Objekt" tab's main level DescID cid = new DescID(new DescLevel(CIRCLEOBJECT_RAD, C4dApi.DTYPE_LONG, 0)); // The ID of the radius value (CIRCLEOBJECT_RAD) BaseContainer bcRadius = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_REAL); // The type of the radius value (REAL) bcRadius.SetString(C4dApi.DESC_NAME, "Radius"); // The user interface name (Radius) bcRadius.SetInt32(C4dApi.DESC_DEFAULT, 44); // The default value (44, but overridden to 200 in the Init method) // Create the new radius value as a child of the "Objekt" Tab (ID_OBJECTPROPERTIES) if (!descparams.Desc.SetParameter(cid, bcRadius, new DescID(new DescLevel(C4dApi.ID_OBJECTPROPERTIES)))) { return(true); } ///////////////////////////////////////////////////////////////////////////////////// // Create an entirely new Tab (called "Ein schöner Tab") cid = new DescID(new DescLevel(CIRCLEOBJECT_NEWTAB, C4dApi.DTYPE_GROUP, 0)); BaseContainer bcMaingroup = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_GROUP); bcMaingroup.SetString(C4dApi.DESC_NAME, "Ein schöner Tab"); // Create the new Group on the top level (DecLevel(0)) if (!descparams.Desc.SetParameter(cid, bcMaingroup, new DescID(new DescLevel(0)))) { return(true); } ///////////////////////////////////////////////////////////////////////////////////// // Create an new sub group (called "Hübsches Grüppchen") cid = new DescID(new DescLevel(CIRCLEOBJECT_SUBGROUP, C4dApi.DTYPE_GROUP, 0)); BaseContainer bcSubgroup = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_GROUP); bcSubgroup.SetString(C4dApi.DESC_NAME, "Hübsches Grüppchen"); // Create the sub group on the "Ein schöner Tab" main tab (CIRCLEOBJECT_NEWTAB) if (!descparams.Desc.SetParameter(cid, bcSubgroup, new DescID(new DescLevel(CIRCLEOBJECT_NEWTAB)))) { return(true); } ///////////////////////////////////////////////////////////////////////////////////// // Create an new boolean value (as a checkbox) called "Check mich" cid = new DescID(new DescLevel(CIRCLEOBJECT_CHECKME, C4dApi.DTYPE_BOOL, 0)); BaseContainer bcCheckMich = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_BOOL); bcCheckMich.SetString(C4dApi.DESC_NAME, "Check mich"); bcCheckMich.SetBool(C4dApi.DESC_DEFAULT, true); // Create the boolean check box under the previously created sub group (CIRCLEOBJECT_SUBGROUP) if (!descparams.Desc.SetParameter(cid, bcCheckMich, new DescID(new DescLevel(CIRCLEOBJECT_SUBGROUP)))) { return(true); } descparams.Flags |= DESCFLAGS_DESC.DESCFLAGS_DESC_LOADED; return(true); // base.GetDDescription(node, descparams); }
// Different ways how data (The...) is obtained and written. // Example 1: An override gets the baseTag/BaseObject: // // Working example from DoubleCircle: // public override retval OverrideMethod(..., BaseTag tag, ...) // { // BaseContainer di = tag.GetDataInstance(); // Get the data instance from the object // int theIntContents = di.GetInt(GENERAL_TAG_THEINT); // Retrieve the data from the data instance // Question: Would it be sufficient to simply use this.GetDataInstance() public override bool GetDDescription(GeListNode node, DDescriptionParams descparams) { // The main part of this code is taken from the "LookAtCamera.cpp" file from the original C4D API samples. // TODO: whatever this might be good for: if (!singleid || cid.IsPartOf(*singleid, NULL)) // important to check for speedup c4d! // { if (!descparams.Desc.LoadDescription("tbase")) { return(false); } // According to https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_description.html and // with #define DESCID_ROOT DescID(DescLevel(1000491, 0, 0)) as set in lib_description.h // Set the tag's name to something meaningful (other than "Base Tag" or "Basis Tag" DescID nCid = new DescID(new DescLevel(1000491, 0, 0)); // The ID of the radius value (GENERAL_TAG_THEINT) BaseContainer nBc = descparams.Desc.GetParameterI(nCid, null); // The type of the radius value (LONG) string OldName = nBc.GetString(C4dApi.DESC_NAME); nBc.SetString(C4dApi.DESC_NAME, TagName); ////////////////////////////////////////////////////////////////////////////////////// // Create an int value named TheInt on the "Base" tab's main level DescID cid = new DescID(new DescLevel(GENERAL_TAG_THEINT, C4dApi.DTYPE_LONG, 0)); // The ID of the radius value (GENERAL_TAG_THEINT) BaseContainer bc = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_LONG); // The type of the radius value (LONG) bc.SetString(C4dApi.DESC_NAME, "TheInt"); // The user interface name (TheInt) bc.SetInt32(C4dApi.DESC_DEFAULT, 44); // The default value (44, but overridden to 42 in the Init method) if (!descparams.Desc.SetParameter(cid, bc, new DescID(new DescLevel(C4dApi.ID_TAGPROPERTIES)))) { return(true); } ////////////////////////////////////////////////////////////////////////////////////// // Create a string value named TheName on the "Base" tab's main level cid = new DescID(new DescLevel(GENERAL_TAG_THENAME, C4dApi.DTYPE_LONG, 0)); // The ID of the radius value (GENERAL_TAG_THENAME) bc = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_STRING); // The type of the radius value (STRING) bc.SetString(C4dApi.DESC_NAME, "TheString"); // The user interface name (TheName) bc.SetString(C4dApi.DESC_DEFAULT, "Worscht"); // The default value (Worscht, but overridden to Horst in the Init method) if (!descparams.Desc.SetParameter(cid, bc, new DescID(new DescLevel(C4dApi.ID_TAGPROPERTIES)))) { return(true); } /* * ///////////////////////////////////////////////////////////////////////////////////// * // Create an entirely new Tab (called "Ein schöner Tab") * DescID cid = new DescID(new DescLevel(CIRCLEOBJECT_NEWTAB, C4dApi.DTYPE_GROUP, 0)); * BaseContainer bcMaingroup = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_GROUP); * bcMaingroup.SetString(C4dApi.DESC_NAME, "Ein schöner Tab"); * // Create the new Group on the top level (DecLevel(0)) * if (!descparams.Desc.SetParameter(cid, bcMaingroup, new DescID(new DescLevel(0)))) * return true; * * ///////////////////////////////////////////////////////////////////////////////////// * // Create an new sub group (called "Hübsches Grüppchen") * cid = new DescID(new DescLevel(CIRCLEOBJECT_SUBGROUP, C4dApi.DTYPE_GROUP, 0)); * BaseContainer bcSubgroup = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_GROUP); * bcSubgroup.SetString(C4dApi.DESC_NAME, "Hübsches Grüppchen"); * // Create the sub group on the "Ein schöner Tab" main tab (CIRCLEOBJECT_NEWTAB) * if (!descparams.Desc.SetParameter(cid, bcSubgroup, new DescID(new DescLevel(CIRCLEOBJECT_NEWTAB)))) * return true; * * ///////////////////////////////////////////////////////////////////////////////////// * // Create an new boolean value (as a checkbox) called "Check mich" * cid = new DescID(new DescLevel(CIRCLEOBJECT_CHECKME, C4dApi.DTYPE_BOOL, 0)); * BaseContainer bcCheckMich = C4dApi.GetCustomDataTypeDefault(C4dApi.DTYPE_BOOL); * bcCheckMich.SetString(C4dApi.DESC_NAME, "Check mich"); * bcCheckMich.SetBool(C4dApi.DESC_DEFAULT, true); * // Create the boolean check box under the previously created sub group (CIRCLEOBJECT_SUBGROUP) * if (!descparams.Desc.SetParameter(cid, bcCheckMich, new DescID(new DescLevel(CIRCLEOBJECT_SUBGROUP)))) * return true; */ descparams.Flags |= DESCFLAGS_DESC.DESCFLAGS_DESC_LOADED; return(true); // base.GetDDescription(node, descparams); }
//GetDDescription für das erstellen des Interface public override bool GetDDescription(GeListNode node, DDescriptionParams descparams) { C4DInterface C4DInter = new C4DInterface(node, descparams); return(true); }
public virtual bool GetDDescription(GeListNode node, DDescriptionParams descparams) { bool ret = (SwigDerivedClassHasMethod("GetDDescription", swigMethodTypes20) ? C4dApiPINVOKE.TagDataM_GetDDescriptionSwigExplicitTagDataM__SWIG_1(swigCPtr, GeListNode.getCPtr(node), DDescriptionParams.getCPtr(descparams)) : C4dApiPINVOKE.TagDataM_GetDDescription__SWIG_1(swigCPtr, GeListNode.getCPtr(node), DDescriptionParams.getCPtr(descparams))); return(ret); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DDescriptionParams obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public C4DInterface(GeListNode node, DDescriptionParams descparams) : base(false) { this.node = node; this.descparams = descparams; this.generate(); }