eliemichel / OpenMfxForBlender

A branch of Blender featuring an OpenMfx modifier
Other
177 stars 19 forks source link

Blender 2.92 branch (openmesheffect-nightly) issues #44

Closed tkarabela closed 3 years ago

tkarabela commented 3 years ago

I've tried building https://github.com/eliemichel/OpenMeshEffectForBlender/commit/6e1ec285e6c6485927881534edaf08b90e9719a4 on my Linux machine (via make debug lite) and I encountered the following:

eliemichel commented 3 years ago

Oops I had forgotten to push a commit, that fixes problem 1 (it was a stupid typo in reference counting). Regarding problem 2 I'll have a look at it.

eliemichel commented 3 years ago

I pushed a slight fix, tested with gcc 10 on debian. (I should eventually test with the spec from the VFX reference plateform btw)

tkarabela commented 3 years ago

Confirming that both problems still happen on my machine with 9f737c8b6381950e9059ac86d6358c19e44b6373.

More info on problem 1:

It seems to me that one is not supposed to call BKE_modifier_set_error(NULL, ...).

eliemichel commented 3 years ago

Oh the #ifndef NDEBUG wasn't enabled for me so I only patched the CLOG_ERROR. I was a bit frustrated because BKE_modifier_set_error used not to require the object as a parameter, and it is used only for message logging (and for this assertion as well then). Even though it is not ideal to patch this to handle null argument, it seemed better than pulling a reference to the object holding the modifier at many places in the code just for this.

tkarabela commented 3 years ago

Edit: nevermind, the Hook modifier stores its additional input as Object, not the object it is attached to.

BTW, if the effect instance currently doesn't keep a pointer to its Object, AFAICT it will be needed later anyway, since vertex group names are stored in Object. See the Hook modifier source and MOD_get_vgroup() helper function. Hook keeps its Object pointer in its ModifierData:

https://github.com/eliemichel/OpenMeshEffectForBlender/blob/9f737c8b6381950e9059ac86d6358c19e44b6373/source/blender/modifiers/intern/MOD_hook.c#L287-L295

https://github.com/eliemichel/OpenMeshEffectForBlender/blob/9f737c8b6381950e9059ac86d6358c19e44b6373/source/blender/modifiers/intern/MOD_hook.c#L315-L332

eliemichel commented 3 years ago

I just fixed one remaining linking issue with examples and fixed the issue in BKE_modifier_set_error.

BTW, if the effect instance currently doesn't keep a pointer to its Object, AFAICT it will be needed later anyway, since vertex group names are stored in Object.

Indeed they are on the object but we'll have to be carefull regarding licensing. All the host code shared with the OpenMeshEffect repository must be GPL-free. So far only the blender subdirectory of the intern/openmesheffect project is bound to the GPL and I'd like things to remain so. Leaking GPL code into the shared code would prevent adoption from closed source programs.

tkarabela commented 3 years ago

Indeed they are on the object but we'll have to be carefull regarding licensing. All the host code shared with the OpenMeshEffect repository must be GPL-free. So far only the blender subdirectory of the intern/openmesheffect project is bound to the GPL and I'd like things to remain so. Leaking GPL code into the shared code would prevent adoption from closed source programs.

I understand these concerns. AFAIK, Blender-specific runtime data reside in source/blender/makesdna/DNA_modifier_types.h and are used by code in intern/openmesheffect/blender/intern to communicate with the (potentially closed-source) plug-in through the OFX interface; the plugin itself only has an opaque handle to the OFX host. So, storing some additional runtime data on the Blender host side should not GPL-ifiy any more code that we have now.

https://github.com/eliemichel/OpenMeshEffectForBlender/blob/c74fb98aa80d0f4925dd5985ee68e7bb6f6483ac/source/blender/makesdna/DNA_modifier_types.h#L2350-L2364

I just fixed one remaining linking issue with examples and fixed the issue in BKE_modifier_set_error.

Great, with the latest version I've managed to get a "nightly" build running! :)

After brief testing, I've encountered some issue with parameter UI, here's what I did:

Screenshot:

Screenshot from 2020-11-09 21-58-26

Log:

== mfx_Modifier_do on data 0x61d000956088
== ensure_runtime on data 0x61d000956088
Getting Global Host; reference counter will be set to 2.
Defining input 'OfxMeshMainInput' on OfxMeshEffectHandle 0x6190010e5f80
Defining input 'OfxMeshMainOutput' on OfxMeshEffectHandle 0x6190010e5f80
OfxActionDescribe action returned status 0 (kOfxStatOK)
OfxActionCreateInstance action returned status 0 (kOfxStatOK)
==/ ensure_runtime
VtkEffect::IsIdentity - no
OfxMeshEffectActionIsIdentity action returned status 14 (kOfxStatReplyDefault)
== VtkEffect::Cook
...
==/ VtkEffect::Cook
OfxMeshEffectActionCook action returned status 0 (kOfxStatOK)
==/ mfx_Modifier_do
uiItemR: property not found: OpenMeshEffectModifier.float_value
uiItemR: property not found: OpenMeshEffectModifier.boolean_value
uiItemR: property not found: OpenMeshEffectModifier.boolean_value
python line lookup failed, interpreter inactive
python line lookup failed, interpreter inactive
python line lookup failed, interpreter inactive
python line lookup failed, interpreter inactive
python line lookup failed, interpreter inactive
python line lookup failed, interpreter inactive
uiItemR: property not found: OpenMeshEffectModifier.float_value
uiItemR: property not found: OpenMeshEffectModifier.boolean_value
uiItemR: property not found: OpenMeshEffectModifier.boolean_value
eliemichel commented 3 years ago

I'll look this up, in the meantime I just pushed on this nightly branch a slight refactor of the callback file to pave the way to cleaner code, and also to handle kOfxMeshPropTransformMatrix. Which also means I figured out a way to get access to the object, but still not enough to ensure that we have it at hand when calling BKE_modifier_set_error.

tkarabela commented 3 years ago

in the meantime I just pushed on this nightly branch a slight refactor of the callback file to pave the way to cleaner code, and also to handle kOfxMeshPropTransformMatrix

It looks much more maintainable now :+1:

Not sure if two cachelines worth of data are worth threading here ^^ I would save this for converting attribute buffers. (Looking into Blender's code, it seems that they are moving away from OpenMP and prefer using their own parallel primitives, like in the BKE_mesh_calc_edges() function.)

https://github.com/eliemichel/OpenMeshEffectForBlender/blob/d59d96eb21ce8547d0d770e81fe95e7545d92031/intern/openmesheffect/blender/intern/mfxCallbacks.cpp#L663-L666

eliemichel commented 3 years ago

Ow yeah a leftover of a test I wanted to see if it complains when using openmp ^^ Fixed the parameter issue: image

eliemichel commented 3 years ago

@tkarabela Can we consider this solved?

tkarabela commented 3 years ago

@tkarabela Can we consider this solved?

Yes, I've tried building current nightly f579859b365f63131ce16595a8ea92ed37abba6d in "debug lite" and it looks fine with MfxVTK on Linux :)

eliemichel commented 3 years ago

Great news, I'll switch main to being this 2.82-based branch eventually then :)