Notifications
Clear all

[Closed] Scripted custom geometry plugin

Hi,

Am working on a custom geometry plugin but I want to prevent an artist from converting it to an editable mesh. Or even don’t allow any extra modifiers on top of the plugin.

Is that possible?

Thanks,
Davy

15 Replies
1 Reply
(@rorschach)
Joined: 11 months ago

Posts: 0

I think there would be too many ways to circumvent it… snapshotting the mesh, copying mesh, using a Mesher to clone the mesh etc.

Give up…

I don’t think that’s possible.

Marco is correct – there’s no real way to prevent a modifier from being added. You can take some steps to remove the modifier after it was added and other such trickery, but it’s pretty nasty.

See this thread on ‘preventing’ a modifier from being added twice…
http://forums.cgsociety.org/showthread.php?t=726734&highlight=prevent+modifier
…the same principles would apply to a modifier being added only once.

…yep, that’s what I thought, to code it.

But when trying to get the right handler, I don’t find any usefull in the help file to actually trigger when adding a modifier, so I can code what to do in case of etc.

I went through all event handlers but couldn’t find any that worked for when a user adds a modifier.

Any idea?

Thanks,
Davy

output from cbLogger (shamepless plug: http://www.scriptspot.com/3ds-max/cblogger-callbacks-logger ):


 [color=Green]-- UVW Unwrap modifier init stuff when accessing the drop-down(tsk tsk!)
 [/color]GE: #mtlRefAdded @ 38316051
 GE: #mtlRefAdded @ 38316061
 	UnwrapChecker:Standard
 	UnwrapChecker:Standard
 GE: #mtlRefDeleted @ 38316071
 	UnwrapChecker:Standard
 
 -- start adding a modifier (Bend in my case)
 GE: #modPanelObjPreChange @ 38324323
 GE: #modPanelObjPostChange @ 38324333
 
 -- oh hello my pretties
 GE: #preModifierAdded @ 38324333
 	[1] $GeoSphere:GeoSphere01 @ [-15.129151,42.435425,0.000000]
 	[2] Bend:Bend
 GE: #postModifierAdded @ 38324373
 	[1] $Editable_Mesh:GeoSphere01 @ [-15.129151,42.435425,0.000000]
 	[2] Bend:Bend
 
 -- ehh... the rest we don't care about.
 GE: #modPanelObjPreChange @ 38324423
 GE: #modPanelObjPostChange @ 38324534
 GE: #modPanelSelChanged @ 38324554
 GE: #modPanelObjPreChange @ 38324564
 GE: #modPanelObjPostChange @ 38324584
 RV: #redrawViews @ 38324684
 NE: #callbackBegin @ 38324754
 NE: #modelStructured @ 38324764
 	[1] 21632
 NE: #geometryChanged @ 38324784
 	[1] 21632
 NE: #topologyChanged @ 38324814
 	[1] 21632
 NE: #mappingChanged @ 38324844
 	[1] 21632
 NE: #extentionChannelChanged @ 38324874
 	[1] 21632
 NE: #modelOtherEvent @ 38324914
 	[1] 21632
 NE: #renderPropertiesChanged @ 38324934
 	[1] 21632
 NE: #displayPropertiesChanged @ 38324974
 	[1] 21632
 NE: #subobjectSelectionChanged @ 38325004
 	[1] 21632
 NE: #displayOtherEvent @ 38325024
 	[1] 21632
 NE: #callbackEnd @ 38325034
 

Rorschach… well, that only applies to -scripted- geometry plugins. If he’s using the SDK, there’s quite a few ways of preventing it

There’s demos of geometry plugins available (I don’t recall a specific one, but I think one was a tree/shrubbery type plugin) where you can try all you might… you’re not going to get the geometry into any kind of mesh using $.mesh, cloning, snapshotting, applying a (scripted) modifier (which would normally be fed the mesh) or anything else unless you…
A. wrote a renderer, and have the renderer output the mesh data fed to it by 3ds Max
B. wrote or installed a custom display driver that allows you to grab meshes fed to e.g. OpenGL or Direct3D

Note that A and B above do demonstrate that there -was- probably a way to get the meshes, but that sure is a lot of trouble to go through.

Don’t ask me -how- they prevent it through the SDK, though… but I presume there’s plenty of methods available there not available to MaxScript

True, but as you say I think there are dx3d ripping apps out there which make it pretty trivial.

…what about having a simple representation of the object in viewport and only generate the real geometry at render time?

Can you bypass that?

I am trying it first with a scripted plugin.

Davy

like I said… a renderer gets the mesh and a renderer can certainly write that information out to a buffer which another plugin could then read.

There’s -no- 100% way to prevent a mesh from being captured without also making it useless
However, the number of people who would bother to write a renderer plugin to do this, or install one of those funky 3D drivers, is probably not worth the worry.

If all you were trying to do was prevent user error (i.e. “you shouldn’t apply a modifier to this type of object because it breaks its functionality” – Brazil’s implicit sphere comes to mind (gets cast to a mesh sphere so it still gives some result, but it’s no longer an implicit sphere, so most modifiers are simply tagged as invalid for the node) – then the SDK should give you all you need – scripted plugins would have to work with the callbacks and such.

Edit: oh, just to note – yes, you can have separate viewport and rendertime meshes. BlobMesh, MeshSmooth (modifier, but the same principle applies) and the like have separate viewport/rendertime controls for mesh density, for example.
Edit2: See ‘GetRenderMesh, GeomObject’ in the SDK help file

…yep, I really don’t worry about the gurus who can crack anything anyway.

Just to prevent normal use from extracting geometry and animation from it.

Last question…as for render callbacks, would it be so easy to have an extra render callback that execute after mine? Cause then it would be really easy to grab that mesh.

So yes, then it would be useless to bother in the first place.

Davy

Page 1 / 2