[sldev] A patch to allow creation of megaprims from within the viewer

Jacek Antonelli jacek.antonelli at gmail.com
Mon May 12 00:28:07 PDT 2008


On Sun, May 11, 2008 at 3:37 PM, Able Whitman <able.whitman at gmail.com> wrote:
>
> I've attached my patch (which is against 1.19.1.4, the most recent official
> release viewer), as well as a screenshot demonstrating the patch in action.
>
> Please let me know if you have any questions, thoughts, or concerns.
>
> Cheers,
> --Able
>

Great work, Able! This is a godsend, even if it is a dirty hack. ;D

I've attached a patch which applies your changes to the 1.20 sources
(specifically RC5). There have been some changes between 1.19 and 1.20
that make it non-trivial to apply your 1.19.4 patch (e.g.
llcontroldef.cpp was removed, everything's in
app_settings/settings.xml now). Hopefully my patch will help anyone
else using 1.20. :)

Thanks again, and let's keep our fingers crossed that LL will lift the
editing limits, or at least leave the creation limits off long enough
for me to finish my giant octopus sculpture!

 - Jacek
-------------- next part --------------
Index: linden/indra/newview/llfloatertools.h
===================================================================
@@ -50,6 +50,7 @@
 class LLComboBox;
 class LLParcelSelection;
 class LLObjectSelection;
+class LLSpinCtrl;
 
 typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
 
@@ -157,6 +158,11 @@
 	LLCheckBoxCtrl	*mCheckCopyCenters;
 	LLCheckBoxCtrl	*mCheckCopyRotates;
 
+	LLTextBox		*mLabelNewSize;
+	LLSpinCtrl		*mSpinNewX;
+	LLSpinCtrl		*mSpinNewY;
+	LLSpinCtrl		*mSpinNewZ;
+
 	// Land buttons
 //	LLCheckBoxCtrl	*mRadioEditLand;
 	LLCheckBoxCtrl	*mRadioSelectLand;
Index: linden/indra/newview/lltoolplacer.cpp
===================================================================
@@ -64,8 +64,6 @@
 #include "llviewercamera.h"
 #include "llviewerstats.h"
 
-const LLVector3 DEFAULT_OBJECT_SCALE(0.5f, 0.5f, 0.5f);
-
 //static 
 LLPCode	LLToolPlacer::sObjectType = LL_PCODE_CUBE;
 
@@ -182,7 +180,7 @@
 
 	// Set params for new object based on its PCode.
 	LLQuaternion	rotation;
-	LLVector3		scale = DEFAULT_OBJECT_SCALE;
+	LLVector3		scale(gSavedSettings.getF32("RezNewScaleX"), gSavedSettings.getF32("RezNewScaleY"), gSavedSettings.getF32("RezNewScaleZ"));
 	U8				material = LL_MCODE_WOOD;
 	BOOL			create_selected = FALSE;
 	LLVolumeParams	volume_params;
Index: linden/indra/newview/app_settings/settings.xml
===================================================================
@@ -5903,6 +5903,39 @@
         <key>Value</key>
             <integer>512</integer>
         </map>
+    <key>RezNewScaleX</key>
+        <map>
+        <key>Comment</key>
+            <string>Default X dimension scale when creating a new prim</string>
+        <key>Persist</key>
+            <integer>0</integer>
+        <key>Type</key>
+            <string>F32</string>
+        <key>Value</key>
+            <real>0.5</real>
+        </map>
+    <key>RezNewScaleY</key>
+        <map>
+        <key>Comment</key>
+            <string>Default Y dimension scale when creating a new prim</string>
+        <key>Persist</key>
+            <integer>0</integer>
+        <key>Type</key>
+            <string>F32</string>
+        <key>Value</key>
+            <real>0.5</real>
+        </map>
+    <key>RezNewScaleZ</key>
+        <map>
+        <key>Comment</key>
+            <string>Default Z dimension scale when creating a new prim</string>
+        <key>Persist</key>
+            <integer>0</integer>
+        <key>Type</key>
+            <string>F32</string>
+        <key>Value</key>
+            <real>0.5</real>
+        </map>
     <key>RotateRight</key>
         <map>
         <key>Comment</key>
