diff --git a/Cassiopee/CPlot/CPlot/Data.h b/Cassiopee/CPlot/CPlot/Data.h index 7a0ab75df..5756a622f 100644 --- a/Cassiopee/CPlot/CPlot/Data.h +++ b/Cassiopee/CPlot/CPlot/Data.h @@ -545,6 +545,7 @@ class Data double alpha, double beta); void sharpenImage(E_Int w, E_Int h, char* im1, char* im2, double amount, E_Int radius, E_Int threshold); + FILE* fopenw(const char* path, const char* mode); void exportFile(); void finalizeExport(); void dataMouseClickSelect(E_Int button, E_Int etat, E_Int x, E_Int y, diff --git a/Cassiopee/CPlot/CPlot/Plugins/fopenw.cpp b/Cassiopee/CPlot/CPlot/Plugins/fopenw.cpp new file mode 100644 index 000000000..8283eb753 --- /dev/null +++ b/Cassiopee/CPlot/CPlot/Plugins/fopenw.cpp @@ -0,0 +1,52 @@ +/* + Copyright 2013-2024 Onera. + + This file is part of Cassiopee. + + Cassiopee is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Cassiopee is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Cassiopee. If not, see . +*/ + +#include +#include +#include +#include "Data.h" + +// fopen for write with check of dirname existence (one level only) +FILE* Data::fopenw(const char* path, const char* mode) +{ + E_Int end = strlen(path); + E_Int start; + FILE* r = NULL; + for (start = end-1; start >= 0; start--) + { + if (path[start] == '/' || path[start] == '\\') break; + } + if (start > 0) // dirname exists + { + char* dirname = new char [end]; + for (E_Int i = 0; i < start; i++) dirname[i] = path[i]; + dirname[start] = '\0'; + + r = fopen(dirname, "rb"); + if (r == NULL) + { + //printf("Info: CPlot: %s not found. creating.\n", dirname); + mkdir(dirname, 0755); + }; + delete [] dirname; + } + + r = fopen(path, mode); + return r; +} diff --git a/Cassiopee/CPlot/CPlot/Shaders2.0/ShaderManager.cpp b/Cassiopee/CPlot/CPlot/Shaders2.0/ShaderManager.cpp index a35c55d6e..2ad646570 100644 --- a/Cassiopee/CPlot/CPlot/Shaders2.0/ShaderManager.cpp +++ b/Cassiopee/CPlot/CPlot/Shaders2.0/ShaderManager.cpp @@ -247,7 +247,7 @@ int ShaderManager::init() //============================================================================= int ShaderManager::load() { - char vert[256*8]; char frag[256*8]; char geom[256*8]; + char vert[256*8]; char frag[256*8]; Data* d = Data::getInstance(); char* path = d->ptrState->shaderPath; diff --git a/Cassiopee/CPlot/CPlot/set.cpp b/Cassiopee/CPlot/CPlot/set.cpp index e43fc4634..4b3d73124 100644 --- a/Cassiopee/CPlot/CPlot/set.cpp +++ b/Cassiopee/CPlot/CPlot/set.cpp @@ -355,9 +355,12 @@ PyObject* K_CPLOT::changeVariable(PyObject* self, PyObject* args) //============================================================================= PyObject* K_CPLOT::changeStyle(PyObject* self, PyObject* args) { + printf("coucou\n"); Data* d = Data::getInstance(); - d->changeAppearance(); - d->ptrState->render = 1; + d->fopenw("tata/titi/toto.png", "wb"); + + //d->changeAppearance(); + //d->ptrState->render = 1; return Py_BuildValue("i", KSUCCESS); } diff --git a/Cassiopee/CPlot/srcs.py b/Cassiopee/CPlot/srcs.py index 3f1f5b590..223682a5d 100644 --- a/Cassiopee/CPlot/srcs.py +++ b/Cassiopee/CPlot/srcs.py @@ -116,6 +116,7 @@ 'CPlot/Plugins/colormaps.cpp', 'CPlot/Plugins/select.cpp', 'CPlot/Plugins/lookfor.cpp', + 'CPlot/Plugins/fopenw.cpp', 'CPlot/Plugins/gl2ps.cpp', 'CPlot/Plugins/writePPMFile.cpp', 'CPlot/Plugins/imagePost.cpp', diff --git a/tools/BUNDLER/binex b/tools/BUNDLER/binex deleted file mode 100755 index 43277d29f..000000000 --- a/tools/BUNDLER/binex +++ /dev/null @@ -1,119 +0,0 @@ -#! /bin/sh -# Dans Dist : -# - compile les .py en .pyc, enleve les .py -# - Enleve la cle -# - Enleve FFX, FFD, thermolib... -if ([ $# -eq 0 ]) -then - if [ "$CASSIOPEE" = "" ]; then - echo "You must specify a CASSIOPEE variable in your environment." - echo "This variable specifies the installation path of *Cassiopee*." - exit - fi - if [ "$ELSAPROD" = "" ]; then - echo "You must specify a ELSAPROD in your environment." - echo "This variable identifies the processor type." - exit - fi - INSTALLPATH="$CASSIOPEE/Dist/bin/$ELSAPROD" - -elif ([ $# -eq 1 ]) -then - if [ "$ELSAPROD" = "" ]; then - echo "You must specify a ELSAPROD in your environment." - echo "This variable identifies the processor type." - exit - fi - INSTALLPATH="$1" -else - echo 'install: install in $CASSIOPEE/Dist/bin/$ELSAPROD' - echo 'install : install in directory .' - exit -fi - -cd $INSTALLPATH - -# compile les .py dans la racine (supprime car tout est open source) -#if test -e tkCassiopee.py -#then -# ret=`ls '*.py'` -# for i in $ret; do -# python $CASSIOPEE/Apps/util/BUNDLER/compile.py $i && rm -f $i -# done -# rm -fr __pycache__ -#fi - -# Enleve la cle -echo 'Removing key' -if test -e lib/.CassiopeeKey -then - rm lib/.CassiopeeKey -fi - -if test -e "lib/site-packages" -then - cd lib/site-packages -else - cd lib/python3.8/site-packages -fi - -pwd - -# Compile les .py, enleve les .py dans les modules -. $CASSIOPEE/Apps/Modules/MODULES -FULLMODULES='Apps' -for mod in $FULLMODULES -do - echo 'compiling '$mod - if test -e "$mod" - then - cd $mod - ret=`/usr/bin/find . -name '*.py'` - for i in $ret; do - python $CASSIOPEE/Apps/util/BUNDLER/compile.py $i && rm -f $i - done - rm -fr __pycache__ - cd .. - fi -done - -. $CASSIOPEE/Apps/PModules/MODULES -FULLMODULES='' -for mod in $FULLMODULES -do - echo 'compiling '$mod - if [ "$mod" == "FFX" ] - then - mod="Ffx" - fi - if [ "$mod" == "FFD" ] - then - mod="Ffd" - fi - if test -e "$mod" - then - cd $mod - ret=`/usr/bin/find . -name '*.py'` - for i in $ret; do - python $CASSIOPEE/Apps/util/BUNDLER/compile.py $i && rm -f $i - done - rm -fr __pycache__ - cd .. - fi -done - -# Suppressions des modules non distribues -#echo 'Removing Ael' -#rm -fr Ael -echo 'Removing FFX' -rm -fr Ffx -echo 'Removing FFD' -rm -fr Ffd -echo 'Removing Thermolib' -rm -fr Thermolib -echo 'Removing PUMA' -rm -fr PUMA -echo 'Removing MOLA' -rm -fr ../../../MOLA -echo 'Removing Upmost' -rm -fr Upmost \ No newline at end of file diff --git a/tools/BUNDLER/rmpyc b/tools/BUNDLER/rmpyc deleted file mode 100755 index 68056ccc9..000000000 --- a/tools/BUNDLER/rmpyc +++ /dev/null @@ -1,90 +0,0 @@ -#! /bin/sh -# Dans Dist : -# - enleve les pyc (a appeler pour remettre le Dist ok apres binex) -if ([ $# -eq 0 ]) -then - if [ "$CASSIOPEE" = "" ]; then - echo "You must specify a CASSIOPEE variable in your environment." - echo "This variable specifies the installation path of *Cassiopee*." - exit - fi - if [ "$ELSAPROD" = "" ]; then - echo "You must specify a ELSAPROD in your environment." - echo "This variable identifies the processor type." - exit - fi - INSTALLPATH="$CASSIOPEE/Dist/bin/$ELSAPROD" - -elif ([ $# -eq 1 ]) -then - if [ "$ELSAPROD" = "" ]; then - echo "You must specify a ELSAPROD in your environment." - echo "This variable identifies the processor type." - exit - fi - INSTALLPATH="$1" -else - echo 'install: install in $CASSIOPEE/Dist/bin/$ELSAPROD' - echo 'install : install in directory .' - exit -fi - -cd $INSTALLPATH - -# compile les .py dans la racine (supprime car tout est open source) -# ret=`ls '*.pyc'` -# for i in $ret; do -# rm -f $i -# done - - - -if test -e "lib/site-packages" -then - cd lib/site-packages -else - cd lib/python3.8/site-packages -fi - -pwd - -# Compile les .py, enleve les .py dans les modules -. $CASSIOPEE/Apps/Modules/MODULES -FULLMODULES='Apps' -for mod in $FULLMODULES -do - echo 'removing pyc in '$mod - if test -e "$mod" - then - cd $mod - ret=`/usr/bin/find . -name '*.pyc'` - for i in $ret; do - rm -f $i - done - cd .. - fi -done - -. $CASSIOPEE/Apps/PModules/MODULES -FULLMODULES='' -for mod in $FULLMODULES -do - echo 'removing pyc in '$mod - if [ "$mod" == "FFX" ] - then - mod="Ffx" - fi - if [ "$mod" == "FFD" ] - then - mod="Ffd" - fi - if test -e "$mod" - then - cd $mod - ret=`/usr/bin/find . -name '*.pyc'` - for i in $ret; do - rm -f $i - done - cd .. - fi -done diff --git a/tools/moveDist b/tools/moveDist old mode 100644 new mode 100755