PDA

View Full Version : Scripted custom geometry plugin


Davy
05-06-2009, 08:03 PM
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

MarcoBrunetta
05-06-2009, 09:14 PM
I don't think that's possible.

ZeBoxx2
05-06-2009, 11:38 PM
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.

Davy
05-07-2009, 08:02 AM
...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

ZeBoxx2
05-07-2009, 08:37 AM
output from cbLogger (shamepless plug: http://www.scriptspot.com/3ds-max/cblogger-callbacks-logger ):


-- UVW Unwrap modifier init stuff when accessing the drop-down(tsk tsk!)
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
05-07-2009, 09:33 AM
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

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...;)

ZeBoxx2
05-07-2009, 09:40 AM
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 :)

Rorschach
05-07-2009, 09:50 AM
True, but as you say I think there are dx3d ripping apps out there which make it pretty trivial.

Davy
05-07-2009, 09:54 AM
...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

ZeBoxx2
05-07-2009, 11:08 AM
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

Davy
05-07-2009, 11:28 AM
...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

Davy
05-07-2009, 12:11 PM
...maybe this is too easy to be true:

I define a prerender callback.
When my prerender callback gets executed, the first lline would be to remove all existing prerender callbacks except mine.
Geometry gets created.
Rendered.
Geometry gets removed.

How can you bypass that?

Davy

ZeBoxx2
05-07-2009, 12:16 PM
other than the fact that if you are setting up those callbacks using scripts, it's trivial for the user to simply disable the callbacks?

or to set up their own callback for node created / deleted events and make copies at that point?

etc.

Davy
05-07-2009, 12:25 PM
...well my callback which will delete any prerender callback, will also create the geometry inside the custom geometry plugin. No node will be created or deleted that can be catched by callbacks. And if my callback is removed, no geometry will be created at all.

So at this point I don't think one can bypass it unless I am missing something else?

Davy

ZeBoxx2
05-07-2009, 12:42 PM
I think one could still get around it with relative ease, especially if set up from maxscript. If it's a custom geometry plugin (non-scripted), I'd definitely just go with the viewport vs rendertime meshing (scripted geometry plugins have no access to that differentiation, as far as I know).. I think #preRenderFrame and such callbacks can get at the rendertime meshes, though (pretty sure I used that as an example in a thread here...somewhere).. and users of your plugin may not appreciate having their callbacks removed. Gets pretty iffy - and still isn't 100% :)

Davy
05-07-2009, 01:02 PM
...I wonder if an SDK plugin can bypass whatever a scripted plugin can't at prerender time. Cause after all it's all executed by the same.
You can catch any geometry at render time if you don't remove all callbacks. SDK or not.

For sure all callbacks at render time have to be removed which have access to the render geometry to be sure it can't be bypassed. And yes, that's a choice to make, if you want these kind of objects, no prerender callback support.

Choice is to have render time generated objects with no prerender callback support or just have regular unprotected objects.

Davy

CGTalk Moderation
05-07-2009, 01:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.