If you return to the metadata panel and change the value of Function to math/multiply, you will see that the two values are being multiplied instead. You can now drag the value1 and value2 values around and see the results change in the viewer: the two values are added together. Change the value of Description to Add two numbers.Īn overview of node and port settings in the Metadata panel.Change the value of Function to math/add.For example the namespace ‘math’ contains functions like add, multiply, sin, cos, etc… A namespace can be seen as some kind of container of functions that are related to each other. This means that the node refers to a function named zero and this function resides in a namespace called core. The Function field contains by default the value ‘core/zero’. ![]() With node1 still selected press the Metadata button again.We have to tell our node what to do exactly with those values: You can now drag the value1 and value2 numbers but the viewer still shows 0.0. With the metadata panel open it’s not yet possible to change their values. Note that each time you add a new port, the parameter panel adds a new parameter field widget below the last one. Repeat the previous step to add a port named value2.This creates a new port and brings up an overview of its metadata. In the dialog that appears, enter value1 in the name field and choose float as the type.Press the + button below the left sidebar. ![]() Since we want to add 2 numbers we need 2 ports: What they mean becomes clearer when we have some ports to work with. The items on the left relate to node and port settings. The metadata panel always relates to one specific node, in this case node1. With node1 selected, press the Metadata button on top of the parameter panel. Locating the ‘node’ node inside the node selection dialog. This is the most basic of the available nodes and it’s also the one from which all other nodes are derived. We won’t write our own code yet but we’ll reference some code that already exists inside NodeBox. Creating a new node from existing code.įirst off, let’s build a node that does something really simple like adding two numbers together. Or maybe you just want to experiment with writing a new node from scratch. ![]() Maybe NodeBox is missing some key piece of functionality that you need. Maybe you want to reuse a cool piece of code in NodeBox that you’ve written. However, sometimes there are cases where you wish you could write your own nodes. Once you get the hang of it, it becomes fairly easy to build networks and hide lengthy procedures behind a subnetwork facade. Other code that uses generic Python libraries should be okay. We’re currently rewriting the graphics API to be more performant. Writing your own Nodes This is important:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |