Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

disabled visualization drawing for unsubscribed models

  • Loading branch information...
commit 712cd33d5e596db7866dfe276edf5c8d3b19f4ca 1 parent 8f89787
rtv authored
View
2  examples/ctrl/CMakeLists.txt
@@ -1,6 +1,8 @@
SET( PLUGINS
+ convoy
fasr
+ fasr2
lasernoise
sink
source
View
5 libstage/model.cc
@@ -657,6 +657,9 @@ void Model::Shutdown( void )
{
//printf( "Shutdown model %s\n", this->token );
CallCallbacks( &hooks.shutdown );
+
+ // allows data visualizations to be cleared.
+ NeedRedraw();
}
@@ -760,7 +763,7 @@ void Model::UpdateCharge()
FOR_EACH( it, touchers )
{
- Model* toucher = (*it); //(Model*)touchers->data;
+ Model* toucher = (*it);
PowerPack* hispp =toucher->FindPowerPack();
if( hispp && toucher->watts_take > 0.0)
View
18 libstage/model_draw.cc
@@ -525,17 +525,19 @@ void Model::DataVisualize( Camera* cam )
void Model::DataVisualizeTree( Camera* cam )
{
PushLocalCoords();
- DataVisualize( cam ); // virtual function overridden by most model types
- for( std::list<Visualizer*>::iterator it = cv_list.begin();
- it != cv_list.end();
- it++ )
+ if( subs > 0 )
{
- Visualizer* vis = *it;
- if( world_gui->GetCanvas()->_custom_options[ vis->GetMenuName() ]->isEnabled() )
- vis->Visualize( this, cam );
+ DataVisualize( cam ); // virtual function overridden by some model types
+
+ FOR_EACH( it, cv_list )
+ {
+ Visualizer* vis = *it;
+ if( world_gui->GetCanvas()->_custom_options[ vis->GetMenuName() ]->isEnabled() )
+ vis->Visualize( this, cam );
+ }
}
-
+
// and draw the children
FOR_EACH( it, children )
(*it)->DataVisualizeTree( cam );
View
36 libstage/model_load.cc
@@ -145,6 +145,16 @@ void Model::Load()
}
}
+ if( wf->ReadInt( wf_entity, "noblocks", 0 ) )
+ {
+ if( has_default_block )
+ {
+ blockgroup.Clear();
+ has_default_block = false;
+ blockgroup.CalcSize();
+ }
+ }
+
if( wf->PropertyExists( wf_entity, "bitmap" ) )
{
const char* bitmapfile = wf->ReadString( wf_entity, "bitmap", NULL );
@@ -162,21 +172,21 @@ void Model::Load()
if( wf->PropertyExists( wf_entity, "boundary" ))
{
this->SetBoundary( wf->ReadInt(wf_entity, "boundary", this->boundary ));
-
+
if( boundary )
- {
- //PRINT_WARN1( "setting boundary for %s\n", token );
+ {
+ //PRINT_WARN1( "setting boundary for %s\n", token );
- blockgroup.CalcSize();
-
- double epsilon = 0.01;
- Size bgsize = blockgroup.GetSize();
-
- AddBlockRect(blockgroup.minx,blockgroup.miny, epsilon, bgsize.y, bgsize.z );
- AddBlockRect(blockgroup.minx,blockgroup.miny, bgsize.x, epsilon, bgsize.z );
- AddBlockRect(blockgroup.minx,blockgroup.maxy-epsilon, bgsize.x, epsilon, bgsize.z );
- AddBlockRect(blockgroup.maxx-epsilon,blockgroup.miny, epsilon, bgsize.y, bgsize.z );
- }
+ blockgroup.CalcSize();
+
+ double epsilon = 0.01;
+ Size bgsize = blockgroup.GetSize();
+
+ AddBlockRect(blockgroup.minx,blockgroup.miny, epsilon, bgsize.y, bgsize.z );
+ AddBlockRect(blockgroup.minx,blockgroup.miny, bgsize.x, epsilon, bgsize.z );
+ AddBlockRect(blockgroup.minx,blockgroup.maxy-epsilon, bgsize.x, epsilon, bgsize.z );
+ AddBlockRect(blockgroup.maxx-epsilon,blockgroup.miny, epsilon, bgsize.y, bgsize.z );
+ }
}
if( wf->PropertyExists( wf_entity, "mass" ))
View
11 libstage/stage.hh
@@ -2326,11 +2326,17 @@ namespace Stg
and has the type indicated by the string. This model is tagged as used. */
Model* GetUnusedModelOfType( const std::string& type );
-
/** Returns the value of the model's stall boolean, which is true
iff the model has crashed into another model */
bool Stalled() const { return this->stall; }
+ /** Returns the current number of subscriptions. If alwayson, this
+ is never less than 1.*/
+ unsigned int GetSubscriptionCount() const { return subs; }
+
+ /** Returns true if the model has one or more subscribers, else false. */
+ bool HasSubscribers() const { return( subs > 0 ); }
+
static std::map< std::string, creator_t> name_map;
};
@@ -2433,8 +2439,7 @@ namespace Stg
stg_usec_t interval; ///< Time interval between updates (TODO: is this used?)
};
- private:
-
+ private:
class Vis : public Visualizer
{
private:
Please sign in to comment.
Something went wrong with that request. Please try again.