alicevision / Meshroom

3D Reconstruction Software
http://alicevision.org
Other
11.21k stars 1.09k forks source link

[question] New cli node without --options? #697

Closed natowi closed 5 years ago

natowi commented 5 years ago

Describe the problem I tried to create a new node for https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification The problem is, that the exe does not use options for input/output and parameters, the expected cli input is:

simplify.exe c:\dir\in.obj c:\dir\out.obj 0.2

When I run my node I get the following error: File --input not found!

Is it possible to pass only the paths and parameters from the node to the cli?

Log

[1/1] msimplify
 - commandLine: alicevision_msimplify  --input "C:/Users/natowi/AppData/Local/Temp/MeshroomCache/Meshing/852d4042ef8b75b8cf021b9cadaad1d86d0b5c00/mesh.obj" --ratio 0.5 --agressiveness 7.0 --output "C:/Users/natowi/AppData/Local/Temp/MeshroomCache/msimplify/b9453cffbe84470ee083c155e4773c69afd76361/mesh.obj"
 - logFile: C:/Users/natowi/AppData/Local/Temp/MeshroomCache/msimplify/b9453cffbe84470ee083c155e4773c69afd76361/log
 - elapsed time: 0:00:00.092263
ERROR:root:Error on node computation: Error on node "msimplify_1":
Log:
Mesh Simplification (C)2014 by Sven Forstmann in 2014, MIT License (64-bit)
File --input not found!

How to reproduce OS: Win10 latest Meshroom (not compiled), pre-compiled alicevision+plugins

.py file to place in meshroom\nodes\aliceVision https://gist.github.com/natowi/b42329c8104e88edc4357c9c1bd0a94d

.exe file to place in aliceVision\bin bin.Windows (rename from simplify.exe to alicevision_msimplify.exe)

.bat to place in Meshroom folder to start the gui

set MESHROOM_INSTALL_DIR=%cd%
set PYTHONPATH=%CD% && python meshroom/ui

sim

simogasp commented 5 years ago

because the exe does only take positional arguments (no --paramName) https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification/blob/master/src.cmd/Main.cpp#L24

simogasp commented 5 years ago

u can have a simple python executable script named alicevision_msimplify that takes those arguments and makes the proper call to the exe without the parameter names

natowi commented 5 years ago

Thank you, I will give this a try. Could you provide a simple example or point me to one? That would be a huge help, am new to python ;)

simogasp commented 5 years ago

Actually I don't know how python works on windows, if you can call the script directly like in linux. You can also simply create a batch script file that remaps the input parameters properly for the exe to launch: https://stackoverflow.com/a/26702/1107548 Your alicevision_msimplify will be something like

alicevision_msimplify %2 %4

where %X is the parameter in position X, you want to skip the odd numbers as they are the --paramName, just reorder the others according to the exe.

fabiencastan commented 5 years ago

No, just change in your node description.

class MeshDecimate(desc.CommandLineNode):
    commandLine = 'alicevision_msimplify {inputValue} {outputValue} {factorValue}' ### HERE: change the command line

    inputs = [
        desc.File(
            name='input',
            ...)
        desc.FloatParam(
            name='factor',
            ...
...
natowi commented 5 years ago

Thank you, I have learned a lot and it now works. https://gist.github.com/natowi/b42329c8104e88edc4357c9c1bd0a94d