[Closed] Locking Wirecolor
I am defining a new SimpleObject class and I am trying to force the object to be a certain wire color. Similar to how Dummy object are always green and cannot be reassigned. Can this be done when extending the SimpleObject class? Locking the color is preferred, but even defining a set color in the Create function would be a help.
im not sure about locking the wireframe color but defining a wireframe color works like this:
(
for o in selection do
(
o.wireColor = color 255 0 0
)
)
You can define the wirecolor upon creation/instance, here’s a simple example,
exampleBox = box pos: [0,0,50] backfacecull: on wirecolor:[0,0,100]
for i = 1 to 10 do
(
instanceExampleBox = instance exampleBox
move instanceExampleBox [0,0,(i * 40)]
instanceExampleBox.wirecolor = [0,0,100]
instanceExampleBox.backfacecull = on
)
I don’t think I’m quite explaining myself properly. I know how to set the wirecolor on an existing object. I’m trying to set and hopefully lock the color of an object as it is created through a tool. I guess the problem has more to do with how to access a node’s properties as it is being created.
plugin simpleObject ControlHandle
name:"Control Handle"
classID:#(0x26a0a35a, 0x118b0bb2)
category:"Custom"
(
parameters main rollout:params
(
objNum type:#integer default:0
)
tool create
(
on mousePoint click do
case click of
(
1: (
viewTM = getCPTM()
nodeTM = (transMatrix worldPoint) * (inverse viewTM)
--Set and lock the node color?
)
default:
(
#stop
)
)
)
rollout params "Params"
(
)
)
You can somewhat lock an object’s wireColor by setting it through a float script. The user can still apply a different color, but as soon as the viewport redraws it’ll reset to the color that was defined in the float script.
Setting wire color on creation works if you are creating the object through a script. I am crating an object through a tool. I.E. navigating to create tab ->Custom, clicking on the Control Handle button in the create tab, and then clicking in the viewport to drop one in the scene. The plugin script I provided above is what I’m using to define the custom tool.