• create_nodematerial.py from Github not working

    Cinema 4D SDK r25
    5
    0 Votes
    5 Posts
    602 Views
    M
    Hi @bentraje I think there was a small misscommunication what was fixed on Github was the fact that the file does not contain the information of which Cinema 4D version they are working. We are not going to adapt our GitHub script to make it work for R25. If you want code that is going to work for R25, the only solution is to download the python SDK for R25. Cheers, Maxime.
  • 0 Votes
    7 Posts
    1k Views
    M
    Hello @fwilleke80, without further questions or postings, we will consider this topic as solved by Thursday 01/06/2023 and flag it accordingly. Thank you for your understanding, Maxime.
  • Updating my r20 C++ plugins to r21 and up

    Cinema 4D SDK
    9
    0 Votes
    9 Posts
    2k Views
    R
    @kbar, thank SO MUCH. I will look into it.
  • Development versions

    Moved Bugs
    3
    0 Votes
    3 Posts
    885 Views
    C4DSC
    Thanks for the link to the updated page on the dev blog.
  • 0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hey @everyone, Yes, the Script Log can be quite handy, especially in cases like these where no symbols do exist. But one should also keep in mind that integer identifiers can sometimes change, and we do not publish such information then. It is therefore best to use the symbols when they exist, as doing so will avoid that problem. Cheers, Ferdinand
  • Plugin causes Render Region to turn black

    Cinema 4D SDK c++ r25 r23 r21
    3
    0 Votes
    3 Posts
    704 Views
    Danchyg1337D
    Hello! Sorry for not providing any specific info about the problem, it was not really aything to provide in fact. Your last guess about document related stuff is absolutely correct. There is a piece of code responsible for handling a license which was indeed using documents. Thanks!
  • Files and modules organization

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    775 Views
    R
    AWESOME! Thanks @ferdinand!!!
  • Get parameter value at given time.

    Cinema 4D SDK r25 windows c++
    8
    0 Votes
    8 Posts
    2k Views
    D
    Hi @ferdinand and @Cairyn, thanks for the answers. There may be a simpler way to achieve an effect similar to what we want (for example, by caching the world matrix at the time t) but I'm still thinking of alternate ways to be able to access the full mesh information at time t. Caching the full mesh is probably not a good option since we would have to update that cache every time the mesh is changed at any time before t (since this might change the mesh at t). A possible option is to restrict the usability a bit and always evaluate the mesh at time 0, I'm checking if this is something we can do. Feedback loops could be an issue, but it should never happen that (using the example @ferdinand wrote) P relies on T and T also relies on P in this specific plugin. Also, t should always be a time before the current time, although that might not alleviate this particular problem. In any case, I'm going to go ahead and mark this as solved, I think I got all the information I need to find a solution. Thank you both very much for helping me out, Daniel
  • Python writing to desktop

    Moved General Talk python r25
    4
    0 Votes
    4 Posts
    993 Views
    ferdinandF
    Hello @Peek, without any further questions or other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022. Thank you for your understanding, Ferdinand
  • 1 Votes
    10 Posts
    2k Views
    fwilleke80F
    @m_adam said in macOS Monterey - Can't run source processor anymore?: So you have to link for example from /usr/local/bin to a python installation, I personally have Python 3.8.9. Xcode itself ships with a python version you could link to (its in Contents/Developer/usr/bin of the application package). So with that path you can call call sudo ln -s PATH_TO_PYTHON /usr/local/bin/python in terminal. Hi Adam! That is in deed what I tried, creating a symlink that points to Python 3. I didn't use the paths, though, but just linked the word "python" to "python3". I guess that was my mistake. Wouldn't it be easier for Maxon and everybody else, if you just changed the preprocessor call in the projects' PreBuild events to "python3", instead of having to go the symlink way and change things on users' computers (which, I guess, will have side effects when users later decide to install Python 2.7 for some reason)? Cheers, Frank
  • Add Database to the Asset Browser

    Cinema 4D SDK c++ r25 s26 sdk
    2
    0 Votes
    2 Posts
    461 Views
    ferdinandF
    Hey @kbar, thank you for reaching out to us. How to add asset databases and others things are all explained in the Asset API Handbook. Your specific case is dealt with in the example Add User Databases. You can technically also take a route via the Asset Browser preferences in the Cinema 4D Preferences dialog and the GUI gadget showing these database entries, completely ignoring the Asset API, but I would not recommend doing this. Cheers, Ferdinand
  • 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
  • Get the Panel Type Under Cursor?

    Cinema 4D SDK r25 python
    3
    0 Votes
    3 Posts
    359 Views
    ferdinandF
    Hello @bentraje, without any further questions or other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022. Thank you for your understanding, Ferdinand
  • Accessing the World Grid Options in R25+?

    Cinema 4D SDK r25 python
    3
    1
    0 Votes
    3 Posts
    654 Views
    ManuelM
    hi, i confirm this is the right way of doing it. Be aware that the legacy mode has been removed now from the UI but is still accessible from python. If you define the legacy mode, the user will not be able to get back to normal mode. Cheers, Manuel
  • Call plugin by python script with arguments

    Cinema 4D SDK r25 python
    3
    0 Votes
    3 Posts
    597 Views
    kosmos3dK
    @m_magalhaes Thank you very much for your reply. Target was to let user run my plugin in pyton script without open its gui, but set options by some command. Meanwhile I came to solution by implementing ExecuteOptionID method. In this way user first sets options in gui and after can CallCommand anywhere he wants in scripts. Again thank you for your time.
  • 0 Votes
    4 Posts
    628 Views
    M
    Hi this bug was fixed with release 2023.0 of Cinema 4D. Cheers, Maxime.
  • 0 Votes
    7 Posts
    775 Views
    ferdinandF
    Hello @thecomishy, without any further questions and other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022. Thank you for your understanding, Ferdinand
  • Add values for enum data type (node graph)

    Cinema 4D SDK c++ r25
    9
    0 Votes
    9 Posts
    1k Views
    O
    Hello, Thanks for the code. Regarding the second one, I have tried it and also mentioned in the first message that the data does not get added and the array size still stays 0. I had forgotten to put iferr_return and now with your example, I am getting a critical error when trying to append those data. RefMemberType<S> CritStop() { CriticalOutput(static_cast<const typename S::ReferenceClass*>(this)->ToString()); return this->PrivateGetRefMember(); }
  • 0 Votes
    3 Posts
    629 Views
    W
    Hi! One more question, why does it process the command gui.MessageDialog('Hide Object[s]') first, is it pretty much last in the order of commands?? How do I have to install the command so that the program runs according to the order in which it was entered? Thank you very much!
  • How can I make a simple input form for my Python script?

    Moved Cinema 4D SDK
    3
    0 Votes
    3 Posts
    1k Views
    ferdinandF
    Hello @delizade, thank you for reaching out to us. I am a bit confused when you say: I'm new about Python and Cinema 4D scripting. You have more than 20 postings in your account, asking Python questions which I would hardly classify as being new? Nonetheless, windows or 'input forms' are called dialogs in Cinema 4D and represented by the type c4d.gui.GeDialog. There is also another form of GUI definitions called descriptions, but they are tied to classic API nodes, e.g., a Cube object or a Noise shader. Dialogs can be modal and non-modal. In a 'Script [Manager script]' you are bound to modal dialogs, i.e., the user can only interact with the dialog until the dialog has been closed. We also have a series of GeDialog related example scripts on GitHub. I also provided a small example which probably does some things you want to do. Cheers, Ferdinand The result: [image: 1649416639788-simple_dialog.gif] The code: """Simple example for a custom dialog in Cinema 4D. The example will contain a file selection element and a button, as well as a multiline text box. Pressing the button will load the content of a selected file into the text box. Windows are represented by the class c4d.gui.GeDialog in Cinema 4D. There are two ways to define dialogs, programmatically, as shown here, or with the help of something which is called a resource file. Resource files work similarly to other GUI markups, as for example XAML for C# or QT-XML for QT. The dialog raised here is modal, i.e., the user must focus on the dialog. For async, i.e., non-modal dialogs you must write a plugin and cannot use a script (there are ways to wiggle around that restriction, but it is not recommended to do that.) For more information, see the Python and C++ documentation of Cinema 4D on dialogs and dialog ressources. """ import c4d import os class MyDialog(c4d.gui.GeDialog): """Defines a dialog. """ ID_TEXT = 1000 ID_CHECKBOX = 1001 ID_FILENAME = 1002 ID_MULTILINE = 1003 ID_BUTTON = 1004 ID_GROUP = 10000 def CreateLayout(self) -> bool: """Called by Cinema 4D to populate the dialog with gadgets. """ # Set the title of the dialog. self.SetTitle("My Dialog") # Open a container to put other elements into. self.GroupBegin(id=MyDialog.ID_GROUP, flags=c4d.BFH_SCALEFIT, cols=1) self.GroupSpace(spacex=5, spacey=5) # Add a text box and a check box. self.AddEditText(id=MyDialog.ID_TEXT, flags=c4d.BFH_SCALEFIT) self.AddCheckbox(id=MyDialog.ID_CHECKBOX, flags=c4d.BFH_SCALEFIT, initw=0, inith=0, name="Check") # A Filename, i.e., an interface to select a file is a bit more fringe and must be added # over its custom GUI. self.AddCustomGui(id=MyDialog.ID_FILENAME, pluginid=c4d.CUSTOMGUI_FILENAME, name="Path", flags=c4d.BFH_SCALEFIT, minw=0, minh=0, customdata=c4d.BaseContainer()) # Add text box spanning multiple lines (that is set to read only mode). self.AddMultiLineEditText(id=MyDialog.ID_MULTILINE, flags=c4d.BFH_SCALEFIT, inith=50, style=c4d.DR_MULTILINE_READONLY) # Add a button. self.AddButton(id=MyDialog.ID_BUTTON, flags=c4d.BFH_SCALEFIT, name="Run") # Close the lyaout group. self.GroupEnd() return super().CreateLayout() def InitValues(self) -> bool: """Called by Cinema 4D to initialize a layout. """ self.SetString(MyDialog.ID_TEXT, "Hello World!") self.SetBool(MyDialog.ID_CHECKBOX, True) self.SetFilename(MyDialog.ID_FILENAME, "") self.SetString(MyDialog.ID_MULTILINE, "") return super().InitValues() @staticmethod def ReadFile(filename: str) -> str: """Custom static function to read the content of a file into a string. """ if not os.path.exists(filename): raise OSError("Could not access file.") try: with open(filename, mode="rt") as f: return f.read() except Exception as e: raise OSError(f"Could not read access file {filename}.") def Command(self, mid: int, msg: c4d.BaseContainer) -> bool: """Called by Cinema 4D when the user interacts with one of the gadgets in the dialog. """ # The "Run" button has been pressed. if mid == MyDialog.ID_BUTTON: # Read the content of the file if it has been selected and put it into the multiline # text box, otherwise open an error dialog. filename = self.GetFilename(MyDialog.ID_FILENAME) if filename: self.SetString(MyDialog.ID_MULTILINE, MyDialog.ReadFile(filename)) else: c4d.gui.MessageDialog("Please select a file first.") return super().Command(mid, msg) def main(): """Opens the dialog. """ # Instantiate the dialog. dialog = MyDialog() # Open the dialog in modal mode, i.e., it will be the only thing the user can focus on. dialog.Open(dlgtype=c4d.DLG_TYPE_MODAL_RESIZEABLE, defaultw=400, xpos=-2, ypos=-2) if __name__=='__main__': main()