void expand_node_t::do_create_params() { std::auto_ptr<float_param_t> p( new float_param_t( "Top")); p->set_id( "top"); p->set_min( 0); p->set_numeric_type( numeric_param_t::relative_size_y, 0); p->set_default_value( 0); p->set_static( true); add_param( p); p.reset( new float_param_t( "Left")); p->set_id( "left"); p->set_min( 0); p->set_numeric_type( numeric_param_t::relative_size_x, 0); p->set_default_value( 0); p->set_static( true); add_param( p); p.reset( new float_param_t( "Bottom")); p->set_id( "bottom"); p->set_min( 0); p->set_numeric_type( numeric_param_t::relative_size_y, 0); p->set_default_value( 0); p->set_static( true); add_param( p); p.reset( new float_param_t( "Right")); p->set_id( "right"); p->set_min( 0); p->set_numeric_type( numeric_param_t::relative_size_x, 0); p->set_default_value( 0); p->set_static( true); add_param( p); }
node_sampler::node_sampler(const audio_info& info): node0 (info, NODE_SAMPLER, "sampler", N_IN_A_SOCKETS, N_IN_C_SOCKETS, N_OUT_A_SOCKETS, N_OUT_C_SOCKETS), m_fetcher (m_reader), m_inbuf (info.block_size), m_scaler (info.sample_rate), m_ctrl_pos (0), m_param_ampl(0.75f), m_param_rate (1.0f), m_param_tempo (1.0f), m_param_pitch (1.0f), m_restart (false) { add_param ("file", node_param::STRING, &m_param_file, boost::bind (&node_sampler::on_file_change, this, _1)); add_param ("amplitude", node_param::FLOAT, &m_param_ampl); add_param ("rate", node_param::FLOAT, &m_param_rate); add_param ("tempo", node_param::FLOAT, &m_param_tempo); add_param ("pitch", node_param::FLOAT, &m_param_pitch); m_scaler.set_rate (1.0); m_scaler.set_frame_rate (info.sample_rate); m_fetcher.set_chunk_size (info.block_size); m_fetcher.start (); }
node_noise::node_noise (const audio_info& prop, int obj_type, const std::string& name, int n_audio_out, int n_control_out) : node0 (prop, obj_type, name, N_IN_A_SOCKETS, N_IN_C_SOCKETS, n_audio_out, n_control_out), m_param_type (NOISE_PINK), m_param_ampl (DEFAULT_AMPL), m_b0 (0.0f), m_b1 (0.0f), m_b2 (0.0f), m_b3 (0.0f), m_b4 (0.0f), m_b5 (0.0f), m_b6 (0.0f) { add_param ("type", node_param::INT, &m_param_type); add_param ("amplitude", node_param::FLOAT, &m_param_ampl); }
/** * ctor. * @param mat the n-dimensional matrix * @param vec the vector * @param axis the axis-th dimension of matrix must agree with the vector dimension. * @note axis can currently only be 0 or n-1. */ MatTimesVec(result_t& mat, result_t& vec, unsigned int axis) : Op(2,1) , m_axis(axis) { add_param(0,mat); add_param(1,vec); }
void blur_node_t::do_create_params() { std::auto_ptr<popup_param_t> r( new popup_param_t( "Channels")); r->set_id( "channels"); r->menu_items() += "RGBA", "RGB", "Alpha"; add_param( r); std::auto_ptr<float2_param_t> q( new float2_param_t( "Radius")); q->set_id( "radius"); q->set_range( 0, 200); q->set_step( 0.25); q->set_default_value( Imath::V2f( 0, 0)); q->set_proportional( true); add_param( q); std::auto_ptr<float_param_t> p( new float_param_t( "Iters")); p->set_id( "iters"); p->set_range( 1, 10); p->set_default_value( 1); p->set_static( true); p->set_round_to_int( true); add_param( p); std::auto_ptr<popup_param_t> b( new popup_param_t( "Border Mode")); b->set_id( "border"); b->menu_items() += "Black", "Repeat", "Reflect"; add_param( b); }
static void addchain_param (mpres_t x, mpres_t y, mpres_t z, unsigned int s, mpres_t t, mpres_t u, mpres_t v, mpres_t w, mpmod_t n) { if (s == 1) { mpres_set_si (x, -3, n); mpres_set_ui (y, 3, n); mpres_set_ui (z, 1, n); } else if (s == 3) { addchain_param(x, y, z, s-1, t, u, v, w, n); add_param (x, y, z, +1, t, u, v, w, n); } else if (s % 2 == 0) { addchain_param(x, y, z, s/2, t, u, v, w, n); dbl_param (x, y, z, t, u, v, n); } else if (s % 4 == 1) { addchain_param(x, y, z, s-1, t, u, v, w, n); add_param (x, y, z, +1, t, u, v, w, n); } else /* (s % 4 == 3) and s != 3 */ { addchain_param(x, y, z, s+1, t, u, v, w, n); add_param (x, y, z, -1, t, u, v, w, n); } }
void hsv_colorize_node_t::do_create_params() { std::auto_ptr<color_param_t> q( new color_param_t( "Color")); q->set_id( "color"); q->set_is_rgba( false); q->set_default_value( Imath::Color4f( 1, 0, 0, 1)); add_param( q); std::auto_ptr<float_param_t> p( new float_param_t( "Strength")); p->set_id( "strength"); p->set_range( 0, 1); p->set_default_value( 1); p->set_step( 0.05f); add_param( p); p.reset( new float_param_t( "Saturation")); p->set_id( "sat"); p->set_default_value( 1); p->set_step( 0.05f); add_param( p); p.reset( new float_param_t( "Value")); p->set_id( "value"); p->set_min( 0); p->set_default_value( 1); p->set_step( 0.05f); add_param( p); }
transform2_param_t::transform2_param_t( const std::string& name, const std::string& id) : composite_param_t( name) { set_id( id); std::auto_ptr<float2_param_t> p( new float2_param_t( "Center")); p->set_id( id + std::string( "_center")); p->set_default_value( Imath::V2f( 0.5, 0.5)); p->set_numeric_type( numeric_param_t::relative_xy); add_param( p); p.reset( new float2_param_t( "Pos")); p->set_id( id + std::string( "_pos")); p->set_default_value( Imath::V2f( 0, 0)); add_param( p); p.reset( new float2_param_t( "Scale")); p->set_id( id + std::string( "_scale")); p->set_default_value( Imath::V2f( 1, 1)); p->set_step( 0.05); p->set_proportional( true); add_param( p); std::auto_ptr<float_param_t> q( new float_param_t( "Rotation")); q->set_id( id + std::string( "_rot")); q->set_default_value( 0); q->set_step( 0.5); add_param( q); }
void smart_blur_node_t::do_create_params() { std::auto_ptr<popup_param_t> r( new popup_param_t( "Channels")); r->set_id( "channels"); r->menu_items() = boost::assign::list_of( "RGBA")( "RGB"); add_param( r); std::auto_ptr<float2_param_t> q( new float2_param_t( "Deviation")); q->set_id( "stddev"); q->set_range( 0, 100); q->set_step( 0.25); q->set_default_value( Imath::V2f( 0, 0)); q->set_proportional( true); add_param( q); std::auto_ptr<float_param_t> f( new float_param_t( "Thereshold")); f->set_id( "theresh"); f->set_min( 0); f->set_default_value( 0.05); f->set_step( 0.025); add_param( f); std::auto_ptr<popup_param_t> b( new popup_param_t( "Border Mode")); b->set_id( "border"); b->menu_items() = boost::assign::list_of( "Black")( "Repeat")( "Reflect"); add_param( b); }
/** * ctor. * \f$ \alpha * X + \beta * Y\f$ * @param p0 X * @param p1 Y * @param fact_a alpha * @param fact_b beta */ Axpby(result_t& p0, result_t& p1, float fact_a=1.f, float fact_b=1.f) :Op(2,1) , m_fact_a(fact_a) , m_fact_b(fact_b){ add_param(0,p0); add_param(1,p1); }
void copy_channels_node_t::do_create_params() { std::auto_ptr<popup_param_t> p( new popup_param_t( "Red")); p->set_id( "red"); p->menu_items() = boost::assign::list_of( "Source")( "Src2 Red")( "Src2 Green")( "Src2 Blue") ( "Src2 Luminance")( "Src2 Alpha")( "One")( "Zero"); add_param( p); p.reset( new popup_param_t( "Green")); p->set_id( "green"); p->menu_items() = boost::assign::list_of( "Source")( "Src2 Red")( "Src2 Green")( "Src2 Blue") ( "Src2 Luminance")( "Src2 Alpha")( "One")( "Zero"); add_param( p); p.reset( new popup_param_t( "Blue")); p->set_id( "blue"); p->menu_items() = boost::assign::list_of( "Source")( "Src2 Red")( "Src2 Green")( "Src2 Blue") ( "Src2 Luminance")( "Src2 Alpha")( "One")( "Zero"); add_param( p); p.reset( new popup_param_t( "Alpha")); p->set_id( "alpha"); p->menu_items() = boost::assign::list_of( "Source")( "Src2 Red")( "Src2 Green")( "Src2 Blue") ( "Src2 Luminance")( "Src2 Alpha")( "One")( "Zero"); add_param( p); }
/** * ctor. * * @param mat the matrix * @param vec the vector * @param axis the axis-th dimension of matrix must agree with the vector dimension. * @param subtract_mean if true, ensure that the matrix gradient is zero-mean * * @warning currently, only the first and the last dimension of matrix are supported. */ MatPlusVec(result_t& mat, result_t& vec, unsigned int axis, bool subtract_mean=false) : Op(2,1) , m_axis(axis) , m_subtract_mean(subtract_mean) { add_param(0,mat); add_param(1,vec); }
void log_to_linear_node_t::do_create_params() { std::auto_ptr<popup_param_t> p( new popup_param_t( "Convert")); p->set_id( "convert"); p->menu_items() += "Log to Linear", "Linear to Log"; add_param( p); std::auto_ptr<combo_group_param_t> top( new combo_group_param_t( "Method")); top->set_id( "method"); // cineon { std::auto_ptr<composite_param_t> group( new composite_param_t( "Cineon")); group->set_id( "cineon"); std::auto_ptr<float_param_t> fp( new float_param_t( "Gamma")); fp->set_id( "cin_gamma"); fp->set_range( 0.001, 2); fp->set_step( 0.01); fp->set_default_value( 0.6); group->add_param( fp); fp.reset( new float_param_t( "White Point")); fp->set_id( "cin_white"); fp->set_range( 0, 1024); fp->set_step( 1); fp->set_default_value( 685); group->add_param( fp); fp.reset( new float_param_t( "Black Point")); fp->set_id( "cin_black"); fp->set_range( 0, 1024); fp->set_step( 1); fp->set_default_value( 95); group->add_param( fp); top->add_param( group); } // redlog { std::auto_ptr<composite_param_t> group( new composite_param_t( "Red Log")); group->set_id( "redlog"); top->add_param( group); } // exrdpx { std::auto_ptr<composite_param_t> group( new composite_param_t( "ExrDpx")); group->set_id( "exrdpx"); top->add_param( group); } add_param( top); }
void ocio_colorspace_node_t::do_create_params() { std::auto_ptr<ocio_colorspace_param_t> p( new ocio_colorspace_param_t( "In Colorspace")); p->set_id( "in_colorspace"); add_param( p); p.reset( new ocio_colorspace_param_t( "Out Colorspace")); p->set_id( "out_colorspace"); add_param( p); std::auto_ptr<group_param_t> g( new group_param_t( "Context")); { std::auto_ptr<string_param_t> s( new string_param_t( "Key1")); s->set_id( "key1"); s->set_include_in_hash( false); g->add_param( s); s.reset( new string_param_t( "Value1")); s->set_id( "value1"); s->set_include_in_hash( false); g->add_param( s); s.reset( new string_param_t( "Key2")); s->set_id( "key2"); s->set_include_in_hash( false); g->add_param( s); s.reset( new string_param_t( "Value2")); s->set_id( "value2"); s->set_include_in_hash( false); g->add_param( s); s.reset( new string_param_t( "Key3")); s->set_id( "key3"); s->set_include_in_hash( false); g->add_param( s); s.reset( new string_param_t( "Value3")); s->set_id( "value3"); s->set_include_in_hash( false); g->add_param( s); s.reset( new string_param_t( "Key4")); s->set_id( "key4"); s->set_include_in_hash( false); g->add_param( s); s.reset( new string_param_t( "Value4")); s->set_id( "value4"); s->set_include_in_hash( false); g->add_param( s); } add_param( g); }
static void print_all(struct string_table *tags, const char *filename, char sep) { int j; struct param *i, *params = NULL; printf("%-16s%s%c", "filename:", filename, sep); for (j = 0; j < tags->cnt; j++) { const char *info = tags->str[j]; char *eq, *colon; /* We expect this in parm and parmtype. */ colon = strchr(info, ':'); /* We store these for handling at the end */ if (strstarts(info, "parm=") && colon) { i = add_param(info + strlen("parm="), ¶ms); i->param = colon + 1; continue; } if (strstarts(info, "parmtype=") && colon) { i = add_param(info + strlen("parmtype="), ¶ms); i->type = colon + 1; continue; } if (!sep) { printf("%s%c", info, sep); continue; } eq = strchr(info, '='); /* Warn if no '=' maybe? */ if (eq) { char tag[eq - info + 2]; strncpy(tag, info, eq - info); tag[eq-info] = ':'; tag[eq-info+1] = '\0'; printf("%-16s%s%c", tag, eq+1, sep); } } /* Now show parameters. */ for (i = params; i; i = i->next) { if (!i->param) printf("%-16s%s%s%c", "parm:", i->name, i->type, sep); else if (i->type) printf("%-16s%s%s (%s)%c", "parm:", i->name, i->param, i->type, sep); else printf("%-16s%s%s%c", "parm:", i->name, i->param, sep); } }
void keyer3d_node_t::create_cluster_params( int i) { #ifndef NDEBUG RAMEN_ASSERT( i < max_clusters); std::string kcenter( "k0_center"); std::string ktol( "k0_tol"); std::string ksoft( "k0_soft"); kcenter[1] = i + '0'; std::auto_ptr<color_param_t> c( new color_param_t( kcenter)); c->set_id( kcenter); c->set_default_value( Imath::Color4f( 0, 0, 0, 0)); c->set_is_rgba( false); c->set_static( true); //c->set_secret( true); c->set_enabled( false); c->set_can_undo( false); c->set_persist( false); c->set_include_in_hash( false); kcenter_[i] = c.get(); add_param( c); ktol[1] = i + '0'; std::auto_ptr<float_param_t> f( new float_param_t( ktol)); f->set_id( ktol); f->set_default_value( 0); f->set_min( 0); f->set_static( true); //f->set_secret( true); f->set_enabled( false); f->set_can_undo( false); f->set_persist( false); f->set_include_in_hash( false); ktol_[i] = f.get(); add_param( f); ksoft[1] = i + '0'; f.reset( new float_param_t( ksoft)); f->set_id( ksoft); f->set_default_value( 0); f->set_min( 0); f->set_static( true); //f->set_secret( true); f->set_enabled( false); f->set_can_undo( false); f->set_persist( false); f->set_include_in_hash( false); ksoft_[i] = f.get(); add_param( f); #endif }
void key_mix_layer_node_t::do_create_params() { std::auto_ptr<popup_param_t> p( new popup_param_t( "Mode")); p->set_id( "mode"); p->menu_items() = boost::assign::list_of( "Background")( "Foreground"); add_param( p); std::auto_ptr<float_param_t> q( new float_param_t( "Opacity")); q->set_id( "opacity"); q->set_range( 0, 1); q->set_default_value( 1); q->set_step( 0.01); add_param( q); }
int32 interpreter::register_card(card *pcard) { //create a card in by userdata card ** ppcard = (card**) lua_newuserdata(lua_state, sizeof(card*)); *ppcard = pcard; pcard->ref_handle = luaL_ref(lua_state, LUA_REGISTRYINDEX); //some userdata may be created in script like token so use current_state lua_rawgeti(current_state, LUA_REGISTRYINDEX, pcard->ref_handle); //load script if(pcard->data.alias && (pcard->data.alias < pcard->data.code + 10) && (pcard->data.code < pcard->data.alias + 10)) load_card_script(pcard->data.alias); else load_card_script(pcard->data.code); //set metatable of pointer to base script lua_setmetatable(current_state, -2); lua_pop(current_state, 1); //Initial if(pcard->data.code && (!(pcard->data.type & TYPE_NORMAL) || (pcard->data.type & TYPE_PENDULUM))) { pcard->set_status(STATUS_INITIALIZING, TRUE); add_param(pcard, PARAM_TYPE_CARD); call_card_function(pcard, (char*) "initial_effect", 1, 0); pcard->set_status(STATUS_INITIALIZING, FALSE); } pcard->cardid = pduel->game_field->infos.card_id++; return OPERATION_SUCCESS; }
static int process_parm(const char *key, const char *value, struct param **params) { const char *name, *param, *type; int namelen, paramlen, typelen; struct param *it; const char *colon = strchr(value, ':'); if (colon == NULL) { LOG("Found invalid \"%s=%s\": missing ':'\n", key, value); return 0; } name = value; namelen = colon - value; if (strcmp(key, "parm") == 0) { param = colon + 1; paramlen = strlen(param); type = NULL; typelen = 0; } else { param = NULL; paramlen = 0; type = colon + 1; typelen = strlen(type); } it = add_param(name, namelen, param, paramlen, type, typelen, params); if (it == NULL) { LOG("Out of memory!\n"); return -ENOMEM; } return 0; }
void flip_node_t::do_create_params() { std::auto_ptr<popup_param_t> p( new popup_param_t( "Mode")); p->set_id( "mode"); p->menu_items() = boost::assign::list_of( "Horizontal")( "Vertical")( "Both"); add_param( p); }
void move2d_node_t::do_create_params() { std::auto_ptr<transform2_param_t> xp( new transform2_param_t( "xform", "xf")); add_param( xp); create_default_filter_param(); std::auto_ptr<button_param_t> b( new button_param_t( "Apply Track...")); b->set_id( "apply_track"); add_param( b); std::auto_ptr<separator_param_t> sep( new separator_param_t()); add_param( sep); create_motion_blur_param(); }
void xform_node_t::create_motion_blur_param() { std::auto_ptr<motion_blur_param_t> mb( new motion_blur_param_t( "Motion Blur")); mb->set_id( "motion_blur"); mb->set_include_in_hash( false); add_param( mb); }
void set_matte_node_t::do_create_params() { std::auto_ptr<bool_param_t> q( new bool_param_t( "Premultiply")); q->set_id( "premultiply"); q->set_default_value( true); add_param( q); }
void Radiatore::add_param(string& out_str, int param, size_t len) { stringstream ss; ss << param; add_param(out_str, ss.str(), len); }
void exposure_node_t::do_create_params() { std::auto_ptr<float_param_t> p( new float_param_t( "Exp")); p->set_id( "exp"); p->set_default_value( 0.0f); p->set_step( 0.1); add_param( p); }
void premult_node_t::do_create_params() { std::auto_ptr<popup_param_t> p( new popup_param_t( "Mode")); p->set_id( "mode"); p->add_menu_item( "Premult"); p->add_menu_item( "Unpremult"); add_param( std::auto_ptr<param_t>( p.release())); }
void invert_node_t::do_create_params() { std::auto_ptr<popup_param_t> p( new popup_param_t( "Channels")); p->set_id( "channels"); p->add_menu_item( "RGB"); p->add_menu_item( "Alpha"); add_param( p); }
/** * ctor. * @param in the input * @param dim the dimension along which the inputs are concatenated */ Concatenate(std::vector<result_t> in, unsigned int dim) :Op(in.size(),1), m_dim(dim), m_n(in.size()) { //add all n params for ( unsigned int i = 0; i < in.size() ; i++) add_param(i, in[i]); }
static void con_geometry_define_parameter_cb(Fl_Widget *w, void *data) { add_param(FlGui::instance()->geoContext->input[0]->value(), FlGui::instance()->geoContext->input[1]->value(), FlGui::instance()->geoContext->input[24]->value(), FlGui::instance()->geoContext->input[25]->value(), GModel::current()->getFileName()); FlGui::instance()->resetVisibility(); }
http_header& http_header::add_format(const char* name, const char* fmt, ...) { string buf(128); va_list ap; va_start(ap, fmt); buf.vformat(fmt, ap); va_end(ap); return add_param(name, buf.c_str()); }