From d615a87cd0f8cf51bbb427303e7fd7eaa9434020 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Tue, 27 Apr 2021 20:26:35 +0200 Subject: [PATCH] #3460 Feauture box Actor color option --- bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx | 25 +++++++++++++++++++------ bbtk_creaVtk_PKG/src/bbcreaVtkActor.h | 4 ++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx index 6b00248..19626b8 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkActor.cxx @@ -40,7 +40,13 @@ void Actor::Process() std::string wantedClass = "vtkOpenGLActor"; if(className == wantedClass) { - ((vtkActor*)vtkprop3D)->GetProperty()->SetOpacity( bbGetInputOpacity() ); + vtkActor *vtkactor=((vtkActor*)vtkprop3D); + vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() ); + vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() ); + double r = bbGetInputColor()[0]; + double g = bbGetInputColor()[1]; + double b = bbGetInputColor()[2]; + vtkactor->GetProperty()->SetColor( r,g,b ); } if ( bbGetInputTransform()!=NULL ) @@ -73,11 +79,18 @@ void Actor::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 - bbSetInputActive(false); - backActive=bbGetInputActive(); - bbSetInputIn(NULL); - bbSetInputOpacity(1); - bbSetInputRenderer(NULL); + + std::vector color; + color.push_back(1); + color.push_back(0); + color.push_back(0); + bbSetInputActive( false ); + backActive=bbGetInputActive(); + bbSetInputIn( NULL ); + bbSetInputOpacity( 1 ); + bbSetInputLineWidth( 0.5 ); + bbSetInputRenderer( NULL ); + bbSetInputColor( color ); } //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkActor.h b/bbtk_creaVtk_PKG/src/bbcreaVtkActor.h index 405369f..101b2ab 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkActor.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkActor.h @@ -25,6 +25,8 @@ class bbcreaVtk_EXPORT Actor BBTK_DECLARE_INPUT(Active,bool); BBTK_DECLARE_INPUT(In,vtkProp3D*); BBTK_DECLARE_INPUT(Opacity,double); + BBTK_DECLARE_INPUT(Color,std::vector); + BBTK_DECLARE_INPUT(LineWidth,double); BBTK_DECLARE_INPUT(Transform,vtkTransform*); BBTK_DECLARE_INPUT(Renderer,vtkRenderer*); // BBTK_DECLARE_OUTPUT(Out,double); @@ -46,6 +48,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(Actor,bbtk::AtomicBlackBox); BBTK_INPUT(Actor,Active,"Active true/false (default false)",bool,""); BBTK_INPUT(Actor,In,"First input",vtkProp3D*,""); BBTK_INPUT(Actor,Opacity,"Opacity 0..1 (default 1)",double,""); + BBTK_INPUT(Actor,Color,"(default [1 0 0]red ) RGB color vector [0..1, 0..1, 0..1] )", std::vector,""); + BBTK_INPUT(Actor,LineWidth,"(default 0.5 ) With ligne )",double,""); BBTK_INPUT(Actor,Renderer,"Renderer",vtkRenderer*,""); // BBTK_OUTPUT(Actor,Out,"First output",double,""); -- 2.47.1