Index: linden/indra/newview/llfloatertools.cpp
===================================================================
@@ -54,6 +54,7 @@
 #include "llpanelvolume.h"
 #include "llpanelpermissions.h"
 #include "llselectmgr.h"
+#include "llspinctrl.h"
 #include "llstatusbar.h"
 #include "lltabcontainer.h"
 #include "lltextbox.h"
@@ -113,6 +114,9 @@
 void commit_radio_pan(LLUICtrl *, void*);
 void commit_grid_mode(LLUICtrl *, void*);
 void commit_slider_zoom(LLUICtrl *, void*);
+void commit_new_x(LLUICtrl *ctrl, void *data);
+void commit_new_y(LLUICtrl *ctrl, void *data);
+void commit_new_z(LLUICtrl *ctrl, void *data);
 
 
 //static
@@ -283,6 +287,22 @@
 	childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
 	mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates");
 	childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
+
+	mLabelNewSize = getChild<LLTextBox>("CreateToolNewSizeLabel");
+
+	mSpinNewX = getChild<LLSpinCtrl>("CreateToolNewX");
+	childSetValue("CreateToolNewX", (F32)gSavedSettings.getF32("RezNewScaleX"));
+	childSetCommitCallback("CreateToolNewX", commit_new_x, mSpinNewX);
+
+	mSpinNewY = getChild<LLSpinCtrl>("CreateToolNewY");
+	childSetValue("CreateToolNewY", (F32)gSavedSettings.getF32("RezNewScaleY"));
+	childSetCommitCallback("CreateToolNewY", commit_new_y, mSpinNewY);
+
+	mSpinNewZ = getChild<LLSpinCtrl>("CreateToolNewZ");
+	childSetValue("CreateToolNewZ", (F32)gSavedSettings.getF32("RezNewScaleZ"));
+	childSetCommitCallback("CreateToolNewZ", commit_new_z, mSpinNewZ);
+
+
 	mRadioSelectLand = getChild<LLCheckBoxCtrl>("radio select land");
 	childSetCommitCallback("radio select land",commit_select_tool, LLToolSelectLand::getInstance());
 	mRadioDozerFlatten = getChild<LLCheckBoxCtrl>("radio flatten");
@@ -372,6 +392,12 @@
 	mCheckCopySelection(NULL),
 	mCheckCopyCenters(NULL),
 	mCheckCopyRotates(NULL),
+
+	mLabelNewSize(NULL),
+	mSpinNewX(NULL),
+	mSpinNewY(NULL),
+	mSpinNewZ(NULL),
+
 	mRadioSelectLand(NULL),
 	mRadioDozerFlatten(NULL),
 	mRadioDozerRaise(NULL),
@@ -673,6 +699,11 @@
 	if (mCheckCopyCenters) mCheckCopyCenters	->setVisible( create_visible );
 	if (mCheckCopyRotates) mCheckCopyRotates	->setVisible( create_visible );
 
+	if (mLabelNewSize) mLabelNewSize	->setVisible( create_visible );
+	if (mSpinNewX) mSpinNewX	->setVisible( create_visible );
+	if (mSpinNewY) mSpinNewY	->setVisible( create_visible );
+	if (mSpinNewZ) mSpinNewZ	->setVisible( create_visible );
+
 	if (mCheckCopyCenters) mCheckCopyCenters->setEnabled( mCheckCopySelection->get() );
 	if (mCheckCopyRotates) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() );
 
@@ -942,6 +973,24 @@
 	gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
 }
 
