Jump to content

How To Get The Name Of Created Operator?


hoknamahn

Recommended Posts

I want to add a new operator in this way... Say opadd -n null

After that I have to change some properties of that operator. Is it necessarily to have an opname to change it's properties? If so how to get the name?

I don't wan to set the operator's name manually.

Other problem is the creation of network box by script. Seems that is impossible. Am I right?

Link to comment
Share on other sites

I always use the supplied script uniquename.cmd to set up a variable that builds the object name I want to add, then add it.

By predefining the name, you can do subsequent operations to that node easily

See the script in $HH/scripts/uniquename.cmd.

# Add an operator using uniquename.cmd

opcf /obj
set opbasename = "model"

uniquename.cmd $opbasename "varname"

opadd geo $opbasename_$varname

opset -d off $opbasename_$varname

Link to comment
Share on other sites

One limitation to keep in mind is that it's quite possible a node to rename itself using their event scripts like "On Created" or "On Input Changed" and currently there is no way to access a node by a unique identifier which remains constant throughout its existence.

Recently I had an issue where a certain node renames itself based on who it's wired into so this would fail:

set name = `execute("opadd -v mynodetype")`
opwire $name -0 someothernode
# oops, the node has renamed itself due to its own OnInputChanged script 
#  and I no longer know what it's called. eek!

Link to comment
Share on other sites

Arhhh... opscript is confused me :) I create a network box and then do opscript and don't see anything about network boxes. So I've decided that HScript can't work with network boxes. :ph34r: I understand that network boxes are not objects but... That behaviour looks strange. :rolleyes:

Link to comment
Share on other sites

Arhhh... opscript is confused me  :)  I  create a network box and then do opscript and don't see anything about network boxes. So I've decided that HScript can't work with network boxes.  :ph34r: I understand that network boxes are not objects but... That behaviour looks strange.  :rolleyes:

27929[/snapback]

You can't just decide that without changing reality! ;) Arctor is right, all the nb* hscript commands are designed to deal with Network Boxes. Are they not working for you?

Link to comment
Share on other sites

You can't just decide that without changing reality!  ;)  Arctor is right, all the nb* hscript commands are designed to deal with Network Boxes. Are they not working for you?

27935[/snapback]

My eyes... my meagre eyes :( I checked opscript again and now I see

/obj -> opscript -r /obj
# Automatically generated script: Wednesday May 24, 18:34
\set noalias = 1
set saved_path = `execute("oppwf")`
opcf /

# Node obj
opcf obj

# Network Box netbox1
nbadd netbox1
nblocate -x 1.30588 -y 0.623529 netbox1
nbsize -w 2.5 -h 2.5 netbox1
nbset  -m off -p off netbox1
nbcolor -c 0.52 0.52 0.52 netbox1
opcf ..

Huh... I must relax frequently :lol: Sorry guys for stupid questions :lol:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...