I am writing a Maya plugin in c++, and have a custom MPxLocatorNode.I have added numerous custom attributes to this node with:
MFnNumericAttribute nAttr;
Attrib1 = nAttr.create( "Attribute1", "att1", MFnNumericData::kInt,1.0 );
nAttr.setKeyable(false);
nAttr.setStorable(true);
nAttr.setReadable(true);
nAttr.setWritable(true);
nAttr.setHidden(false);
addAttribute( unitId );
Attrib2 = nAttr.create( "Attribute2", "att2", MFnNumericData::kInt,1.0 );
nAttr.setKeyable(false);
...
However I need to add plenty of these attributes and would therefore like to group them when displayed in the attribute editor. Is there a way to dynamically create groups or separators ?
I am a bit confused by the word grouping, but I'll answer the 2 grouping options.
The first one is to group attributes as a compound. A good example of a compound is a point compound. In short you got a point attribute which owns 3 double attributes. So the x, y, z coordinates are grouped under the Point attribute. If now you go in the Channel Editor, you'll see the grouping effect. In the Attribute Editor and for known / predefined types, controls will be assigned automatically, doing some grouping as well.
Now, and because you mentioned the Attribute Panel, I think you are more interested on how you teach the Attribute Editor to have a different layout than the default one. If you create an AE<my custom node name>Template.mel file, with a function of the same name in it, then you can take control on how the layout is done and group, show, hide, change controls of each individual attributes.
For example I got a custom node which you can download from here. Since it is Python and MEL, you can get the full source code from there.
The node name is adskMathNode.
So I created a AEadskMathNodeTemplate.mel file.
This file contains a function declare like this:
global proc AEasdkMathNodeTemplate (string $nodeName) {
editorTemplate -beginScrollLayout ;
...
}
This is where you describe the new layout.
You'll get plenty of bigger example in the Maya folder at
/scripts/AETemplates
Related
I have a layout file with a warehouse bin storing system (only one level), I have combined the shapes with dimensions on the layout, the visio file with an outer excel data (there are multiple properties, but only Reference no. - Reference number is important to us at this stage only).
Now I need to make for example a macro or any other solution to:
1) copy the property internal number,
2) edit the shape name,
3) make a new line below the name,
4) paste the copied property.
And do that to all shapes named from A1001-A2162, B1001-B2208, C1001-C2276, X1001-X1025, Z1001-Z2087.
Can somebody please help me with this issue?
I would recommend to not use the name of the shape. It just brings confusion where there is no need to (Name versus universal name, the name being unique on one page, etc.).
Rather use a custom property and name it "Name". This new property can now be edited in the shape data window.
For displaying the properties (Reference number and name) you have several possibilities.
Either use the shape's text (Hit F2, then use the insert menu to insert the desired fields),
or use Visio's data graphics.
For labelling a lot of shapes you can of course write a macro (use the macro recorder on one shape, then make it generic by replacing the specific shape information by general ones),
but I would rahter use the built in functions:
1) in the case of using the shape's text, set up a master having the labels already prepared, then use it for your drawing.
2) in the case of data graphics, just select all the relevant shapes and apply the data graphics. This will label them all in one operation.
I am using the Dynamic Placeholders from Fortis, but need to setup a page template where the Dynamic Placeholders contains renderings. I am setting the page template up, by setting layout detail on the standard values of the page template.
I have been unable to succeed in this, since the dynamic placeholder is postfixed by a GUID which is generated. Is there a way to predict this GUID? According to the documentation, the GUID is generated using the following logic:
Dynamic Placeholders simply use the rendering ID to create a unique placeholder name. If more than one dynamic placeholder with the same name is in a rendering it will also append on an incrementing number
I tried another approach, by using a home brewed dynamic placeholder library, which just prepended the dynamic placeholder with a sequential number, e.g. row1, row2, row3. But this approach makes the content editors unable to move rows in the experience editor, since the content inside the row is tied to a fixed number, which changes when the rows are moved.
As this question have been answered on sitecore.stackexchange.com, I want to bring the answer here as well. Big credit to Richard Seal and Thomas D.
Thomas D:
You can try to open the standard values item with the Experience Editor and add the renderings you like.
Richard Seal:
This is an alternative to the method mentioned by Thomas D.
The Fortis solution uses the UID for the rendering attached to the placeholder key that you enter. You can get this by changing to Raw Values view and copying the xml out of the renderings or final renderings field.
Find the rendering that contains your placeholder. There will be an xml element like this:
<r id="{CA76EB6F-2934-4B8A-BB6A-508A8E44A7C5}"
ph="body"
uid="{0FD41EBD-43CF-4647-8A0F-F1F1D2E00CCD}" />
There may be other fields too. The 2 that are important are id, which is the item id of your rendering item and uid, this is the unique rendering id that is added to your placeholder key.
The key is built like this: string.Format("{0}_{1}", placeholderName, renderingId);
So if you have a placeholder key called title, the key for the above xml snippet would be: title_{0FD41EBD-43CF-4647-8A0F-F1F1D2E00CCD}
I'm currently learning HDF5 and need to figure out how to add attributes to an empty group with C++. I know how to do it via HDFView, but I can't seem to find any documentation about adding attributes to a simple group, only datasets (is this even possible?).
In HDFView, if you add a group then right-click that group and select "Show properties", a new window will pop up with tabs for 'General' and 'Attributes'. In the 'Attributes' tab you can add multiple attributes. I basically want to do this, but through code.
My code below adds a single group to a new H5 file:
//Create a new file using default properties
H5File file("NewH5.h5", H5F_ACC_TRUNC);
//Create PLATFORM_t and SONAR_t groups in the file
Group groupPlatform(file.createGroup("/PLATFORM_t"));
The operations on attributes attached to files, groups, datasets etc. are the member functions of the H5Location class. In order to write an attribute named "some_attribute" of type double in your group you simply call
double value=42;
DataSpace dspace(H5S_SCALAR);
Attribute att = groupPlatform.createAttribute("some_attribute",PredType::NATIVE_DOUBLE,dspace);
att.write(PredType::NATIVE_DOUBLE,&value);
More complex attributes are possible if you use more complex dataspaces.
I have a situation where I'm using the IEditorDataFilter interface within a custom UltraGrid editor control to automatically map values from a bound data source when they're displayed in the grid cells. In this case it's converting guid-based key values into user-friendly values, and it works well by displaying what I need in the cell, but retaining the GUID values as the 'value' behind the scenes.
My issue is what happens when I enable the built-in group by functionality and the user groups by a column using my editor. In that case the group by headers default to using the cell's value, which is the guid in my case, so I end up with headers like this:
Column A: 7F720CE8-123A-4A5D-95A7-6DC6EFFE5009 (10 items)
What I really want is the cell's display value to be used instead so it's something like this:
Column A: Item 1 (10 items)
What I've tried so far
Infragistics provides a couple mechanisms for modifying what's shown in group by rows:
GroupByRowDescriptionMask property of the grid (http://bit.ly/1g72t1b)
Manually set the row description via the InitializeGroupByRow event (http://bit.ly/1ix1CbK)
Option 1 doesn't appear to give me what I need because the cell's display value is not exposed in the set of tokens they provide. Option 2 looks promising but it's not clear to me how to get at the cell's display value. The event argument only appears to contain the cell's backing value, which in my case is the GUID.
Is there a proper approach for using the group by functionality when you're also using an IEditorDataFilter implementation to convert values?
This may be frowned upon, but I asked my question on the Infragistic forums as well, and a complete answer is available there (along with an example solution demonstrating the problem):
http://www.infragistics.com/community/forums/p/88541/439210.aspx
In short, I was applying my custom editors at the cell level, which made them unavailable when the rows were grouped together. A better approach would be to apply the editor at the column level, which would make the editor available at the time of grouping, and would provide the expected behavior.
I have two issues:
I have a complex object with Id and Text underneath. For display, I am using TemplateDataField with eval function. Can I bind the complex object to a BoundDataField?
The reason behind binding the complex object to BoundDataField is, I need to make it editable grid. I could not find any documentation or samples which uses Template field, and make that column editable. (I agree it might not be possible.) Now I need to put a dropdown, where user selects a value and I can assign it to the id field of my complex object. I am able to put a dropdown (using EditorProviders) to a bounddatafield, but how can I do it for the template data field described above?
Here is a link to the samples of Editing WebDatagrid: Controls & Application Samples
When using a TemplateDataField you are specifying what you want to use as the template and you can put an editor in that Field. Note that if you do put an editor in that field, you need to handle updates to the grid's value or list that your grid is bound to.
Note that if the values in your drop down have an id associated with them and that can be the value of the grid cell it would be better to use the DropDownEditorProvider with the grid having a bound field where that field is the id of the item that you are selecting.