How to set default value with InterfaceGL? - c++

So, doing something like this:
paramsInterface->addParam("EpsilonUpper",&mKinectModule->mEpsilon,"min=0 max=1 step=.001");
Seems to set the value to whatever the cpp class assigns. Is there a parameter string way of doing it? Its just nice/quicker to see your initializers in the same spot, i.e. where the initializer string containing your min/max is.
The Doc
http://libcinder.org/docs/v0.8.2/classcinder_1_1params_1_1_interface_gl.html

No, there's not.
P.S. under the hood, the Params interface in Cinder is an implementation of AntTweakBar. You can see the available parameters here, though there's not a 1:1 feature mapping between AntTweakBar and Cinder's Params class.

Related

How can I associate data - a string, integer or enum member - with a Gtk::ComboBoxText item?

I am using gktmm 3.0 on an Ubuntu 12.04 box with the default GCC toolchain.
In the C# world, the ComboBox class has a ComboxBox.item[n].value property, which allows you to associate each item in the comboBox with data.
I am looking for something similar in the Gtk::ComboBoxTextclass. How can I associate data - a string, integer or enum member for example - with a particular Gtk::ComboBoxTextitem?
I know that many frameworks provide a genericdata pointer on widgets for such use, as this is quite a common need.
Is there something in Gtk::ComboBoxText class or one of its parent classes that might allow me accomplish this, or do I need to set up such an association myself, using a map or other associative collection?
The Gtk::ComboBoxText append, insert() and prepend() methods allows you to specify an ID string as well as the human-visible text. For instance:
https://developer.gnome.org/gtkmm/stable/classGtk_1_1ComboBoxText.html#a19e80f4e451e23d2c00d3fb11023f9f2
But it would be clearer and more type-safe to use Gtk::ComboBox and define an actual underlying model that contains the associated data. This example uses an int, but you could use other types or use more columns:
https://developer.gnome.org/gtkmm-tutorial/stable/combobox-example-full.html.en

How to get the full name of a Sitecore DMS rule?

I'm using Sitecore. I want to get the full name/description of a DMS rule in programcode by Sitecore ID, for example: "Where the DayOfWeek has a value that is equal to Tuesday".
Who knows how to do this?
Thanks a lot.
Jordy
I don't know of a simple way, but the class responsible for rendering the rule text is Sitecore.Shell.Applications.Rules.RulesRenderer in Sitecore.Client.dll.
Its constructor accepts the XML from a rules field and you call the Render method, passing in a prepared HtmlTexteWriter. It also has a bunch of fairly self-explanatory private methods like RenderRule, RenderCondition etc.
I'm sure if you decompile that class you can pick out the bits you need.

goocanvas how to switch of antialiasing

Can give me someone an idea how I can switch of the antialiasing for all items in a goocanvasmm?
I tried to get the root item model but this did not contain the antialiasing property.
I could not really find any valid documentation for goocanvasmm. I really need a tutorial but I can't find some.
[edit]
Sorry, I need the code for goocanvasmm!!! not goocanvas. So please do not edit this again. Yes, it is the c++ version of gtk+ called gtkmm and the goocanvasmm
[edit]
I have now a rect in the canvas and I could get the rect->property_antialias()=???? but now i struggled with PropertyProxy.
the following both lines will not work:
1)
rect->property_antialias()=CAIRO_ANTIALIAS_NONE ;
no match for »operator=« (operand types are »Glib::PropertyProxy« and »_cairo_antialias«)
2)
rect->property_antialias()=ANTIALIAS_NONE ;
error: 'ANTIALIAS_NONE' was not declared in this scope
Thanks!
GooCanvaItemSimple is the base class for most items. It has an antialias property which is of a type that maps to cairo_antialias_t.
This is for the C version, not C++, but it should be easy to map to the 'mm' versions of the docs. Here's the equivalent for antialias in goocanvasmm.
When you don't know where a property is, just dig in the parent classes or interfaces implemented until you find it.
Then, set the value of the appropriate Cairo::Antialias type (which is a type defined in cairomm).
rect->property_antialias() = Cairo::ANTIALIAS_NONE;

How can I print a ctemplate::TemplateDictionary in JSON form?

Using the Google CTemplate library, I have built a TemplateDictionary of params. Such a dictionary is a map of string keys to a variety of value types.
Typically, one passes CTemplate a template file wherein placeholders for each key in the dictionary are found and substituted.
In one case, though, I wish to emit the entire dictionary in JSON form, and the template language syntax doesn't appear to provide reflection such that I can write placeholders to loop over an unknown number of unknown keys in any arbitrary dictionary.
Did I miss some functionality?
If so, how can I add it?
Will I have to patch the CTemplate code? Much of what I seem to need for the job appears to be marked private i.e. for internal use only...
I've ended up hacking the CTemplate source in template_dictionary.h and template_dictionary.cc, cloning class class TemplateDictionary::DictionaryPrinter to produce a new class class TemplateDictionary::DictionaryJsonPrinter, adapting its member functions to emit JSON syntax.

Softimage access parameters in C++

I'm a bit desperate here... I'm trying to access one parameter of a light in Softimage.
First, when we do this:
light.GetParameterValue(L"LightExponent")
it works!
But when we try:
light.GetParameterValue(L"soft_light.atten")
it fails completely!
I tried to find documentation, but the only code that I could find is in Python and no indication for the equivalent in C++. In python, they manage to do something like:
xsi = Application
test = xsi.GetValue("LightName.point.soft_light.atten")
But I cannot figure out what is Application, and it's not the same as XSI::Application in the API.
So, any idea how to access this value ? Also, if I could found the equivalent to Application.GetValue (in the script, you can see Application.SetValue... so I imagine that GetValue exists in some form!) in C++, that would be nice... I could simply use the name of the light and then add the information that I need to access that value like:
SomeUnknownClassForNow::GetValue(light.GetName() + ".point.soft_light.atten");
Any idea ?
With the help of a client of ours, I finally managed to find a proper solution to this.
First, there's some direct parameters, like "LightExponent". But there's other parameters associated with an object, like a light, in other categories called Shaders.
With a light, or a least a point light, there's only one Shader, called "soft_light". It's possible to access it by:
light.GetShaders()[0]
It's possible to verify its name to with GetName(). Which, in this case, would be "LightName.point.soft_light".
Finally, to access the "soft_light.atten" parameter:
light.GetShaders()[0].GetParameterValue("atten")
So, in Softimage, there's sort of Hierarchy in objects and all these a separated as shaders. For more complex object, just find the right shader and extract its parameter.