• Create Polygon Selection Tag

    python
    5
    0 Votes
    5 Posts
    998 Views
    D
    @ferdinand aaaa i understood, thanks for help megaman)
  • Is there a fixed Manager ID like c4d.CONSTANT?

    python
    2
    2
    0 Votes
    2 Posts
    296 Views
    ManuelM
    Hi, Those IDs should not change but there are not guaranties. There are no symbols to define those IDs. You can use the following code to displays all the registered Managers. import c4d from c4d import gui def main(): pluginList = c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_MANAGERINFORMATION, True) for plugin in pluginList: print (plugin, plugin.GetID()) # Execute main() if __name__=='__main__': main() Cheers, Manuel
  • How to Create and Populate a Layer Shader?

    python
    3
    0 Votes
    3 Posts
    2k Views
    indexofrefractionI
    @ferdinand hey ferdinand , thanks for all of this information ! i also noticed that definitions are missing in the python SDK (specifically the BlendModes)
  • Create Gradient Attribute for Nodes Programmatically

    c++ r25
    12
    1
    0 Votes
    12 Posts
    2k Views
    ManuelM
    hi, Sorry for the late reply, but this needed investigation and test from my side and communication between me and the dev. You can create the NodeTemplate that way. I am using the class GradientWorkaround to create the template. NodesLib::BuildNodeFromDescription must be called with false set to not create the dependency wires. NodeTemplate t = NodesLib::CreateLazyTemplate(firstNodeId, [firstNodeId]() -> Result<NodeTemplate> { iferr_scope; maxon::nodes::NodeTemplate templ = maxon::nodes::NodesLib::BuildNodeFromDescription(firstNodeId, CoreNodesNodeSystemClass(), false) iferr_return; templ = GradientWorkaround::CreateInit(templ) iferr_return; return templ; }, CoreNodesNodeSystemClass()) iferr_return; The class itself look like this. We can create a gradient node inside the usernode itself and connect the ports. This is done inside the function InstantiateImpl. class GradientWorkaround : public maxon::Component<GradientWorkaround, maxon::nodes::NodeTemplateInterface> { MAXON_COMPONENT(NORMAL, maxon::nodes::NodeTemplateBaseClass); public: maxon::ResultOk<void> Init(const maxon::nodes::NodeTemplate& templ) { _wrapped = templ; return maxon::OK; } MAXON_METHOD maxon::Result<Bool> SupportsImpl(const maxon::nodes::NodeSystemClass& cls) const { return cls.IsSubclassOf(CoreNodesNodeSystemClass()); } MAXON_METHOD maxon::Result<maxon::nodes::NodeSystem> InstantiateImpl(const maxon::nodes::InstantiationTrace& parent, const maxon::nodes::TemplateArguments& args) const { iferr_scope; maxon::nodes::NodeSystem sys = _wrapped.Instantiate(parent, args) iferr_return; maxon::nodes::MutableRoot root = sys.BeginInstantiationModification(self) iferr_return; // Asset ID : net.maxon.pattern.node.generator.gradient const AssetRepositoryRef& repository = AssetInterface::GetBuiltinRepository(); nodes::NodeTemplate gradient = nodes::NodesLib::LoadTemplate(repository, Id("net.maxon.pattern.node.generator.gradient")) iferr_return; MutableNode gradientNode = root.AddChild(Id("Gradient"), gradient) iferr_return; const maxon::nodes::MutablePort output = root.GetOutputs().FindPort(maxon::Id("testoutput")) iferr_return; const maxon::nodes::MutablePort gradientPort = root.GetInputs().FindPort(maxon::Id("gradient")) iferr_return; const maxon::nodes::MutablePort gradientResult = gradientNode.GetOutputs().FindPort(maxon::Id("result")) iferr_return; const maxon::nodes::MutablePort gradientGradient = gradientNode.GetInputs().FindPort(maxon::Id("gradient")) iferr_return; gradientResult.Connect(output) iferr_return; gradientPort.Connect(gradientGradient) iferr_return; sys = root.EndModification() iferr_return; return sys; } private: maxon::nodes::NodeTemplate _wrapped; }; MAXON_COMPONENT_CLASS_REGISTER(GradientWorkaround, "net.maxonexample.nodes.class.gradientworkaround"); It is just like having a group of nodes and propagated ports. Cheers, Manuel
  • Modul import

    r21 python
    3
    0 Votes
    3 Posts
    697 Views
    W
    Thank you very much!
  • What is my Clipboardowner for a script?

    c++ python
    4
    0 Votes
    4 Posts
    748 Views
    ferdinandF
    Hey @cairyn, yeah, you are right. @m_adam already pointed this out too. I screwed up and overwrote my clipboard when I tried this out. I have edited my initial posting, to not confuse future readers. GetC4DClipboardOwner works fine in regards to the Picture Viewer and Bodypaint, but the argument ownerid of CopyBitmapToClipboard is effectively meaningless in the public API, as it lacks the window handle context to actually cause the ownerid to be stored. The owner id will always be set to 0. And to underline the answer to your major question: It seems very unlikely that you could crash Cinema 4D with writing a made-up owner id into the clipboard (in the case the function would work properly and actually store the id). It is hard to give here absolute answers, as there is a lot of code in our code base. In the context of the clipboard alone, crashing can be excluded, but there could be other parts of Cinema 4D which make assumptions based on the owner id. Which is why I would recommend not using the predefined ones (which is rather theoretical due to said limitations of CopyBitmapToClipboard). Cheers, Ferdinand
  • How to make a Python Plugin...

    python
    5
    1 Votes
    5 Posts
    2k Views
    mikeudinM
    @noseman seems that it's needs to be updated https://github.com/nrosenstein-c4d/c4d-prototype-converter/issues/52
  • Is there a successful example of c4d.gui.SplineCustomGui?

    python
    3
    1
    1 Votes
    3 Posts
    749 Views
    L
    @m_adam Thanks so much! You are a very professional guy!!!
  • Beginner:How to assign A-material to B-cube by python?

    Moved
    5
    1
    0 Votes
    5 Posts
    2k Views
    ManuelM
    hi @cinamatic , You should open a new thread for your question as it is not related to this thread. I found this thread where you will find some useful information about takes and material. If you have any question, please open your own thread explaining what you are trying to achieve and pointing to those different threads. Futur user will find every information to follow the discussion. Cheers, Manuel
  • How to know is DescID is "takeble"?

    python
    3
    0 Votes
    3 Posts
    314 Views
    mikeudinM
    @m_magalhaes Thank you!
  • How can I create a tag which has same outputs as Vertex Map tag?

    python
    4
    0 Votes
    4 Posts
    620 Views
    ferdinandF
    Hello @lingza, well as lined out, you cannot implement a VertexmMapTag which is the same as a normal VertexMapTag but has extra parameters to realize your desired functionality. You can solve this problem with either the pattern I described under point 3 in my last posting, or by implementing a ToolData plugin which simply generates the tag. The solution using a driver tag has the advantage that the user can continuously tweak the output of the vertexmap, while a tool must be picked up again. Actually, I mean that I want to create a tag which contains the vertex weights, then vertex weights are used by ZRemesher after I put the tag into Density Map linkbox. So I don't need a "vertex map" indeed, but I need a tag I describe above. This is unfortunately not true. You will need a vertex map tag, as this parameter, the Density Map parameter, will accept only a VertexMapTag. It will not know what to do with a CustomDataTag . I would recommend having a look at the project file I have posted above, it contains a practical example for the pattern of a tag driving a vertex map. Cheers, Ferdinand
  • Context Problem

    python r21
    7
    0 Votes
    7 Posts
    1k Views
    ferdinandF
    Thanks for the update!
  • Bug on the Commandline

    5
    0 Votes
    5 Posts
    689 Views
    FSSF
    Thanks did report
  • Xcode 13.3 throws framework build errors with R25

    macos c++ r25
    7
    1
    0 Votes
    7 Posts
    1k Views
    fwilleke80F
    Okay, thanks!
  • [Python API] - Foldable Group Bug Still?

    s26 python
    5
    0 Votes
    5 Posts
    785 Views
    C
    @m_magalhaes - All good! Just wanted to make certain that the issue hasn't been fixed yet (since 2018..). In the future I'll write a python class, extending a group that is collapsible using the workaround you mentioned. Thank you for getting back to me and looking into this! Cheers.
  • How can get the visibility of the every point/edge/face?

    python
    3
    0 Votes
    3 Posts
    569 Views
    L
    Thanks so much!!! Your answer makes me understand that PolygonObject.GetPolygonS(self) and PolygonObject.GetPolygonH(self) respectively represent selection states in a list from BaseSelect and visibility states in a list from BaseSelect.
  • Compute distance from a point to a mesh

    4
    1
    0 Votes
    4 Posts
    867 Views
    ferdinandF
    Hi, I am looking for hit point. Then if I understand well, my only way would be to use GeRayCollider on all objects ? A point-something projection will also give you a "hit-point" in some sense. The question is if you want to find the closest point for a point on some geometry (projection), or a point on a geometry for a point and a ray (intersection). GeRayCollider realizes ray-triangle intersection testing for PolygonObject instances. For multiple objects you must initialize multiple collider instances (or reinitialize one instance). But you cannot intersection test a null, a spline, or joint object as shown in your screenshot as they do not contain any triangles. When you are just interested in the closest point in some discrete geometry, you can use ViewportSelect or the more modern maxon API equivalent maxon::DistanceQueryInterface with a slightly different and more abstract purpose. ViewportSelect can also be used to pick the object in a scene which is closest to a point (for the cursor for example) for further testing with other methods. In maxon::GeometryUtilsInterface you will find some basic building blocks for writing something of your own.
  • How to open Script Manager and set what Script it is showing?

    c++
    3
    0 Votes
    3 Posts
    477 Views
    mikeudinM
    @kbar I think much better to create your own Edit Script dialog with blackjack and... Save and Execute Buttons. Use GeDialog.AddMultiLineEditText with a flags DR_MULTILINE_SYNTAXCOLOR and DR_MULTILINE_PYTHON.
  • How to get/set single vector value from USERDATA

    python
    2
    1
    0 Votes
    2 Posts
    297 Views
    ferdinandF
    Hello @mikeudin, Thank you for reaching out to us. Vectors represented by the type c4d.Vector are immutable in Cinema 4D, so one intentionally cannot change one of the components of a vector after it has been instantiated (matrices are not immutable over their vector components on the other hand). To achieve what you want to do, you must write: old = Cube[c4d.ID_USERDATA, 2] Cube[c4d.ID_USERDATA, 2] = c4d.Vector(old.x, old.y, 12) The following would also be possible, but it is not an improvement IMHO: Cube[c4d.ID_USERDATA, 2] = c4d.Vector(Cube[c4d.ID_USERDATA, 2].x, Cube[c4d.ID_USERDATA, 2].y, 12) Cheers, Ferdinand
  • StringToNumber to BaseTime

    python
    6
    0 Votes
    6 Posts
    649 Views
    mikeudinM
    Great, thank you guys!