+void commit_new_x(LLUICtrl *ctrl, void *data)
+{
+	LLSpinCtrl* spin = (LLSpinCtrl*) data;
+	gSavedSettings.setF32("RezNewScaleX", spin->get());
+}
+
+void commit_new_y(LLUICtrl *ctrl, void *data)
+{
+	LLSpinCtrl* spin = (LLSpinCtrl*) data;
+	gSavedSettings.setF32("RezNewScaleY", spin->get());
+}
+
+void commit_new_z(LLUICtrl *ctrl, void *data)
+{
+	LLSpinCtrl* spin = (LLSpinCtrl*) data;
+	gSavedSettings.setF32("RezNewScaleZ", spin->get());
+}
+
 void commit_select_component(LLUICtrl *ctrl, void *data)
 {
 	LLFloaterTools* floaterp = (LLFloaterTools*)data;
Index: linden/indra/newview/skins/xui/en-us/floater_tools.xml
===================================================================
@@ -227,6 +227,26 @@
 	     image_unselected="object_grass.tga" label="" label_selected=""
 	     left_delta="28" mouse_opaque="true" name="ToolGrass" scale_image="TRUE"
 	     tool_tip="Grass" width="30" />
+	<!-- -->
+	<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
+	   bottom="-84" drop_shadow_visible="true" follows="left|top"
+	   font="SansSerifSmall" h_pad="0" halign="right" height="10" left="110"
+	   mouse_opaque="true" name="CreateToolNewSizeLabel" v_pad="0" width="151">
+	  New Object Size (meters)
+	</text>
+	<spinner bottom_delta="-20" decimal_digits="3" follows="left|top" halign="right" height="16"
+	     increment="0.001" initial_val="0" label="X" label_width="10" left="136"
+	     max_val="512" min_val="0.0001" mouse_opaque="true" name="CreateToolNewX"
+	     text_enabled_color="1, 0.25, 0, 1" width="87" />
+	<spinner bottom_delta="-18" decimal_digits="3" follows="left|top" halign="right" height="16"
+	     increment="0.001" initial_val="0" label="Y" label_width="10" left="136"
+	     max_val="512" min_val="0.0001" mouse_opaque="true" name="CreateToolNewY"
+	     text_enabled_color="0, 1, 0, 1" width="87" />
+	<spinner bottom_delta="-18" decimal_digits="3" follows="left|top" halign="right" height="16"
+	     increment="0.001" initial_val="0" label="Z" label_width="10" left="136"
+	     max_val="512" min_val="0.0001" mouse_opaque="true" name="CreateToolNewZ"
+	     text_enabled_color="0, 0.5, 1, 1" width="87" />
+	<!-- -->
 	<check_box bottom="-120" control_name="CreateToolKeepSelected" follows="left|top"
 	     font="SansSerifSmall" height="16" initial_value="false"
 	     label="Keep Tool Selected" left="4" mouse_opaque="true"
@@ -599,15 +619,15 @@
 			</text>
 			<spinner bottom_delta="-20" decimal_digits="3" follows="left|top" height="16"
 			     increment="0.01" initial_val="0" label="X" label_width="10" left="10"
-			     max_val="10" min_val="0.01" mouse_opaque="true" name="Scale X"
+			     max_val="512" min_val="0.01" mouse_opaque="true" name="Scale X"
 			     text_enabled_color="1, 1, 1, 1" width="87" />
 			<spinner bottom_delta="-18" decimal_digits="3" follows="left|top" height="16"
 			     increment="0.01" initial_val="0" label="Y" label_width="10" left="10"
-			     max_val="10" min_val="0.01" mouse_opaque="true" name="Scale Y"
+			     max_val="512" min_val="0.01" mouse_opaque="true" name="Scale Y"
 			     text_enabled_color="1, 1, 1, 1" width="87" />
 			<spinner bottom_delta="-18" decimal_digits="3" follows="left|top" height="16"
 			     increment="0.01" initial_val="0" label="Z" label_width="10" left="10"
-			     max_val="10" min_val="0.01" mouse_opaque="true" name="Scale Z"
+			     max_val="512" min_val="0.01" mouse_opaque="true" name="Scale Z"
 			     text_enabled_color="1, 1, 1, 1" width="87" />
 			<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
 			     bottom_delta="-16" drop_shadow_visible="true" follows="left|top"


More information about the SLDev mailing list